* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #14121f; color: #f2f0fa;
}
main { max-width: 560px; margin: 0 auto; padding: 10px 12px 16px; }
h1 { font-size: 26px; margin: 4px 0 8px; }
h2 { font-size: 17px; margin: 12px 0 6px; }
.muted { color: #a29fb8; font-size: 14px; }
.card { background: #221f33; border-radius: 14px; padding: 10px 12px; margin: 8px 0; }
.card > h2:first-child { margin-top: 0; }
p { margin: 6px 0; }
label { display: block; margin: 6px 0 4px; font-size: 14px; color: #c9c6dc; }
input[type=text], input[type=number] {
  width: 100%; padding: 10px; border-radius: 10px; border: 1px solid #3a3652;
  background: #14121f; color: inherit; font-size: 16px;
}
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
button {
  font: inherit; border: 0; border-radius: 12px; padding: 12px 16px;
  background: #3a3652; color: #fff; cursor: pointer;
}
button.primary { background: #7c5cff; width: 100%; font-weight: 600; font-size: 18px; margin-top: 8px; }
button.ghost { background: transparent; border: 1px solid #3a3652; }
button:disabled { opacity: .4; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 999px; background: #2c2842; border: 1px solid #3a3652; }
.chip.on { background: #7c5cff; border-color: #7c5cff; }
.swatch { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; border: 2px solid #fff3; }
.team-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.team-row input { flex: 1; }
.team-row button { flex: 0 0 auto; padding: 8px 12px; }

.turn-head { display: flex; align-items: center; gap: 10px; }
.turn-head .swatch { width: 20px; height: 20px; flex-basis: 20px; }
.score { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.score span { padding: 4px 10px; border-radius: 999px; font-size: 13px; background: #2c2842; }
.score span.active { outline: 2px solid #fff; }

.mystery { text-align: center; padding: 10px 12px; }
.mystery .q { font-size: 64px; }
.big-play { width: 120px; height: 120px; border-radius: 50%; font-size: 48px; background: #7c5cff; margin: 16px auto; display: block; }
.qr { background: #fff; border-radius: 12px; padding: 8px; width: 240px; max-width: 80vw; margin: 8px auto; display: block; }

.timeline { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.tl-card { background: #2c2842; border-radius: 10px; padding: 8px 12px; display: flex; gap: 12px; align-items: center; }
.tl-card .y { font-weight: 700; font-size: 20px; min-width: 56px; }
.tl-card .t { font-size: 13px; color: #c9c6dc; }
.tl-card.new.ok { background: #1f6b46; }
.tl-card.new.bad { background: #7a2a3a; text-decoration: line-through; }
.slot { border: 2px dashed #7c5cff; background: transparent; color: #b9a8ff; padding: 6px; font-size: 14px; }

.reveal { text-align: center; }
.reveal .y { font-size: 48px; font-weight: 800; }
.reveal .a { font-size: 18px; }
.ok-text { color: #5be39b; font-weight: 700; font-size: 20px; }
.bad-text { color: #ff7a8f; font-weight: 700; font-size: 20px; }
.player main { text-align: center; padding-top: 15vh; }
.tl-card.pending { background: transparent; border: 2px solid; }
button.rival { width: 100%; margin-top: 8px; text-align: left; background: #2c2842; }
.team-range { margin: 2px 0 8px 44px; }
.team-range .chip { padding: 4px 10px; font-size: 14px; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.trophy { font-size: 96px; animation: pop 0.8s cubic-bezier(.2,1.6,.4,1) both, bob 2s ease-in-out 0.8s infinite; }
.winner-name { animation: glow 1.5s ease-in-out infinite alternate; }
@keyframes pop { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }
@keyframes bob { 50% { transform: translateY(-10px) rotate(5deg); } }
@keyframes glow { from { text-shadow: 0 0 4px currentColor; } to { text-shadow: 0 0 24px currentColor; } }
.fold { padding: 4px 10px; font-size: 13px; color: #c9c6dc; margin-bottom: 4px; }
.guide { padding-left: 20px; margin: 8px 0; }
.guide li { margin: 4px 0; }

.btn-row { display: flex; gap: 8px; margin-top: 8px; }
.btn-row > button { flex: 1; margin-top: 0; }
.play-btn { background: #2c2842; border: 2px solid #7c5cff; font-size: 22px; }
button.compact { width: 100%; margin-top: 8px; padding: 8px 12px; font-size: 15px; }
button.compact.on { background: #1f6b46; border-color: #1f6b46; }
.btn-stack { margin: 6px 0 2px; }
.btn-stack .primary { margin-top: 8px; padding: 10px; }
.reveal .y { font-size: 40px; }
.reveal { padding: 8px 12px; }
.reveal .y { line-height: 1.1; }
.turn-head h1 { margin: 2px 0 6px; }
.setup-head { display: flex; align-items: center; justify-content: space-between; }
.gear { padding: 6px 10px; font-size: 20px; }
.gear.on { background: #2c2842; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }

.summary { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex-wrap: wrap; }
.head-right { display: flex; align-items: center; gap: 6px; }
.setup-head .brand { white-space: nowrap; font-size: 22px; }
.setup-head .brand img { width: 30px; height: 30px; }
.pill { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border: 1.5px solid #7c5cff; border-radius: 999px; background: #221f33; font-size: 14px; color: #e6e2f7; }
.qr-icon { width: 14px; height: 14px; color: #f2f0fa; }
select { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid #3a3652; background: #14121f; color: inherit; font-size: 16px; }
.chip .qr-icon { vertical-align: -2px; }
.team-row .swatch { width: 24px; height: 24px; flex: 0 0 24px; padding: 0; border-width: 2px; }
.team-range { margin-left: 32px; }
.gear { padding: 3px 7px; font-size: 16px; }
.summary { margin: 0 0 6px; }
button.pill { font: inherit; font-size: 14px; cursor: pointer; }

.bonus-btn { width: 100%; padding: 10px 12px; font-size: 15px; border-radius: 12px; background: #2a2414;
  border: 2px dashed #f5c542; color: #f5d97a; }
.bonus-btn b { color: #ffd84d; }
.bonus-btn.on { background: #1f6b46; border: 2px solid #5be39b; color: #e8fff1; animation: award .5s ease-out; }
.bonus-btn.on b { color: #fff; }
.bonus-btn .undo { font-size: 12px; opacity: .7; text-decoration: underline; margin-left: 6px; }
@keyframes award { 0% { transform: scale(.95); } 50% { transform: scale(1.04); box-shadow: 0 0 18px #5be39b; } 100% { transform: none; } }
.again-btn { background: #2c2842; border: 2px solid #7c5cff; font-weight: 600; }
.btn-stack .btn-row .primary { padding: 12px; }
.btn-stack .btn-row > button { padding: 10px 8px; font-size: 16px; line-height: 1.2; white-space: nowrap; border-width: 2px; border-style: solid; }
.btn-stack .btn-row .primary { border-color: #7c5cff; }
.btn-row > button { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.btn-stack .btn-row > button { margin: 0; }
.btn-stack { margin: 12px 0 14px; }
.btn-stack .bonus-btn { margin-bottom: 12px; }
.card.reveal { margin: 14px 0 16px; }
.btn-stack .btn-row .primary { flex-grow: 2; }
#tvCode { width: 8em; flex: 0 0 auto; text-transform: uppercase; letter-spacing: .2em; font-weight: 700; text-align: center; }
.tv-code-row { margin-top: 6px; }
.game-code { margin-left: auto; font-size: 13px; letter-spacing: .15em; color: #a29fb8; border: 1px solid #3a3652; border-radius: 8px; padding: 2px 8px; }
.chip:disabled { opacity: .45; }
.recovery { font: 700 22px/1.3 ui-monospace, monospace; letter-spacing: .08em; text-align: center; padding: 10px; margin: 6px 0;
  background: #14121f; border: 2px dashed #f5c542; border-radius: 10px; color: #ffd84d; user-select: all; }
button.danger { border-color: #7a2a3a; color: #ff9aaa; }
