:root {
  --page: #f7f6f2;
  --panel: #ffffff;
  --line: #e3e1d7;
  --ink: #2c2c28;
  --muted: #86847a;
  --a: #e0507f;
  --b: #3c6f84;
  --gold: #e6b23c;
  --hot: #e0704a;
  --radius: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--b); }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 20px 40px;
}

header.top {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
header.top h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.01em;
}
header.top .tag { color: var(--muted); font-size: 13px; }
header.top nav { margin-left: auto; display: flex; gap: 12px; font-size: 13px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.stage {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stage canvas { display: block; width: 100%; aspect-ratio: 1 / 1; }

.scorebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.scorebar .side { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.a { background: var(--a); }
.dot.b { background: var(--b); }
.scorebar .score { font-size: 18px; font-weight: 700; }
.scorebar .clock { margin-left: auto; color: var(--muted); }

.timer { height: 3px; background: var(--line); }
.timer > i { display: block; height: 100%; background: var(--gold); width: 100%; }

.overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(247, 246, 242, 0.88);
  text-align: center;
  padding: 24px;
}
.overlay[hidden] { display: none; }
.overlay h2 { margin: 0 0 6px; font-size: 26px; }
.overlay p { margin: 0 0 16px; color: var(--muted); max-width: 380px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.panel h3 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

label.field { display: block; margin-bottom: 10px; font-size: 13px; }
label.field > span { display: block; color: var(--muted); margin-bottom: 4px; }

select, input[type=file], button {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  width: 100%;
}
select, button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--gold); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
button.primary:hover { background: #000; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.toggle {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; user-select: none;
}
.toggle.on { border-color: var(--a); background: #fdf1f5; }
.toggle input { margin: 0; }

.keys { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.keys div { display: flex; gap: 8px; }
kbd {
  background: #f1f0ea; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 5px; font: 600 11px ui-monospace, monospace; color: var(--ink);
}
.keys kbd { padding: 0 6px; min-width: 20px; text-align: center; }
.keys span { flex: 1; }

table.stats { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.stats th, table.stats td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.stats th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.stats td.n { text-align: right; }

.bars { display: grid; gap: 2px; font: 11px ui-monospace, monospace; }
.bars .bar { display: grid; grid-template-columns: 108px 1fr 42px; align-items: center; gap: 6px; }
.bars .track { position: relative; height: 9px; background: #f1f0ea; border-radius: 3px; }
.bars .track i { position: absolute; top: 0; height: 100%; border-radius: 3px; background: var(--b); }
.bars .track.a i { background: var(--a); }
.bars .val { text-align: right; color: var(--muted); }
.bars .name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #f1f0ea; font-size: 11px; color: var(--muted); }
.pill.live { background: #fdf1f5; color: var(--a); }
