/* One dark theme, built for dim rehearsal rooms and stages.
   Layout: a single column, phone first. */
:root {
  color-scheme: dark;
  --bg: #101522;
  --panel: #19203a;
  --well: #0c101b;
  --line: #2b3558;
  --text: #eef0f7;
  --dim: #98a1c0;
  --accent: #ffb347;
  --accent-ink: #2a1a00;
  --good: #6fd6a8;
  --warn: #ff8f7a;
  --num: ui-monospace, 'SF Mono', Menlo, Consolas, 'Roboto Mono', monospace;
  --body:
    system-ui, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR',
    'Malgun Gothic', 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}

p {
  margin: 0;
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  min-height: 44px;
  padding: 0 14px;
}

button:disabled,
input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
  margin: 12px 0 4px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.small {
  font-size: 13px;
  color: var(--dim);
}

.warn {
  color: var(--warn);
  border-color: var(--warn);
  font-size: 14px;
}

/* Ad slot: only rendered by the server when AdSense is configured. */
.ad {
  min-height: 90px;
}

/* Header */
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.pills {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--dim);
}

.pill.ok {
  color: var(--good);
  border-color: var(--good);
}

.pill.bad {
  color: var(--warn);
  border-color: var(--warn);
}

.pill.lead {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

#lang {
  min-height: 28px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

/* Start screen */
.home,
#room {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.big {
  width: 100%;
  min-height: 60px;
  font-size: 20px;
  font-weight: 600;
  margin-top: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.pinrow {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.pinrow input {
  flex: 1;
  min-width: 0;
  min-height: 60px;
  font-family: var(--num);
  font-size: 28px;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--text);
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.pinrow button {
  min-height: 60px;
  min-width: 84px;
  font-size: 18px;
  font-weight: 600;
}

#homeMsg {
  min-height: 20px;
  margin-top: 8px;
}

#homeMsg.error {
  color: var(--warn);
}

.links {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.links a {
  color: var(--dim);
}

/* Beat display */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 14px;
}

.lamp {
  width: 150px;
  height: 150px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  background: var(--well);
  -webkit-tap-highlight-color: transparent;
}

.lamp b {
  font-family: var(--num);
  font-size: 64px;
  font-weight: 700;
  color: var(--dim);
}

.lamp b.word {
  font-size: 30px;
}

.lamp b.lit {
  color: var(--accent-ink);
}

#lampHint {
  min-height: 20px;
  margin-top: -6px;
  text-align: center;
}

.dots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.dots i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--line);
}

.dots i.g {
  outline: 2px solid var(--line);
  outline-offset: 2px;
}

.dots i.on {
  background: var(--accent);
}

/* Tempo and meter */
.tempo {
  display: grid;
  grid-template-columns: repeat(2, auto) 1fr repeat(2, auto);
  gap: 8px;
  align-items: center;
}

.tempo button {
  padding: 0 10px;
  font-family: var(--num);
}

.bpm {
  text-align: center;
  font-family: var(--num);
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.bpm small {
  display: block;
  font-family: var(--body);
  font-weight: 400;
  font-size: 12px;
  color: var(--dim);
  margin-top: 4px;
}

#tap {
  width: 100%;
  margin-top: 6px;
}

.sig {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.sig button {
  min-width: 48px;
}

.sig button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}

.note {
  margin-top: 8px;
}

/* Transport */
.play {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#toggle {
  min-height: 60px;
  font-size: 20px;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

#toggle.stop {
  background: transparent;
  color: var(--warn);
  border-color: var(--warn);
}

#sound {
  min-height: 60px;
  font-size: 18px;
  font-weight: 600;
  border-color: var(--accent);
  color: var(--accent);
}

/* Sync status */
.syncline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.syncline .pill {
  font-size: 14px;
  padding: 5px 12px;
}

.syncline b {
  font-family: var(--num);
  color: var(--text);
}

.fold {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.fold summary {
  font-size: 13px;
  color: var(--dim);
  cursor: pointer;
  min-height: 32px;
}

.fold label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--dim);
  margin-top: 8px;
}

.fold output {
  font-family: var(--num);
  color: var(--text);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 8px 0 0;
}

.stats dt {
  font-size: 12px;
  color: var(--dim);
}

.stats dd {
  margin: 0;
  font-family: var(--num);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

/* QR and PIN */
.qr {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

#qr {
  width: 136px;
  height: 136px;
  flex: none;
  border-radius: 8px;
  background: #fff;
}

.pin {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.pin b {
  font-family: var(--num);
  font-size: 26px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

#copyLink {
  margin-top: 10px;
  font-size: 14px;
}

#leave {
  color: var(--dim);
}

/* Text pages (about, privacy, 404) */
.doc {
  max-width: 680px;
}

.doc h1 {
  font-size: 24px;
  margin-bottom: 4px;
}

.doc h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 8px;
}

.doc h3 {
  font-size: 15px;
  margin: 18px 0 6px;
}

.doc p,
.doc li {
  color: #d6daea;
  max-width: 65ch;
}

.doc p + p {
  margin-top: 10px;
}

.doc ul,
.doc ol {
  padding-left: 20px;
  margin: 8px 0;
}

.doc hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 32px 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
