/* Tokens: warm-tinted neutrals do the work; one accent, kept for the primary action and the room. */
:root {
  --bg: #f3f1ed;
  --surface: #ffffff;
  --sunken: #f1efea;
  --sunken-hover: #e7e4de;
  --text: #1b1a1e;
  --text-2: #55525b;
  --text-3: #6a6771;
  --border: #e4e1db;
  --control-border: #8d8993;
  --strong: #1b1a1e;
  --on-strong: #ffffff;
  --accent: #c8401a;
  --accent-hover: #a93415;
  --on-accent: #ffffff;
  --accent-tint: #fbe9e2;
  --accent-tint-text: #8a2b10;
  --track: #2f5fd0;
  --ok: #16834a;
  --danger: #c42b2b;
  --seg-track: #e7e4de;
  --raised: #ffffff;
  --soft: #e5e2dc;
  --soft-hover: #d9d5ce;

  --shadow-1: 0 1px 2px rgb(27 26 30 / .06);
  --shadow-2: 0 1px 2px rgb(27 26 30 / .05), 0 8px 24px rgb(27 26 30 / .06);
  --shadow-3: 0 2px 4px rgb(27 26 30 / .08), 0 16px 40px rgb(27 26 30 / .12);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111014;
    --surface: #1e1d23;
    --sunken: #2b2a32;
    --sunken-hover: #383640;
    --text: #eeece7;
    --text-2: #b7b3be;
    --text-3: #9a96a2;
    --border: #2f2d36;
    --control-border: #7c7885;
    --strong: #eeece7;
    --on-strong: #1b1a1e;
    --accent: #ff8a5c;
    --accent-hover: #ffa27d;
    --on-accent: #2a1108;
    --accent-tint: #3a2119;
    --accent-tint-text: #ffb89c;
    --track: #7fa8ff;
    --ok: #4fd08d;
    --danger: #ff7676;
    --seg-track: #2b2a32;
    --raised: #4a4853;
    --soft: #2b2a32;
    --soft-hover: #383640;
    --shadow-1: none;
    --shadow-2: none;
    --shadow-3: 0 16px 40px rgb(0 0 0 / .5);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, p, ul { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { width: 20px; height: 20px; flex: none; }

.brand { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; font-weight: 600; letter-spacing: -.03em; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.hint { font-size: 13px; color: var(--text-3); max-width: 62ch; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }

/* Buttons */
.btn {
  height: 40px; padding: 0 20px; border: 0; border-radius: 999px; font-weight: 500;
  transition: background-color .15s, transform .1s;
}
.btn:active, .round:active { transform: scale(.97); }
.btn.primary, .round.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover, .round.primary:hover { background: var(--accent-hover); }
.btn.primary { height: 48px; padding: 0 28px; font-weight: 600; }
.btn.soft, .round.soft { background: var(--soft); }
.btn.soft:hover, .round.soft:hover { background: var(--soft-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.round { display: inline-grid; place-items: center; border: 0; border-radius: 50%; width: 40px; height: 40px; transition: background-color .15s, transform .1s; }
.round.primary { width: 52px; height: 52px; }
.round.primary .icon { width: 24px; height: 24px; }
[data-state="playing"] .when-paused, [data-state="paused"] .when-playing { display: none; }

/* Setup */
.setup { max-width: 640px; margin: 0 auto; padding: 48px 24px 72px; display: grid; gap: 40px; }
.setup-head { display: grid; gap: 8px; }
.setup-head h1 { font-size: 32px; line-height: 1.15; font-weight: 600; letter-spacing: -.025em; margin-top: 20px; }
.lede { color: var(--text-2); font-size: 16px; max-width: 52ch; }
.field { display: grid; gap: 12px; }
.field h2 { font-size: 15px; font-weight: 600; }
.optional { font-weight: 400; color: var(--text-3); font-size: 13px; margin-left: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px;
  border: 0; border-radius: 999px; background: var(--surface); color: var(--text-2);
  box-shadow: var(--shadow-1); transition: background-color .15s, color .15s, transform .1s;
}
.chip:hover { color: var(--text); background: var(--sunken-hover); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] { background: var(--strong); color: var(--on-strong); font-weight: 500; }
.chip.artist { padding: 0 8px 0 4px; background: var(--strong); color: var(--on-strong); font-weight: 500; cursor: default; }
.chip.artist button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .7; }
.chip.artist button:hover { opacity: 1; }
.chip.artist .icon { width: 14px; height: 14px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--sunken-hover); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-2); flex: none; }

.input {
  width: 100%; height: 44px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--control-border); background: var(--surface);
}
.input::placeholder { color: var(--text-3); }
.input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.input.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.inline-form { display: flex; gap: 8px; max-width: 400px; }
.inline-form .btn { height: 44px; display: inline-flex; align-items: center; gap: 4px; padding: 0 16px 0 12px; flex: none; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.key-field { display: grid; gap: 8px; max-width: 400px; margin-top: 4px; }
.error { font-size: 13px; color: var(--danger); font-weight: 500; }
.sub { font-size: 12px; color: var(--text-3); margin-left: 4px; font-weight: 400; }
.hint a { color: var(--accent); }
.hint.strong { color: var(--text-2); font-weight: 500; }

.segmented { display: inline-flex; flex-wrap: wrap; padding: 4px; gap: 4px; border-radius: var(--r-md); background: var(--seg-track); width: fit-content; }
.segmented button { height: 36px; padding: 0 16px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); transition: background-color .15s; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] { background: var(--raised); color: var(--text); font-weight: 500; box-shadow: var(--shadow-1); }
.setup-foot { display: grid; gap: 16px; justify-items: start; }

/* Booth */
.booth { max-width: 1040px; margin: 0 auto; padding: 20px 24px 40px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.bar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; font-size: 13px; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.pill.live { color: var(--text); }
.pill.live .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }

.grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-2); }

.now { display: grid; gap: 24px; }
.now-top { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; }
.art { flex: 0 0 168px; aspect-ratio: 1; border-radius: var(--r-md); background: var(--sunken) center / cover no-repeat; box-shadow: var(--shadow-2); }
.art-empty { display: grid; place-items: center; font-size: 48px; color: var(--text-3); }
.art.has-art { color: transparent; }
.now-body { flex: 1 1 220px; display: grid; gap: 4px; min-width: 0; }
.why { font-size: 13px; color: var(--text-3); }
.now-body h2 { font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -.025em; overflow-wrap: anywhere; margin-top: 4px; }
.artist { color: var(--text-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; min-height: 24px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--sunken); font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--text-2); }
.tag.fav { background: var(--accent-tint); color: var(--accent-tint-text); }
.tag .icon { width: 12px; height: 12px; }

.scrub { display: grid; gap: 6px; }
.progress { height: 4px; border-radius: 2px; background: var(--sunken-hover); overflow: hidden; }
#progressFill { height: 100%; width: 100%; background: var(--text); transform: scaleX(0); transform-origin: left; transition: transform .5s linear; }
.times { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.link { font-size: 13px; color: var(--text-3); text-decoration: none; margin-left: 4px; }
.link:hover { color: var(--text); text-decoration: underline; }
.vol { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); margin-left: auto; }
.vol input { width: 112px; }
input[type="range"] { accent-color: var(--accent); margin: 0; }

.room { display: grid; gap: 16px; }
.room-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.room-word { font-size: 20px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; margin-top: 4px; }
.preview { width: 120px; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--r-sm); transform: scaleX(-1); background: var(--sunken); flex: none; }

.map {
  position: relative; width: 100%; aspect-ratio: 1.6; border-radius: var(--r-md);
  background:
    linear-gradient(var(--sunken-hover), var(--sunken-hover)) center / 100% 1px no-repeat,
    linear-gradient(var(--sunken-hover), var(--sunken-hover)) center / 1px 100% no-repeat,
    var(--sunken);
}
.axis { position: absolute; font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--text-3); background: var(--sunken); padding: 0 4px; }
.axis.top { top: 8px; left: 50%; transform: translateX(-50%); }
.axis.bottom { bottom: 8px; left: 50%; transform: translateX(-50%); }
.axis.left { left: 8px; top: 50%; transform: translateY(-50%); }
.axis.right { right: 8px; top: 50%; transform: translateY(-50%); }
.mark { display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: none; }
.map .mark { position: absolute; transform: translate(-50%, -50%); transition: left .6s ease, top .6s ease; }
.mark.roomdot { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.mark.target { border: 2px dashed var(--accent); width: 30px; height: 30px; }
.mark.track { background: var(--track); border-radius: 4px; }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend .mark { width: 12px; height: 12px; box-shadow: none; }

.ytwrap { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 200px; border-radius: var(--r-md); overflow: hidden; background: #000; }
.ytwrap iframe, .ytwrap #ytPlayer { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.now.video .art { display: none; }

.signals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 420px) { .signals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.signals > div { display: grid; gap: 2px; padding: 12px; border-radius: var(--r-md); background: var(--sunken); }
.signals b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

.select-wrap { display: grid; gap: 6px; }
.select { position: relative; }
.select select {
  appearance: none; width: 100%; height: 40px; padding: 0 40px 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--control-border); background: var(--surface); color: var(--text); font: inherit;
  text-overflow: ellipsis;
}
.select .icon { position: absolute; right: 10px; top: 10px; pointer-events: none; color: var(--text-3); }

.manual { display: grid; gap: 16px; padding: 16px; border-radius: var(--r-md); background: var(--sunken); }
.manual label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.manual .ends { display: flex; justify-content: space-between; font-weight: 400; color: var(--text-3); font-size: 12px; }
.manual em { font-style: normal; }
.manual input { width: 100%; }

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