:root {
  --bg: #f6f3ec;
  --paper: #fffdf8;
  --ink: #1d1c1a;
  --muted: #716e67;
  --line: #ddd7cb;
  --accent: #7a2f2f;
  --accent-soft: #f3e5df;
  --gold: #a36b00;
  --shadow: 0 18px 50px rgba(45, 37, 24, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 10% 0%, rgba(122,47,47,.06), transparent 28%), var(--bg);
  color: var(--ink);
  line-height: 1.65;
}
a { color: inherit; }
button, input { font: inherit; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid rgba(221, 215, 203, .9);
  background: rgba(246, 243, 236, .88);
  backdrop-filter: blur(14px);
}
.topbar-inner {
  max-width: 1220px; margin: 0 auto; padding: 14px 24px;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
}
.brand { text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.github-link { text-decoration: none; color: var(--muted); font-size: 14px; }
.shell { max-width: 1220px; margin: 0 auto; padding: 60px 24px 90px; }
.hero { padding: 26px 0 42px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .16em; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.035em; }
.hero h1 { margin: 0; font-size: clamp(34px, 6vw, 68px); }
.hero-copy { max-width: 720px; margin: 18px 0 0; color: var(--muted); font-size: 18px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.stat { padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.55); color: var(--muted); font-size: 14px; }
.stat strong { color: var(--ink); }
.panel { border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.section-head { padding: 28px 30px 20px; display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.section-head h2 { margin: 0; font-size: 30px; }
.toolbar { min-width: min(360px, 100%); }
.searchbox { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--muted); font-size: 13px; }
.searchbox input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.sortbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 30px 20px; align-items: center; }
.sort-label { margin-right: 4px; color: var(--muted); font-size: 13px; }
.sort-btn { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: transparent; color: var(--muted); cursor: pointer; }
.sort-btn:hover, .sort-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.status { padding: 32px; color: var(--muted); text-align: center; }
.table-wrap { overflow-x: auto; }
.candidate-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.candidate-table th, .candidate-table td { padding: 16px 14px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.candidate-table th { position: static; background: #f8f4ec; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.candidate-table tbody tr:hover { background: #fbf7f0; }
.game-link { color: var(--ink); font-weight: 800; text-decoration: none; }
.game-link:hover { color: var(--accent); text-decoration: underline; }
.meta-muted { color: var(--muted); font-size: 13px; }
.priority { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; padding: 5px 9px; border-radius: 999px; font-weight: 900; font-size: 13px; }
.priority-a { background: #fff0cf; color: #8a5800; }
.priority-b { background: #e8eefc; color: #36538c; }
.priority-c { background: #ececec; color: #606060; }
.rating { white-space: nowrap; color: var(--gold); font-weight: 700; }
.ps3-views[hidden], .sort-btn[hidden] { display: none; }
.recommendation-views[hidden] { display: none; }
.recommendation-rationale { margin: 7px 0 0; max-width: 48ch; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }
.provisional-score { text-decoration: underline dotted; text-underline-offset: 3px; }
.held-score { color: var(--muted); font-weight: 500; }
.evidence-filter { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.evidence-filter select { max-width: 145px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: inherit; }
.rating-details { display: block; }
.personal-rating { display: block; margin-bottom: 3px; color: var(--accent); font-size: 13px; }
.quality-rating { display: block; font-size: 12px; }
.reserve-label { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
.state { white-space: nowrap; }
.footnote { margin: 0; padding: 18px 30px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.reader-shell { max-width: 980px; margin: 0 auto; padding: 48px 22px 90px; }
.reader { padding: clamp(28px, 5vw, 64px); border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.reader h1 { margin-top: 0; font-size: clamp(32px, 6vw, 52px); }
.reader h2 { margin-top: 46px; padding-top: 8px; font-size: 28px; border-top: 1px solid var(--line); }
.reader h3 { margin-top: 30px; font-size: 21px; }
.reader p, .reader li { font-size: 16px; }
.reader a { color: var(--accent); text-underline-offset: 3px; }
.reader blockquote { margin: 20px 0; padding: 12px 18px; border-left: 4px solid var(--accent); background: var(--accent-soft); color: #4f413d; }
.reader code { padding: 2px 6px; border-radius: 6px; background: #eee9df; }
.reader pre { overflow-x: auto; padding: 16px; border-radius: 14px; background: #24221f; color: #f8f6f1; }
.reader pre code { padding: 0; background: transparent; }
.reader table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; margin: 20px 0; }
.reader th, .reader td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.reader th { background: #f7f2e9; }
.reader img { max-width: 100%; height: auto; border-radius: 14px; }
.reader-status { padding-top: 80px; }
@media (max-width: 760px) {
  .shell { padding: 34px 14px 60px; }
  .topbar-inner { padding: 12px 14px; }
  .section-head { padding: 22px 18px 14px; align-items: stretch; flex-direction: column; }
  .sortbar { padding: 0 18px 16px; }
  .footnote { padding: 16px 18px 20px; }
  .panel { border-radius: 18px; }
  .hero { padding-top: 12px; }
  .hero-copy { font-size: 16px; }
  .reader-shell { padding: 24px 12px 60px; }
  .reader { padding: 26px 20px; border-radius: 18px; }
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171614; --paper: #201e1b; --ink: #f4f0e8; --muted: #aaa49a; --line: #3b3731; --accent: #e89b8f; --accent-soft: #342522; --gold: #efbf58; --shadow: none; }
  body { background: var(--bg); }
  .topbar { background: rgba(23,22,20,.88); }
  .searchbox { background: #25221e; }
  .candidate-table th { background: #26231f; }
  .candidate-table tbody tr:hover { background: #28241f; }
  .reader blockquote { color: #ddcfc9; }
  .reader code { background: #312d27; }
  .reader th { background: #2b2722; }
  .stat { background: rgba(255,255,255,.03); }
}


/* Watchlist / patch integration */
body { overflow-x: hidden; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn, .primary-btn, .secondary-btn, .danger-btn {
  min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 13px;
  background: var(--paper); color: var(--ink); cursor: pointer;
}
.icon-btn { width: 44px; padding: 0; font-size: 20px; }
.primary-btn { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 800; }
.secondary-btn { background: transparent; }
.danger-btn { color: #a13535; background: transparent; }
.my-list-summary {
  display: inline-flex; margin-top: 10px; padding: 6px 10px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.my-list-summary:hover, .my-list-summary.active { background: var(--accent-soft); color: var(--accent); }
.group-heading th {
  padding: 10px 14px; background: #f1ede4; color: var(--ink); font-size: 13px; letter-spacing: .02em;
}
.group-heading th span { margin-left: 5px; color: var(--muted); font-weight: 600; }
.group-heading.started th { border-left: 4px solid #4676c8; }
.group-heading.starred th { border-left: 4px solid #c79224; }
.candidate-table .rank-head, .candidate-table .rank-cell { width: 76px; text-align: center; }
.rank-cell { white-space: nowrap; }
.rank-number { display: inline-block; min-width: 20px; color: var(--muted); font-size: 12px; font-weight: 800; }
.drag-handle {
  width: 44px; min-height: 44px; margin-right: 3px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: grab; touch-action: none; font-weight: 900; letter-spacing: -2px;
}
.drag-handle:active { cursor: grabbing; }
.dragging { opacity: .58; outline: 2px dashed var(--accent); outline-offset: -2px; }
.move-menu { display: none; }
.watch-row > td:first-child { border-left: 3px solid #c79224; }
.wip-row > td:first-child { border-left: 3px solid #4676c8; }
.released-row > td:first-child { border-left: 3px solid #419667; }
.note-line {
  display: block; max-width: 100%; margin-top: 4px; padding: 0; border: 0; background: transparent;
  color: var(--muted); font-size: 12px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.note-edit { cursor: text; }
.note-edit:hover { color: var(--accent); text-decoration: underline; }
.note-line.empty { opacity: .7; }
.note-input {
  display: block; width: min(100%, 520px); margin-top: 6px; padding: 7px 9px;
  border: 1px solid var(--accent); border-radius: 9px; background: var(--paper); color: var(--ink); outline: 0;
}
.patch-line { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.patch-line a { color: var(--accent); font-weight: 700; text-underline-offset: 2px; }
.patch-badge { display: inline-flex; padding: 2px 7px; border-radius: 999px; font-weight: 900; }
.patch-badge.wip { background: #e7eefc; color: #315d9d; }
.patch-badge.released { background: #e0f2e7; color: #27734a; }
.row-actions { display: flex; align-items: center; gap: 9px; min-width: 112px; }
.star-toggle {
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1;
}
.star-toggle:hover, .star-toggle.active { border-color: #c79224; color: #a36b00; background: #fff4d7; }
.star-readonly { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; color: #a36b00; font-size: 20px; }
.compare-check-label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.compare-check { width: 18px; height: 18px; accent-color: var(--accent); }
.empty-row { padding: 32px !important; text-align: center !important; }

.compare-bar {
  position: fixed; z-index: 35; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: min(720px, calc(100% - 28px)); padding: 11px 12px 11px 16px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 14px 48px rgba(0,0,0,.16);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.compare-bar[hidden] { display: none; }
.compare-bar > div { display: flex; gap: 8px; }

.modal { width: min(720px, calc(100% - 24px)); max-height: calc(100vh - 36px); padding: 0; border: 0; background: transparent; color: var(--ink); }
.modal::backdrop { background: rgba(18, 16, 13, .55); backdrop-filter: blur(3px); }
.modal-card { margin: 0; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 22px 70px rgba(0,0,0,.28); }
.compare-modal { width: min(1180px, calc(100% - 24px)); }
.compare-card { padding-bottom: 18px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.modal-head h2 { margin: 0; }
.modal-copy { color: var(--muted); }
.token-field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.token-field input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); }
.token-help { margin-top: 14px; color: var(--muted); font-size: 13px; }
.token-help summary { cursor: pointer; color: var(--ink); font-weight: 800; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; align-items: center; }
.spacer { flex: 1; }
.compare-scroll { overflow: auto; max-height: calc(100vh - 150px); border: 1px solid var(--line); border-radius: 14px; }
.compare-table { width: max-content; min-width: 100%; border-collapse: collapse; background: var(--paper); }
.compare-table th, .compare-table td { min-width: 210px; padding: 12px 14px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; text-align: left; }
.compare-table th:first-child { position: sticky; left: 0; z-index: 2; min-width: 150px; background: #f8f4ec; }
.compare-table thead th { position: sticky; top: 0; z-index: 1; background: #f8f4ec; }
.compare-table thead th:first-child { z-index: 3; }
.compare-top { display: block; margin-top: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--accent); cursor: pointer; font-size: 11px; font-weight: 800; }
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 90px; transform: translateX(-50%);
  max-width: calc(100% - 28px); padding: 10px 14px; border-radius: 12px; background: #24221f; color: #fff; box-shadow: 0 10px 32px rgba(0,0,0,.24);
  font-size: 13px; font-weight: 700;
}

@media (max-width: 760px) {
  .top-actions { gap: 7px; }
  .candidate-table { min-width: 0; display: block; }
  .candidate-table thead { display: none; }
  .candidate-table tbody { display: grid; gap: 10px; padding: 0 12px 16px; }
  .candidate-table tbody tr:not(.group-heading) {
    display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
  }
  .candidate-table tbody tr:not(.group-heading) > td {
    display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 10px;
    width: 100%; padding: 9px 12px; border-top: 1px solid var(--line); text-align: left;
  }
  .candidate-table tbody tr:not(.group-heading) > td:first-child { border-top: 0; }
  .candidate-table tbody tr:not(.group-heading) > td::before {
    content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 800;
  }
  .candidate-table .rank-cell { width: 100%; text-align: left; align-items: center; }
  .game-link { overflow-wrap: anywhere; }
  .recommendation-game > .recommendation-rationale { grid-column: 1 / -1; margin: 0; }
  .recommendation-game > :not(.game-link):not(.recommendation-rationale) { grid-column: 2; }
  .table-wrap { overflow: visible; }
  .group-heading { display: block; }
  .group-heading th { display: block; width: 100%; border-radius: 10px; }
  .move-menu { display: flex; flex-wrap: wrap; gap: 5px; grid-column: 2; }
  .move-menu button { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: transparent; color: var(--muted); font-size: 11px; }
  .row-actions { min-width: 0; flex-wrap: wrap; }
  .compare-bar { bottom: 10px; align-items: stretch; flex-direction: column; }
  .compare-bar > div { justify-content: flex-end; }
  .modal-card { padding: 18px; border-radius: 16px; }
  .compare-table th, .compare-table td { min-width: 180px; }
  .compare-table th:first-child { min-width: 118px; }
}

@media (prefers-color-scheme: dark) {
  .group-heading th, .compare-table th:first-child, .compare-table thead th { background: #28241f; }
  .patch-badge.wip { background: #22324d; color: #a9c8ff; }
  .patch-badge.released { background: #21382d; color: #99dfb8; }
  .star-toggle:hover, .star-toggle.active { background: #3a3020; color: #efbf58; }
  .toast { background: #f0ebe2; color: #201e1b; }
}

/* Owner-only candidate deletion and restoration. */
.row-actions { flex-wrap:wrap; }
.candidate-delete { min-height:44px; padding:6px 10px; border:1px solid currentColor; border-radius:8px; color:#b42332; background:transparent; cursor:pointer; }
.candidate-delete:disabled, .candidate-restore:disabled { opacity:.5; cursor:wait; }
.deleted-modal { max-width:700px; width:calc(100% - 24px); max-height:85vh; }
.deleted-game { display:flex; gap:12px; align-items:center; justify-content:space-between; padding:14px 0; border-bottom:1px solid var(--line, #d7dce5); }
.deleted-game > div { min-width:0; overflow-wrap:anywhere; }
.deleted-game span { display:block; margin-top:4px; font-size:.85rem; }
.candidate-restore { flex-shrink:0; min-height:44px; }
.deletion-sync-notice { padding:12px; margin:12px 0; border:1px solid #a66a00; border-radius:10px; }
.deletion-sync-notice button { margin:6px; }
@media (prefers-color-scheme:dark) { .candidate-delete { color:#ffabb3; } }
