:root {
  --bg: #0e1013;
  --card: #171a1f;
  --line: #262a31;
  --text: #e8eaee;
  --dim: #9097a3;
  --accent: #7c9cff;
  --accent-ink: #0b1020;
  --warn: #ffb35c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  transition: background .12s;
}
body.flash { background: #2c3a66; transition: none; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 40px;
}

.logo { font-weight: 700; letter-spacing: .02em; }
h1.logo { font-size: 44px; margin: 48px 0 8px; }
.lead { color: var(--dim); margin: 0 0 28px; }
h2 { font-size: 15px; margin: 0; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

button, select, input {
  font: inherit;
  color: inherit;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #20242b;
  padding: 10px 16px;
}
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button.big {
  display: block;
  width: 100%;
  padding: 18px;
  font-size: 20px;
  font-weight: 650;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
}
button.small { padding: 6px 12px; font-size: 14px; }

#join-form { display: flex; gap: 8px; margin-top: 16px; }
#join-code { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .3em; font-size: 20px; text-align: center; }

header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
header .room { color: var(--dim); margin-left: auto; }
header .room b { color: var(--text); letter-spacing: .12em; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin: 0 0 12px;
}
.hint { color: var(--dim); font-size: 14px; margin: 10px 0 0; }
.warn { color: var(--warn); margin: 0 0 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

#invite { text-align: center; }
#invite img { background: #fff; border-radius: 12px; max-width: 100%; height: auto; }
#invite p { margin: 10px 0 0; word-break: break-all; color: var(--dim); }

#listening {
  background: #3b2b10;
  color: var(--warn);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 12px;
  font-weight: 600;
  text-align: center;
}
#resume { margin-bottom: 12px; }

#track { width: 100%; margin-bottom: 4px; }
.transport { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
#play.on { background: #2b3350; color: var(--text); }
.pos { display: flex; align-items: center; gap: 12px; }
#bar { flex: 1; height: 28px; display: flex; align-items: center; cursor: pointer; position: relative; }
#bar::before { content: ""; position: absolute; left: 0; right: 0; height: 6px; border-radius: 3px; background: var(--line); }
#fill { position: relative; height: 6px; border-radius: 3px; background: var(--accent); width: 0; }
#time { font-variant-numeric: tabular-nums; color: var(--dim); font-size: 14px; white-space: nowrap; }

#notes { margin: 8px 0 0; padding-left: 18px; color: var(--warn); font-size: 14px; }
#notes:empty { display: none; }

.badge { background: var(--line); color: var(--text); border-radius: 10px; padding: 1px 8px; font-size: 13px; margin-left: 6px; }
#devices { list-style: none; margin: 10px 0 0; padding: 0; }
#devices li {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  grid-template-areas: "dot who lag" "dot what lag";
  column-gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
#devices li:first-child { border-top: 0; }
#devices li.gone { opacity: .45; }
#devices .dot { grid-area: dot; width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; }
#devices .who { grid-area: who; overflow-wrap: anywhere; }
#devices .who em { color: var(--dim); font-style: normal; font-size: 13px; }
#devices .me .who { cursor: pointer; }
#devices .what { grid-area: what; color: var(--dim); font-size: 13px; }
#devices .lag { grid-area: lag; align-self: center; font-variant-numeric: tabular-nums; color: var(--dim); font-size: 14px; }

details summary { cursor: pointer; color: var(--dim); }
table { border-collapse: collapse; width: 100%; margin-top: 12px; font-size: 13px; }
th, td { text-align: left; padding: 4px 6px 4px 0; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 500; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; color: var(--dim); margin: 12px 0 0; }

.foot { color: var(--dim); font-size: 13px; margin-top: 18px; }
