:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #eef0f7;
  --border: #dde0ec;
  --text: #1b1e2e;
  --muted: #666d8a;
  --accent: #3b5bdb;
  --accent-text: #ffffff;
  --rating: #0b7285;
  --notice-bg: #fff4e0;
  --notice-border: #f5c26b;
  --bas: #2f9e44; --adv: #e8590c; --exp: #d6336c; --mas: #7048e8; --ult: #1b1e2e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220;
    --surface: #171a2b;
    --surface-2: #1f2338;
    --border: #2c3150;
    --text: #e8eaf2;
    --muted: #9aa1c0;
    --accent: #4c6ef5;
    --rating: #3bc9db;
    --notice-bg: #2b2414;
    --notice-border: #7a5a1c;
    --ult: #e8eaf2;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Hiragino Sans", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}
a { color: var(--accent); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
nav a { margin-left: 16px; color: var(--muted); text-decoration: none; }
nav a.active { color: var(--text); font-weight: 600; }

main { max-width: 860px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.loading, .empty { color: var(--muted); }
.error { color: #e03131; }

.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); text-decoration: none; font: inherit; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--accent); }
button.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font: inherit; cursor: pointer; }

.hero, .card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.hero { text-align: center; padding: 48px 24px; }
.hero h1, .card h1 { margin-top: 0; font-size: 22px; }
.card h2 { font-size: 16px; margin-top: 24px; }
.steps li { margin-bottom: 6px; }
.notice {
  background: var(--notice-bg); border: 1px solid var(--notice-border); border-radius: 10px;
  padding: 12px 14px; margin: 16px 0; font-size: 14px;
}

.summary {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px;
}
.label { font-size: 11px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.player-name { font-size: 24px; font-weight: 700; }
.ratings { display: flex; gap: 20px; }
.rating-box { text-align: right; }
.rating-num { font-size: 34px; font-weight: 800; color: var(--rating); font-variant-numeric: tabular-nums; line-height: 1.1; }
.rating-num.sub { font-size: 24px; color: var(--text); }

.frame { margin-top: 20px; }
.frame-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.frame-head h2 { margin: 0; font-size: 18px; }
.count { color: var(--muted); font-size: 13px; font-weight: 400; }
.avg { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.recs { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rec {
  display: grid; grid-template-columns: 26px 44px 1fr auto 62px; gap: 10px; align-items: center;
  padding: 8px 12px; border-top: 1px solid var(--border);
}
.rec:first-child { border-top: 0; }
.rec-no { color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.rec-jacket { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.rec-main { min-width: 0; }
.rec-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { display: flex; gap: 6px; align-items: center; font-size: 12px; margin-top: 2px; }
.diff { color: #fff; padding: 0 6px; border-radius: 4px; font-weight: 700; font-size: 11px; }
.diff-basic { background: var(--bas); } .diff-advanced { background: var(--adv); } .diff-expert { background: var(--exp); }
.diff-master { background: var(--mas); }
.diff-ultima { background: linear-gradient(90deg, #1b1e2e 50%, #c92a2a); }
.const { color: var(--muted); font-variant-numeric: tabular-nums; }
.lamp { font-weight: 700; color: #f08c00; }
.rec-score { text-align: right; font-variant-numeric: tabular-nums; }
.score { font-weight: 600; }
.rank { font-size: 12px; color: var(--muted); }
.rec-rating { text-align: right; font-weight: 800; color: var(--rating); font-variant-numeric: tabular-nums; }

.foot { margin-top: 24px; text-align: center; }

.image-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.rating-image { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 20;
}

@media (max-width: 520px) {
  .rec { grid-template-columns: 20px 40px 1fr 56px; gap: 8px; }
  .rec-jacket { width: 40px; height: 40px; }
  .rec-score { grid-column: 3; grid-row: 2; text-align: left; display: flex; gap: 8px; align-items: baseline; }
  .rec-rating { grid-row: 1 / span 2; grid-column: 4; }
  .rec-no, .rec-jacket { grid-row: 1 / span 2; }
  .ratings { width: 100%; justify-content: space-between; }
  .rating-box { text-align: left; }
}
