:root {
  --bg: #f4f5f7; --card: #ffffff; --ink: #16181d; --muted: #6b7280; --line: #e5e7eb; --soft: #f1f2f4;
  --accent: #2f6fde; --warn: #d64545; --ok: #2e9e6a;
  --s-crazygames: #7b5cff; --s-itch: #fa5c5c; --s-wavedash: #1fa3b5; --s-opengame: #e0a21b; --s-site: #3b82f6; --s-other: #9ca3af; --s-unknown: #c4c8cf;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --card: #171a20; --ink: #e8eaee; --muted: #9aa1ad; --line: #262a33; --soft: #1e222a;
    --accent: #6c9cff; --warn: #ff6b6b; --ok: #4cc38a; --s-other: #6b7280; --s-unknown: #4b5160;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --card: #171a20; --ink: #e8eaee; --muted: #9aa1ad; --line: #262a33; --soft: #1e222a;
  --accent: #6c9cff; --warn: #ff6b6b; --ok: #4cc38a; --s-other: #6b7280; --s-unknown: #4b5160;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 14px/1.5 system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; -webkit-font-smoothing: antialiased; }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0 0 2px; font-weight: 650; }
.muted { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 6px 12px; }
button:hover { border-color: var(--muted); }
button.ghost { border-color: transparent; color: var(--muted); }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 2; display: flex; gap: 16px; align-items: center; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 750; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.mark { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.range { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.range button { padding: 4px 10px; font-size: 13px; }
.range button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

main { max-width: 1180px; margin: 0 auto; padding: 20px 24px 64px; }
.center { min-height: 80vh; display: grid; place-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.narrow { width: min(100%, 400px); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two > .card { margin-bottom: 16px; }
form { display: grid; gap: 8px; margin-top: 12px; }
label { font-size: 13px; color: var(--muted); }
input { font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); }
form button, #confirm button { background: var(--ink); color: var(--bg); border-color: var(--ink); padding: 9px 12px; width: 100%; }
#confirm { margin-top: 12px; }
.note { min-height: 20px; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.note.bad { color: var(--warn); }
.updated { margin: 0 0 12px; }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.kpi b { display: block; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi small { color: var(--muted); font-size: 12px; margin-left: 4px; font-weight: 500; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: 12px; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.wrap { overflow-x: auto; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }

.row { display: grid; grid-template-columns: 150px 1fr 110px; gap: 12px; align-items: center; padding: 5px 0; }
.row .label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .value { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.row .value em { font-style: normal; color: var(--muted); margin-left: 6px; }
.track { position: relative; height: 18px; background: var(--soft); border-radius: 5px; overflow: hidden; }
.fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 5px; }
.fill.done { background: var(--ok); }
.fill.started { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.row.stuck .label { color: var(--warn); font-weight: 650; }
.row.stuck .fill.started { background: color-mix(in srgb, var(--warn) 35%, transparent); }
.drop { color: var(--warn); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.filters button { font-size: 12px; padding: 3px 10px; }
.filters button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.daily { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-top: 8px; overflow-x: auto; }
.day { flex: 1 0 22px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.day .seg { width: 100%; }
.day .seg:first-child { border-radius: 4px 4px 0 0; }
.day .cap { font-size: 10px; color: var(--muted); text-align: center; margin-top: 4px; white-space: nowrap; }
.day .total { font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; margin-bottom: 2px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
code { font-size: 12px; background: var(--soft); padding: 1px 5px; border-radius: 4px; }
.msg { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-word; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 560px) {
  .bar { padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
  .range { margin-left: 0; order: 3; width: 100%; }
  main { padding: 16px 16px 48px; }
  .row { grid-template-columns: 100px 1fr 84px; gap: 8px; }
  .kpi b { font-size: 22px; }
}
#inflow td:first-child, #playtimeStores td:first-child { white-space: nowrap; }
