:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #16181d;
  --muted: #646b78;
  --border: #dde1e8;
  --accent: #3b6ef5;
  --gold: #c99a1e;
  --done: #1f9d61;
  --heat-0: #e7eaf0;
  --heat-1: #c6d5fb;
  --heat-2: #8eaaf6;
  --heat-3: #5a82f0;
  --heat-4: #2c55d6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #20242d;
    --text: #e8eaef;
    --muted: #9198a6;
    --border: #2a2f3a;
    --accent: #7c9cff;
    --gold: #e6b93e;
    --done: #3ccf8e;
    --heat-0: #20242d;
    --heat-1: #24366b;
    --heat-2: #3051a8;
    --heat-3: #4d74e0;
    --heat-4: #8eaaff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #20242d; --text: #e8eaef; --muted: #9198a6;
  --border: #2a2f3a; --accent: #7c9cff; --gold: #e6b93e; --done: #3ccf8e;
  --heat-0: #20242d; --heat-1: #24366b; --heat-2: #3051a8; --heat-3: #4d74e0; --heat-4: #8eaaff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
.muted { color: var(--muted); }

.topbar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  max-width: 1200px; margin: 0 auto; padding: 20px 16px 8px;
}
.brand { font-weight: 700; font-size: 20px; }
.updated { color: var(--muted); font-size: 13px; }
main { max-width: 1200px; margin: 0 auto; padding: 8px 16px 64px; }

h2 { font-size: 17px; margin: 32px 0 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin-bottom: 12px; }

/* 상단 요약 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--muted); font-size: 12px; }

.warn {
  margin-top: 16px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--gold); background: var(--surface); font-size: 14px;
}

/* 잔디 */
.heatmap-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; overflow-x: auto; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; width: max-content; }
.heatmap span { width: 11px; height: 11px; border-radius: 2px; background: var(--heat-0); }
.heatmap .l1 { background: var(--heat-1); }
.heatmap .l2 { background: var(--heat-2); }
.heatmap .l3 { background: var(--heat-3); }
.heatmap .l4 { background: var(--heat-4); }
.heat-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 8px; color: var(--muted); font-size: 12px; }
.heat-legend span { width: 11px; height: 11px; border-radius: 2px; }

/* 해금 리스트 */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; }
.row img, .row .noicon { width: 40px; height: 40px; border-radius: 6px; flex: none; background: var(--surface-2); object-fit: cover; }
.row .body { min-width: 0; flex: 1; }
.row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .side { text-align: right; font-size: 13px; color: var(--muted); flex: none; }
.rare { color: var(--gold); font-weight: 600; }

/* 게임 목록 */
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
.controls input, .controls select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
}
.controls input { width: 180px; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: border-color .15s; }
.card:hover { border-color: var(--accent); }
.card img { width: 100%; aspect-ratio: 460 / 215; object-fit: cover; background: var(--surface-2); }
.card .info { padding: 10px 12px 12px; }
.card .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .stat { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 2px; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.full > i { background: var(--done); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* 게임 상세 */
.back { display: inline-block; margin: 8px 0 12px; color: var(--muted); }
.game-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.game-head img { width: 320px; max-width: 100%; border-radius: 12px; }
.game-head h1 { margin: 0 0 4px; font-size: 24px; }
.game-head .bar { height: 8px; max-width: 360px; }
.ach { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); }
.ach:first-child { border-top: 0; }
.ach img, .ach .noicon { width: 48px; height: 48px; border-radius: 6px; flex: none; background: var(--surface-2); }
.ach.locked .title { color: var(--muted); }
.ach .body { flex: 1; min-width: 0; }
.ach .title { font-weight: 600; }
.ach .desc { color: var(--muted); font-size: 13px; }
.ach .side { text-align: right; font-size: 13px; color: var(--muted); flex: none; }
.ach .when { color: var(--done); }
