/* Shiftship party races: the phone's room screens and the Add a TV card. The TV page has its own block below. */
.room-panel { display: grid; align-content: start; }
.room-card { width: min(460px, 100%); padding: 18px; margin: 0 auto; }
.room-card h2 { margin: 0; font-size: 26px; }
.room-card h2.win { color: var(--hi); font-size: 34px; }
.room-card h3 { margin: 6px 0 0; font-size: 17px; }
.room-card label { font-weight: 600; text-align: left; }
.room-card input { min-height: 50px; border-radius: 14px; border: 3px solid var(--ink); background: #fff8ec; color: var(--ink); padding: 6px 14px; font: inherit; font-size: 20px; font-weight: 600; -webkit-user-select: text; user-select: text; }
.room-card .err { min-height: 1.2em; margin: 0; color: #ff8fb0; font-weight: 600; }
.kicker { margin: 0; color: var(--soft); font-weight: 600; }
.kicker .code { color: var(--hi); letter-spacing: .12em; font-size: 1.15em; }
.honest { font-size: 13.5px; margin: 0; }
.center { text-align: center; }
.lead { margin: 0; font-size: 17px; }
.big-go { min-height: 60px; font-size: 22px; }
.pilots, .standings, .tonight { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.pilots li, .standings li, .tonight li { display: flex; align-items: center; gap: 10px; background: #ffffff10; border-radius: 12px; padding: 6px 10px; min-height: 40px; text-align: left; }
.pilots li i, .standings li i, .tonight li i, .me-pill i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.pilots li span, .standings li span, .tonight li span { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pilots li small { color: var(--hi); font-weight: 700; }
.pilots li.away { opacity: .5; }
.pilots li button { min-height: 36px; min-width: 36px; padding: 0; }
.standings li b, .tonight li b { font-variant-numeric: tabular-nums; }
.standings li.me, .tonight li.me { outline: 2px solid var(--hi); }
.standings em { font-style: normal; font-weight: 700; color: var(--soft); width: 1.4em; text-align: center; }
.standings.final li:first-child { background: var(--hi-soft); }
.tonight small { color: var(--soft); }
.course-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.course { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-height: 84px; background: var(--panel); color: var(--text); font-size: 14px; line-height: 1.15; }
.course i { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink); }
.course small { font-weight: 500; color: var(--soft); font-size: 12px; }
.course.on { border-color: var(--hi); background: var(--hi-soft); box-shadow: 0 4px 0 var(--hi); }
.tv-ok { margin: 0; text-align: center; color: #58d66f; font-weight: 700; }
.button-link { display: inline-block; padding: 12px 18px; border-radius: 16px; background: var(--accent, var(--hi)); color: var(--ink); font-weight: 700; border: 3px solid var(--ink); text-decoration: none; }

.me-pill { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; background: #00000055; border: 2px solid #ffffff33; border-radius: 999px; padding: 6px 12px; font-weight: 700; white-space: nowrap; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
.playing .me-pill { display: none; }
.tv-btn { white-space: nowrap; }
.on-panel .me-pill.hidden + .tv-btn { margin-left: auto; }
.playing .tv-btn { margin-left: 0; }
.tv-btn.on { border-color: #58d66f; }
.playing .tv-btn span { display: none; }

/* 3, 2, 1, GO */
.count { position: absolute; z-index: 8; left: 0; right: 0; top: 34%; text-align: center; font-size: clamp(64px, 22vw, 150px); font-weight: 700; color: #fff8ec; -webkit-text-stroke: 3px #1a1630; text-shadow: 0 6px 0 #1a1630; pointer-events: none; }
.count.pop { animation: count-pop .6s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes count-pop { from { transform: scale(.3); opacity: 0; } 60% { opacity: 1; } to { transform: scale(1); opacity: 1; } }

/* Add a TV: a card at the top, so the ship near the bottom stays in sight during a race */
.tvcard { position: absolute; z-index: 40; left: 0; right: 0; top: calc(max(8px, env(safe-area-inset-top)) + 56px); padding: 0 12px; }
.tvcard .card { max-width: 440px; margin: 0 auto; padding: 16px 18px; display: grid; gap: 8px; animation: g-pop .3s cubic-bezier(.2,1.5,.4,1) both; max-height: calc(100dvh - 90px); overflow-y: auto; }
.tvcard h2 { margin: 0; font-size: 21px; }
.tv-state { margin: 0; font-weight: 700; color: var(--soft); }
.tv-state.ok { color: #58d66f; }
.tv-steps { margin: 0; padding-left: 22px; display: grid; gap: 4px; font-size: 16px; }
.tv-steps b { color: var(--hi); overflow-wrap: anywhere; }
.tv-steps .tv-code { letter-spacing: .14em; font-size: 1.25em; }
.small-print { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }

/* Race or Battle, picked by the leader */
.mode-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; min-height: 76px; background: var(--panel); color: var(--text); line-height: 1.15; }
.mode b { font-size: 18px; }
.mode small { font-weight: 500; color: var(--soft); font-size: 12.5px; }
.mode.on { border-color: var(--hi); background: var(--hi-soft); box-shadow: 0 4px 0 var(--hi); }

/* Battle on the phone: hearts, knockouts and the clock up top, FIRE bottom right, the knocked-out card */
.bhud { position: absolute; z-index: 6; left: 50%; transform: translateX(-50%); top: calc(max(8px, env(safe-area-inset-top)) + 56px); display: flex; align-items: center; gap: 12px; background: #0d0a2acc; border: 2px solid #ffffff33; border-radius: 999px; padding: 6px 14px; font-weight: 700; white-space: nowrap; pointer-events: none; }
.b-hp i { color: #ff5d8f; font-style: normal; font-size: 18px; }
.b-hp i.gone { color: #ffffff33; }
.b-ko { color: var(--hi); }
.b-time { font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.b-time.urgent { color: #ff5d8f; }
.b-out { position: absolute; z-index: 7; left: 0; right: 0; top: 38%; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; color: #fff8ec; text-shadow: 0 3px 0 #1a1630; }
.b-out b { font-size: clamp(30px, 9vw, 54px); -webkit-text-stroke: 2px #1a1630; color: var(--hi); }
.b-out span { font-size: 22px; font-weight: 700; }
.b-fire { position: absolute; z-index: 6; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.b-watch { background: #0d0a2ad9; }

@media (prefers-reduced-motion: reduce) {
  .count.pop, .tvcard .card { animation: none; }
}

/* ---------- the TV ---------- */
.tvroom #stage { position: absolute; inset: 0; }
.tvroom #track { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tv-top { justify-content: flex-start; }
.tv-chip { background: #00000066; border: 2px solid #ffffff33; border-radius: 999px; padding: 6px 16px; font-weight: 700; font-size: clamp(15px, 1.6vw, 22px); white-space: nowrap; }
.tv-chip.join { margin-left: auto; color: var(--soft); }
.tv-chip.join b { color: var(--text); }
.tv-chip .code { color: var(--hi); letter-spacing: .12em; }
.tvroom .count { top: 30%; font-size: clamp(90px, 16vw, 220px); }
.tv-board { position: absolute; z-index: 5; right: 16px; top: 76px; width: min(340px, 26vw); margin: 0; padding: 0; list-style: none; font-size: clamp(16px, 1.5vw, 22px); }
.tv-board li { position: absolute; left: 0; right: 0; top: 0; height: 3em; display: flex; align-items: center; gap: 10px; padding: 0 14px; box-sizing: border-box; background: #1a1630cc; border: 2px solid #ffffff22; border-radius: 14px; transition: transform .5s cubic-bezier(.3,1.3,.5,1); }
.tv-board li em { font-style: normal; font-weight: 700; color: var(--soft); width: 1.2em; }
/* Battle on the TV: who knocked out whom, newest on top */
.tv-feed { position: absolute; z-index: 5; right: 16px; bottom: 16px; width: min(340px, 26vw); margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: clamp(14px, 1.3vw, 19px); }
.tv-feed li { display: flex; align-items: center; gap: 6px; background: #1a1630dd; border: 2px solid #ffffff22; border-radius: 12px; padding: 6px 10px; animation: g-pop .3s cubic-bezier(.2,1.5,.4,1) both; transition: opacity .6s; }
.tv-feed li.old { opacity: .45; }
.tv-feed li i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.tv-feed li span { color: var(--soft); }
@media (max-width: 900px) { .tv-feed { left: 16px; right: 16px; width: auto; } }
.tv-board li i { width: .8em; height: .8em; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.tv-board li span { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-board li small { color: #ff5d8f; font-size: .8em; letter-spacing: -1px; }
.tv-board li b { font-variant-numeric: tabular-nums; color: var(--hi); }
.tv-board li.out { opacity: .55; }
@media (max-width: 900px) { .tv-board { display: none; } }

.tv-lobby { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 72px 24px 24px; }
.tv-lobby-card { display: grid; grid-template-columns: 1fr auto; gap: 36px; align-items: center; width: min(1100px, 100%); padding: 28px 36px; background: #140e38e6; }
.tv-join > * + * { margin-top: 16px; }
.tv-title { margin: 0; font-size: clamp(34px, 4vw, 56px); line-height: 1; color: #fff8ec; -webkit-text-stroke: 2px #1a1630; text-shadow: 0 4px 0 #1a1630; }
.tv-title em { font-style: normal; color: #ff9a1f; }
.tv-title span { font-size: .5em; color: var(--soft); -webkit-text-stroke: 0; text-shadow: none; }
.tvroom .join-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: clamp(18px, 2.2vw, 30px); font-weight: 600; }
.tvroom .join-steps li { display: inline-flex; align-items: center; gap: 10px; }
.tvroom .join-steps b { color: var(--hi); }
.tvroom .js-n { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: #2ec4b6; color: #1d1433; border: 3px solid #1d1433; font-weight: 700; flex: none; }
.tvroom .big-code { display: inline-block; font-size: clamp(64px, 11vw, 132px); font-weight: 700; letter-spacing: .14em; line-height: 1; padding: 10px 26px 14px 36px; color: var(--ink); background: var(--hi); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 0 8px 0 var(--ink); }
.tvroom .qr { background: #fff8ec; color: var(--ink); border: 4px solid var(--ink); border-radius: 22px; padding: 16px; text-align: center; box-shadow: 0 8px 0 var(--ink); }
.tvroom .qr svg { width: clamp(150px, 20vw, 240px); height: auto; display: block; }
.tvroom .qr p { margin: 8px 0 0; font-weight: 700; font-size: 18px; }
.tv-pilots { display: flex; flex-wrap: wrap; gap: 10px 18px; min-height: 96px; align-items: center; }
.tv-pilot { display: flex; flex-direction: column; align-items: center; font-size: clamp(16px, 1.7vw, 22px); font-weight: 700; animation: g-pop .4s cubic-bezier(.2,1.5,.4,1) both; }
.tv-pilot canvas { width: 72px; height: 72px; }
.tv-pilot span { display: inline-flex; align-items: center; gap: 6px; }
.tv-pilot span i { width: .7em; height: .7em; border-radius: 50%; border: 2px solid var(--ink); }
.tv-pilot small { font-size: 13px; color: var(--ink); background: var(--hi); border-radius: 999px; padding: 0 8px; }
.tv-pilot.away { opacity: .45; }
.tv-note { margin: 0; font-size: clamp(17px, 1.9vw, 26px); }
.tv-note a { color: var(--hi); }
.tv-status { position: absolute; z-index: 9; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; font-weight: 700; color: var(--hi); }

.tv-results { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 72px 24px 24px; overflow-y: auto; }
.tv-res-card { width: min(880px, 100%); padding: 24px 32px; background: #140e38e6; text-align: center; display: grid; gap: 14px; }
.tv-res-card h2 { margin: 0; font-size: clamp(34px, 4.4vw, 60px); color: var(--hi); text-shadow: 0 4px 0 #1a1630; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 16px; }
.podium .step { display: flex; flex-direction: column; align-items: center; gap: 4px; width: min(220px, 30%); animation: g-rise .6s ease-out both; }
.podium .step canvas { width: 96px; height: 96px; }
.podium .step b { display: inline-flex; align-items: center; gap: 8px; font-size: clamp(18px, 2vw, 28px); }
.podium .step b i { width: .7em; height: .7em; border-radius: 50%; border: 2px solid var(--ink); }
.podium .step span { color: var(--soft); font-size: clamp(14px, 1.4vw, 19px); }
.podium .block { width: 100%; display: grid; place-items: center; font-size: 34px; font-weight: 700; color: var(--ink); background: var(--hi); border: 4px solid var(--ink); border-radius: 14px 14px 0 0; }
.podium .s1 .block { height: 120px; }
.podium .s2 .block { height: 84px; background: #d9d6ea; }
.podium .s3 .block { height: 60px; background: #e0a96d; }
.podium .s1 { animation-delay: .3s; }
.podium .s3 { animation-delay: .15s; }
.tv-rest, .tv-tonight .tonight { max-width: 560px; margin: 0 auto; width: 100%; font-size: clamp(16px, 1.5vw, 21px); }
.tv-tonight h3 { margin: 0 0 6px; }
@media (prefers-reduced-motion: reduce) {
  .tv-board li { transition: none; }
  .tv-pilot, .podium .step { animation: none; }
}
@media (max-width: 760px) {
  .tv-lobby-card { grid-template-columns: 1fr; padding: 18px; }
  .tvroom .qr { display: none; }
}
.level-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.level { min-height: 44px; padding: 6px; background: var(--panel); color: var(--text); font-size: 15px; }
.level.on { border-color: var(--hi); background: var(--hi-soft); box-shadow: 0 4px 0 var(--hi); }
