/* Layout: one centered column; a sticky top bar holds the game switch, each game page opens with a player picker. */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --fg: #16191f;
  --muted: #5d6572;
  --line: #dde1e7;
  --grid: #eceef2;
  --lol: #2f5bd3;
  --pubg: #c96a1b;
  --good: #11865f;
  --bad: #c43d3d;
  --s1: #2f6fdb; --s2: #e0702e; --s3: #12a37f; --s4: #d9a106; --s5: #d4508c;
  --font-display: 'Black Han Sans', 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-body: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --font-num: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --radius: 10px;
  --accent: var(--lol);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111318; --panel: #191c23; --fg: #e8eaee; --muted: #9aa3b1; --line: #2b303a; --grid: #222630;
    --lol: #7397f5; --pubg: #f0a15c; --good: #4cc79a; --bad: #f07b7b;
    --s1: #6b9cf0; --s2: #f08f55; --s3: #3cc79f; --s4: #f0c03c; --s5: #ec7fb1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111318; --panel: #191c23; --fg: #e8eaee; --muted: #9aa3b1; --line: #2b303a; --grid: #222630;
  --lol: #7397f5; --pubg: #f0a15c; --good: #4cc79a; --bad: #f07b7b;
  --s1: #6b9cf0; --s2: #f08f55; --s3: #3cc79f; --s4: #f0c03c; --s5: #ec7fb1;
  color-scheme: dark;
}
body[data-game="pubg"] { --accent: var(--pubg); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); font-size: 13px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 5vw, 40px); line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: 19px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; max-width: 68ch; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--panel); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-size: 20px; text-decoration: none; letter-spacing: 0.01em; }
.gamenav { display: flex; gap: 4px; flex-wrap: wrap; }
.gamenav a { text-decoration: none; font-size: 14px; padding: 6px 12px; border-radius: 999px; color: var(--muted); }
.gamenav a[aria-current="page"] { color: var(--fg); background: var(--bg); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 6px 6px 0 0; }

main { display: flex; flex-direction: column; gap: 36px; padding-block: 28px 40px; min-height: 60vh; }
.foot { padding-block: 0 32px; display: flex; flex-direction: column; gap: 4px; }

/* home */
.home-lede { display: flex; flex-direction: column; gap: 10px; }
.hero-img { display: block; width: 100%; max-width: 760px; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #000; margin-bottom: 8px; }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.game-tile { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; overflow: hidden; }
.game-tile::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--tile); }
.game-tile:hover { border-color: var(--tile); }
.game-tile .kicker { font-size: 12px; letter-spacing: 0.08em; color: var(--muted); }
.game-tile .name { font-family: var(--font-display); font-size: 28px; line-height: 1.1; }
.game-tile .facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.game-tile .facts b { display: block; font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; color: var(--fg); }
.game-tile .go { font-size: 14px; color: var(--tile); font-weight: 600; }
.roster { display: flex; flex-wrap: wrap; gap: 6px; }
.roster span { font-size: 12px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }

/* game page header + picker */
.ghead { display: flex; flex-direction: column; gap: 10px; }
.ghead .kicker { font-size: 12px; letter-spacing: 0.08em; color: var(--accent); font-weight: 600; }
.picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.picker a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-size: 14px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.picker a[aria-current="page"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }

section { display: flex; flex-direction: column; gap: 14px; }
.sec-head { display: flex; flex-direction: column; gap: 4px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }

/* report-card hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 16px; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } }
.hero-id { display: flex; flex-direction: column; gap: 8px; }
.hero-id .who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; }
.hero-id .big { font-family: var(--font-display); font-size: clamp(34px, 6vw, 46px); line-height: 1.05; }
.chip { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .val { font-family: var(--font-num); font-size: 22px; font-weight: 500; line-height: 1.2; }
.kpi .sub { font-size: 12px; color: var(--muted); }

/* report rows: metric, value, bar vs group, rank */
.report { display: flex; flex-direction: column; }
.rrow { display: grid; grid-template-columns: minmax(7em, 1.2fr) 5.5em minmax(60px, 2fr) 5.2em 6.5em; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.rrow:last-child { border-bottom: 0; }
.rrow .m small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.rrow .v { font-family: var(--font-num); text-align: right; font-weight: 500; }
.rrow .rank { font-size: 12px; text-align: center; padding: 2px 0; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.rrow .rank.top { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.rrow .d { font-family: var(--font-num); font-size: 12px; text-align: right; }
.track { position: relative; height: 10px; background: var(--grid); border-radius: 3px; }
.track .fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
.track .avg { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 1.5px dashed var(--muted); }
@media (max-width: 600px) {
  .rrow { grid-template-columns: minmax(0, 1fr) 5em 5em; }
  .rrow .track { grid-column: 1 / -1; order: 5; }
  .rrow .d { display: none; }
}
.good { color: var(--good); }
.bad { color: var(--bad); }

/* comparison grid of bar lists */
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.cmp .card { display: flex; flex-direction: column; gap: 8px; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(4.5em, 7.5em) minmax(0, 1fr) 4.4em; align-items: center; gap: 8px; font-size: 13px; }
.bar .n { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .v { font-family: var(--font-num); text-align: right; }
.bar .track { height: 12px; }

.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* tables */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
td { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 500; background: var(--panel); }
th.l, td.l { text-align: left; font-family: var(--font-body); }
tr:last-child td { border-bottom: 0; }
td.best { font-weight: 600; color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
select { font: inherit; font-size: 13px; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }

/* charts */
.chart { position: relative; min-height: 240px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-body); font-size: 11px; fill: var(--muted); }
.chart .gl { stroke: var(--grid); }
.chart .ax { stroke: var(--line); }
.chart .ref { stroke: var(--muted); stroke-dasharray: 4 3; opacity: 0.7; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14); border-radius: 8px; padding: 7px 10px; font-size: 12px; line-height: 1.5; max-width: 260px; }
.tip span { display: block; color: var(--muted); }

.stack { display: flex; height: 26px; border-radius: 5px; overflow: hidden; background: var(--grid); }
.stack div { display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; white-space: nowrap; overflow: hidden; border-right: 1px solid var(--panel); }
.posline { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; gap: 6px; align-items: baseline; font-size: 12px; border-radius: 6px; padding: 3px 8px; border: 1px solid var(--line); background: var(--panel); }
.pill b { font-weight: 600; }
.pill.w b { color: var(--good); }
.pill.l b { color: var(--bad); }

.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.duo .card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; }
.duo .big { font-family: var(--font-display); font-size: 30px; line-height: 1.1; }
.pros { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.pro { display: flex; flex-direction: column; gap: 6px; border-top: 3px solid var(--pc); }
.pro-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pro-top .who { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.pro-score { font-size: 20px; font-weight: 500; color: var(--accent); }
.pro-name { font-family: var(--font-display); font-size: 32px; line-height: 1.1; }
.pro.big .pro-name { font-size: 40px; }
.pro-name small { display: block; margin-top: 2px; font-family: var(--font-body); font-size: 13px; color: var(--muted); }
.pro-why { display: flex; flex-wrap: wrap; gap: 6px; }
.pro-why span { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.pro-alt { border-top: 1px dashed var(--line); padding-top: 6px; }
.hl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

details { border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details ul { margin: 8px 0 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); max-width: 72ch; }

@media (prefers-reduced-motion: no-preference) {
  .track .fill { transition: width 0.5s cubic-bezier(.2, .7, .2, 1); }
}
