:root {
  color-scheme: dark;
  --bg: #17120e;
  --panel: #221a14;
  --line: #3a2d22;
  --ink: #efe4d0;
  --muted: #a8977f;
  --accent: #c8894a;
  --accentInk: #1a120b;
  --tape: #5a3f28;
  --ok: #8fae7a;
  --hot: #a54a3e;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  overflow-x: hidden;
}
[hidden] { display: none !important; }

.wrap { max-width: 460px; margin: 0 auto; padding: 8px 16px 110px; }
.screen { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.title { font: 600 54px/1 var(--serif); margin: 0; letter-spacing: .01em; }
.album { font: 500 24px/1.2 var(--serif); color: var(--accent); margin: 6px 0 0; }
.h2 { font: 600 34px/1.1 var(--serif); margin: 0 0 14px; }
.rule { height: 1px; background: var(--line); margin: 28px 0; }
.lede { font: 500 italic 26px/1.2 var(--serif); margin: 0 0 10px; }
.body { color: var(--ink); opacity: .9; margin: 0 0 22px; }
.fine { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.center { text-align: center; }

.btn {
  font: 600 15px var(--sans); color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 12px 20px; cursor: pointer;
}
.btn.primary { width: 100%; background: var(--accent); color: var(--accentInk); border-color: var(--accent); padding: 15px 20px; }
.btn.round { width: 72px; height: 72px; padding: 0; border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }

.field { display: block; margin: 0 0 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .linkRow input {
  width: 100%; font: 16px var(--sans); color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.error { color: #d9644a; font-size: 14px; }

.playerHead { display: flex; justify-content: space-between; align-items: flex-start; }
.clock { font: 600 28px/1 var(--serif); margin: 0; font-variant-numeric: tabular-nums; }
.clock.urgent { color: #d9644a; }
.badge { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; border: 1px solid var(--accent); color: var(--accent); border-radius: 4px; padding: 4px 8px; }

.reels { width: 100%; margin: 26px 0 8px; }
.reelRim { fill: var(--panel); stroke: var(--tape); stroke-width: 3; }
.reelPack { fill: var(--tape); opacity: .55; }
.reelWindow { fill: var(--bg); stroke: var(--tape); stroke-width: 1.5; }
.reelHub { fill: var(--tape); }
.reelCore { fill: var(--bg); }
.tape { fill: none; stroke: var(--tape); stroke-width: 2; }

.now { text-align: center; }
.nowTitle { font: 600 26px var(--serif); margin: 0 0 12px; }
.bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.barFill { height: 100%; width: 0; background: var(--accent); transition: width .3s linear; }
.seek {
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0;
  background: transparent; cursor: pointer; --pct: 0%;
}
.seek::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent)) 0 / var(--pct) 100% no-repeat, var(--line); }
.seek::-moz-range-track { height: 3px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent)) 0 / var(--pct) 100% no-repeat, var(--line); }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; background: var(--accent); border: 0; }
.seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 0; }
.controls { display: flex; justify-content: center; align-items: center; gap: 22px; margin: 18px 0 4px; }
.btn.skip { width: 48px; height: 48px; padding: 0; font-size: 18px; color: var(--muted); }

.tracks { list-style: none; padding: 0; margin: 28px 0 0; border-top: 1px solid var(--line); }
.tracks li { display: flex; gap: 14px; align-items: baseline; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; font: 500 19px/1.25 var(--serif); }
.tracks li .n { width: 24px; color: var(--muted); font-size: 17px; font-variant-numeric: tabular-nums lining-nums; }
.tracks li .t { flex: 1; }
.tracks li .s { font-size: 17px; color: var(--muted); font-variant-numeric: tabular-nums lining-nums; }
.tracks li.on .t { color: var(--accent); font-weight: 600; }
.times { font-variant-numeric: lining-nums; }

.qrInvite { display: flex; flex-direction: column; align-items: center; margin: 22px 0 6px; }
.qrInvite #inviteQr { padding: 14px; background: #fbf5ea; border-radius: 12px; }
.qrInvite #inviteQr img, .qrInvite #inviteQr canvas { width: 200px; height: 200px; display: block; }
.expired { margin-top: 28px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 0 0 16px; }
.cardBig { font: 600 24px var(--serif); margin: 4px 0 0; }
.linkRow { display: flex; gap: 8px; margin: 0 0 16px; }
.linkRow input { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }

.dots { display: flex; justify-content: center; gap: 14px; margin: 8px 0 10px; }
.dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--tape); }
.dots i.on { background: var(--accent); border-color: var(--accent); }
.tree { width: 100%; margin: 14px 0; }
.tree line { stroke: var(--tape); stroke-width: 1.5; }
.tree circle { fill: var(--panel); stroke: var(--tape); stroke-width: 2; }
.tree circle.v { fill: var(--accent); stroke: var(--accent); }
.tree circle.me { fill: var(--ink); stroke: var(--ink); }
.tree text { fill: var(--muted); font: 11px var(--sans); text-anchor: middle; }
.tree text.more { fill: var(--accent); font-weight: 600; font-size: 13px; }
.claimed { margin: 10px 0 0; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.claimedNum { font: 600 40px/1 var(--serif); text-align: center; margin: 0; }
.claimed .bar { margin-top: 12px; }
.earned { margin-top: 18px; padding: 20px; border: 1px solid var(--accent); border-radius: 14px; text-align: center; }

.sessionList { list-style: none; padding: 0; margin: 0 0 8px; }
.sessionList li { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sessionList .d { font: 600 20px var(--serif); }
.sessionList .w { color: var(--muted); font-size: 14px; text-align: right; }
.sessionList li.next .d { color: var(--accent); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: var(--panel); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs button { flex: 1; max-width: 115px; background: none; border: 0; color: var(--muted); font: 600 13px var(--sans); padding: 12px 4px; cursor: pointer; }
.tabs button.on { color: var(--accent); }

.brand { max-width: 460px; margin: 0 auto; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.brandName { font: 600 28px/1 var(--serif); margin: 0; letter-spacing: .01em; }
.brandAlbum { font: 500 italic 15px/1.2 var(--serif); color: var(--accent); margin: 2px 0 0; }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.tracks li .s { font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
.sessionList li.empty { color: var(--muted); }
.btn.primary:disabled { opacity: .6; }

.gift { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 0 0 14px; }
.gift .giftHead { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 10px; }
.gift .giftName { font: 600 22px var(--serif); }
.gift .giftState { font-size: 13px; color: var(--muted); }
.gift .giftState.done { color: var(--accent); }
.gift .row2 { display: flex; gap: 8px; }
.gift .row2 .btn { flex: 1; }
.gift .qr { display: flex; justify-content: center; margin-top: 14px; }
.gift .qr > div { padding: 12px; background: #fbf5ea; border-radius: 12px; }
.gift .qr img, .gift .qr canvas { width: 180px; height: 180px; display: block; }
.sessionList .inv { display: block; margin-top: 6px; font-size: 13px; padding: 7px 14px; }
.sessionList li .left { display: flex; flex-direction: column; align-items: flex-start; }
.tree circle.u { fill: var(--bg); stroke: var(--tape); stroke-dasharray: 3 2; }

/* Sharing version */
.btn.side { min-width: 92px; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.now .bar { margin-top: 4px; }
.tracks li { cursor: pointer; }
.h3 { font: 600 22px var(--serif); margin: 28px 0 8px; }
.sent, .rows { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.sent li, .rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.sent .sName { font: 600 20px var(--serif); }
.sent .sState { font-size: 13px; color: var(--muted); text-align: right; }
.sent .sState.done { color: var(--accent); }
.rows li { font: 500 19px var(--serif); }
.rows li .n { color: var(--accent); font-weight: 600; font-variant-numeric: lining-nums; }
.rows li.empty { color: var(--muted); font: 14px var(--sans); }
.rows .rank { display: inline-block; width: 26px; color: var(--muted); font-variant-numeric: lining-nums; }
.rows .where { color: var(--muted); font-size: 14px; font-family: var(--sans); }
.board li.me { color: var(--accent); }
.nums { display: flex; gap: 12px; margin: 0 0 6px; }
.nums > div { flex: 1; text-align: center; }
.numBig { font: 600 40px/1 var(--serif); margin: 0; font-variant-numeric: lining-nums; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid .card { margin: 0; text-align: center; }
.owner { margin-top: 28px; }
.owner .btn.primary { display: block; text-align: center; text-decoration: none; }
#copied .linkRow { margin: 8px 0 0; }

/* Play button: red and pulsing while it waits to be pressed */
.btn.round.cue { background: var(--hot); border-color: var(--hot); color: #f6e9e2; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(165, 74, 62, .4); transform: scale(1); }
  50% { transform: scale(1.05); }
  70% { box-shadow: 0 0 0 16px rgba(165, 74, 62, 0); }
  100% { box-shadow: 0 0 0 0 rgba(165, 74, 62, 0); transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .btn.round.cue { animation: none; } }

/* The seal */
.seal { display: block; width: 150px; height: 150px; margin: 4px auto 22px; cursor: pointer; overflow: visible;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); }
.sealMark { font: 600 54px var(--serif); fill: #2e0a06; fill-opacity: .55; text-anchor: middle; letter-spacing: .02em; }
.seal .half { transform-box: fill-box; transition: transform .7s cubic-bezier(.2, .7, .2, 1), opacity .7s ease .15s; }
.seal .half.l { transform-origin: 30% 90%; }
.seal .half.r { transform-origin: 70% 90%; }
.seal.broken .half.l { transform: translate(-18px, 10px) rotate(-14deg); opacity: 0; }
.seal.broken .half.r { transform: translate(18px, 12px) rotate(12deg); opacity: 0; }
@media (prefers-reduced-motion: reduce) { .seal .half { transition: opacity .3s; } }

/* Songs heard all the way through */
.tracks li .h { width: 14px; color: var(--accent); font: 13px var(--sans); text-align: center; }
#heardLine { margin-top: 12px; }

/* Film grain */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: .07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Listen */
body[data-screen="player"] .reels { margin-top: 16px; }

/* Tab icons */
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 10px; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Branch: name and city on hover or tap */
.treeWrap { position: relative; overflow-x: auto; overflow-y: visible; }
.tree .node { cursor: pointer; }
.tree circle.hit { fill: transparent; stroke: none; }
.treeTip {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; z-index: 5;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 12px;
  text-align: center; white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.treeTip strong { display: block; font: 600 19px/1.1 var(--serif); }
.treeTip span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.treeTip em { display: block; font: italic 12px var(--sans); color: var(--accent); margin-top: 3px; }
.treeTip.below { transform: translate(-50%, 0); }

/* Stats: three numbers */
.stat { text-align: center; padding: 22px 0 24px; border-bottom: 1px solid var(--line); }
.stat:last-of-type { border-bottom: 0; }
.statNum { font: 600 72px/1 var(--serif); margin: 0; font-variant-numeric: lining-nums; }
.statLabel { font: italic 500 21px var(--serif); color: var(--accent); margin: 6px 0 10px; }
.stat .fine { margin-top: 10px; }
.heroBar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; max-width: 240px; margin: 4px auto 0; }
.heroFill { height: 100%; width: 0; background: var(--accent); transition: width .6s ease; }
.stat .cityBars { text-align: left; margin-top: 14px; }
.cityBars { list-style: none; padding: 0; margin: 0 0 6px; }
.cityBars li { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.cityBars .c { width: 112px; font: 600 17px/1.15 var(--serif); }
.cityBars .c small { display: block; font: 11px var(--sans); color: var(--muted); }
.cityBars .track { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.cityBars .fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.cityBars .n { width: 22px; text-align: right; font: 600 18px var(--serif); color: var(--accent); font-variant-numeric: lining-nums; }

/* Now playing bar above the tabs */
.mini {
  position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 10;
  display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 18px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.miniBar { position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--line); }
.miniFill { height: 100%; width: 0; background: var(--accent); }
.miniTitle { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 4px 0; cursor: pointer;
  color: var(--ink); font: 600 19px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.miniBtn { flex: none; width: 64px; height: 36px; border-radius: 999px; border: 1px solid var(--accent); background: none;
  color: var(--accent); font: 600 13px var(--sans); cursor: pointer; }
.miniBtn.cue { background: var(--hot); border-color: var(--hot); color: #f6e9e2; animation: pulse 1.6s ease-out infinite; }
@media (prefers-reduced-motion: reduce) { .miniBtn.cue { animation: none; } }
body.hasMini .wrap { padding-bottom: 170px; }

/* Tracks not out yet, and crew members who heard some */
.tracks li .soon { font: 12px var(--sans); color: var(--muted); letter-spacing: .04em; margin-left: 6px; }
.tracks li.locked { cursor: default; }
.tracks li.locked .t, .tracks li.locked .n { color: #6e5f4e; }
.tree circle.p { fill: var(--bg); stroke: var(--accent); }
.tree circle.dot { fill: var(--accent); stroke: none; pointer-events: none; }

/* Seal screen: the listening tip on its own line */
.headphones { font: italic 500 20px/1.3 var(--serif); color: var(--accent); margin: 18px 0 0; }

/* Asked for it: the form for people with no link, and the owner's list */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#askForm { margin-top: 8px; }
#askForm .h3 { margin-top: 6px; }
#asked { margin-top: 22px; color: var(--accent); }
#requestsBox { margin-bottom: 26px; }
#requestsBox .h3 { margin-top: 0; }
.requests li { align-items: center; }
.requests .rWho { display: flex; flex-direction: column; min-width: 0; }
.requests .rMeta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.requests .rBtns { display: flex; gap: 6px; flex: none; }
.btn.small { padding: 7px 14px; font-size: 13px; border-color: var(--accent); color: var(--accent); }
.btn.small.quiet { border-color: var(--line); color: var(--muted); }

/* Owner: Remove on a crew card, Withdraw on an unopened link */
.treeTip.act { pointer-events: auto; white-space: normal; max-width: 260px; }
.treeTip .tipAct .btn.small { margin: 3px 0; }
.treeTip .tipAct { margin-top: 8px; }
.treeTip .tipAct p { font-size: 13px; margin: 0 0 8px; color: var(--ink); }
.sent .sState .btn.small { margin-left: 8px; padding: 4px 10px; font-size: 12px; }
.headphones { display: flex; align-items: center; gap: 10px; }
.headphones svg { flex: none; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
