:root {
  --bg: #101014;
  --bg-panel: #1a1a21;
  --bg-card: #1f1f28;
  --border: #33333f;
  --text: #e8e6e3;
  --text-dim: #9a97a0;
  --accent: #c1272d;
  --accent-soft: #e05a5f;
  --perk: #a24df0;
  --addon: #4d9df0;
  --gold: #e0b13e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: radial-gradient(circle at 50% -20%, #23232e 0%, var(--bg) 60%);
  min-height: 100vh;
  color: var(--text);
  line-height: 1.7;
}

.site-header {
  text-align: center;
  padding: 32px 16px 0;
}

.site-header h1 {
  font-size: 2.1rem;
  letter-spacing: 0.12em;
}

.accent {
  color: var(--accent-soft);
}

.tagline {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 4px;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  padding: 10px 24px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

#post {
  max-width: 760px;
  margin: 0 auto;
}

/* ===== キャラクターサイドバー ===== */

.browse-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.char-sidebar {
  flex: none;
  width: 200px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
}

.browse-main {
  flex: 1;
  min-width: 0;
}

.char-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.char-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.char-item.active {
  background: rgba(193, 39, 45, 0.22);
  color: var(--text);
}

.char-item img,
.char-glyph {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
}

.char-item.active img,
.char-item.active .char-glyph {
  box-shadow: 0 0 0 2px var(--accent);
}

.char-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: bold;
}

.char-glyph.all {
  background: #2a2a35;
  color: var(--gold);
}

.char-glyph.survivor {
  background: rgba(77, 143, 240, 0.18);
  color: #7fb0f5;
}

.char-glyph.killer {
  background: rgba(193, 39, 45, 0.18);
  color: var(--accent-soft);
}

.char-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.char-divider {
  border-top: 1px solid var(--border);
  margin: 8px 6px;
}

/* ===== フィルタ ===== */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  gap: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.chip {
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--text-dim);
  padding: 5px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  color: #fff;
}

.select,
.text-input,
textarea {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  padding: 8px 12px;
  font-family: inherit;
}

.select:focus,
.text-input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
}

/* ===== サジェスト ===== */

.suggest-wrap {
  position: relative;
}

.suggest-wrap > .text-input {
  width: 100%;
}

.suggest-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: min(280px, 80vw);
  max-width: 90vw;
  width: max-content;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  z-index: 30;
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 12px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.suggest-item.active,
.suggest-item:hover {
  background: rgba(193, 39, 45, 0.2);
}

.suggest-item img,
.suggest-noicon {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 4px;
}

.suggest-name {
  flex: 1;
  white-space: nowrap;
}

.suggest-sub {
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
}

.mine-toggle {
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== ビルドカード ===== */

.build-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.build-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.char-portrait {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  background: #000;
}

.char-portrait-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--accent-soft);
  background: rgba(193, 39, 45, 0.12);
}

.char-portrait-fallback.survivor {
  border-color: #4d8ff0;
  color: #7fb0f5;
  background: rgba(77, 143, 240, 0.12);
}

.card-head-text {
  flex: 1;
  min-width: 0;
}

.card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.card-character {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.fav-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s;
}

.fav-btn:hover {
  transform: scale(1.2);
  color: var(--gold);
}

.fav-btn.faved {
  color: var(--gold);
}

.rank {
  font-weight: bold;
  color: var(--text-dim);
  min-width: 2.4em;
}

.rank.rank-1 { color: var(--gold); }
.rank.rank-2 { color: #c9ccd4; }
.rank.rank-3 { color: #c98a4d; }

.build-title {
  font-size: 1.15rem;
  font-weight: bold;
  flex: 1;
  min-width: 200px;
}

.badge {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}

.badge.killer {
  border-color: var(--accent);
  color: var(--accent-soft);
}

.badge.survivor {
  border-color: #4d8ff0;
  color: #7fb0f5;
}

/* ===== ロードアウト(パークタイル+アドオン) ===== */

.loadout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 20px;
  margin-top: 14px;
}

.perk-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.perk-tile {
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}

.perk-tile-imgwrap {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(162, 77, 240, 0.28), rgba(162, 77, 240, 0.05) 75%);
  border: 1px solid rgba(162, 77, 240, 0.5);
  border-radius: 10px;
}

.perk-tile-imgwrap img {
  width: 54px;
  height: 54px;
}

.perk-tile.empty .perk-tile-imgwrap {
  border-style: dashed;
  background: none;
  opacity: 0.3;
}

.perk-tile-noicon {
  font-size: 1.4rem;
  color: #cfaaf7;
  opacity: 0.7;
}

.perk-tile-name {
  font-size: 0.68rem;
  line-height: 1.35;
  color: #cfaaf7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.loadout-divider {
  align-self: stretch;
  border-left: 1px solid var(--border);
  margin: 4px 0;
}

.perk-tile-imgwrap.addon {
  background: radial-gradient(circle at 50% 30%, rgba(77, 157, 240, 0.26), rgba(77, 157, 240, 0.05) 75%);
  border-color: rgba(77, 157, 240, 0.5);
}

.addon-tile .perk-tile-name {
  color: #9cc4f5;
}

/* ===== 5段階評価 ===== */

.ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin-top: 12px;
}

.rating {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rating-label {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.rating-stars {
  color: var(--gold);
  font-size: 0.9rem;
  letter-spacing: 2px;
}

.rating-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.rating-input-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rating-input-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  min-width: 3.2em;
}

.star-input .star {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  padding: 0 2px;
  cursor: pointer;
  line-height: 1;
}

.star-input .star.on {
  color: var(--gold);
}

.star-input .star:hover {
  transform: scale(1.15);
}

/* ===== 編集モード ===== */

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(224, 177, 62, 0.1);
  border: 1px solid rgba(224, 177, 62, 0.45);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--gold);
}

.edit-cancel {
  background: none;
  border: 1px solid rgba(224, 177, 62, 0.45);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.8rem;
  padding: 4px 12px;
  cursor: pointer;
}

.edit-cancel:hover {
  background: rgba(224, 177, 62, 0.15);
}

.edit-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

.edit-btn:hover {
  color: var(--gold);
}

/* ===== ツールチップ ===== */

.tip {
  position: fixed;
  z-index: 60;
  max-width: 340px;
  background: #23232e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.tip-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.tip-name {
  font-weight: bold;
  font-size: 0.9rem;
}

.tip-sub {
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
}

.tip-desc {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}

.card-section {
  margin-top: 12px;
}

.card-section h4 {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

.card-section p {
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.vote-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  padding: 4px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s;
}

.vote-btn:hover {
  transform: scale(1.05);
}

.vote-btn.up.voted {
  border-color: #58b368;
  color: #7fd48a;
  background: rgba(88, 179, 104, 0.14);
}

.vote-btn.down.voted {
  border-color: var(--accent);
  color: var(--accent-soft);
  background: rgba(193, 39, 45, 0.14);
}

.meta {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

.delete-btn:hover {
  color: var(--accent-soft);
}

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 0;
}

/* ===== 投稿フォーム ===== */

.post-form {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

fieldset {
  border: none;
  display: flex;
  gap: 20px;
}

legend {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

fieldset label {
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.req {
  font-style: normal;
  color: var(--accent-soft);
  font-size: 0.75rem;
  margin-left: 6px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 520px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* 狭い画面ではサイドバーを横スクロールのアイコン帯にする */
@media (max-width: 760px) {
  .browse-layout {
    display: block;
  }

  .char-sidebar {
    position: static;
    width: auto;
    max-height: none;
    display: flex;
    overflow-x: auto;
    gap: 4px;
    margin-bottom: 16px;
  }

  .char-item {
    flex: none;
    flex-direction: column;
    gap: 4px;
    width: 70px;
    padding: 6px 2px;
    font-size: 0.65rem;
    text-align: center;
  }

  .char-label {
    max-width: 100%;
  }

  .char-divider {
    flex: none;
    border-top: none;
    border-left: 1px solid var(--border);
    margin: 6px 4px;
  }
}

.submit-btn {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  padding: 12px;
  cursor: pointer;
}

.submit-btn:hover {
  background: var(--accent-soft);
}

.form-message {
  text-align: center;
  font-size: 0.9rem;
}

.form-message.ok { color: #7fd48a; }
.form-message.ng { color: var(--accent-soft); }

.site-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 24px 16px;
  border-top: 1px solid var(--border);
}
