:root { font-family: Inter, Arial, sans-serif; color: #f8fafc; background: #06101b; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #18324a, #06101b 62%); overflow: hidden; }
button { font: inherit; color: inherit; touch-action: manipulation; }
main { height: 100vh; display: flex; flex-direction: column; padding: 1.5vh 2vw; }
header { display: flex; justify-content: space-between; font-weight: 800; letter-spacing: .12em; }
header > div { display: flex; align-items: center; gap: 2rem; }
.brand { color: #f59e0b; }
#mode { color: #f59e0b; }
.dashboard { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(310px, 34%) 1fr; gap: 1.2vw; margin: 1.3vh 0; }
.score-panel { min-height: 0; display: grid; grid-template-rows: 1fr auto auto 1fr; gap: 1vh; }
.camera-view { position: relative; min-width: 0; min-height: 0; overflow: hidden; border: 2px solid #334155; border-radius: 1rem; background: #020617; }
#camera-feed { width: 100%; height: 100%; display: block; object-fit: contain; }
.camera-state { position: absolute; inset: 0; display: grid; place-items: center; padding: 2rem; background: #020617; color: #cbd5e1; font-size: clamp(1.1rem, 2vw, 2rem); font-weight: 800; text-align: center; }
.camera-state[hidden] { display: none; }
.camera-state.offline, .camera-state.unavailable { color: #fdba74; }
#camera-badge { position: absolute; top: .75rem; left: .75rem; padding: .45rem .75rem; border-radius: .5rem; background: #020617c9; font-size: clamp(.65rem, 1vw, 1rem); font-weight: 900; letter-spacing: .1em; }
.team { position: relative; min-height: 0; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto; align-items: center; padding: 1.2vh 1.2vw; border: 4px solid transparent; border-radius: 1.4rem; background: rgba(15, 23, 42, .76); opacity: .68; cursor: pointer; overflow: hidden; }
.team.serving { opacity: 1; box-shadow: 0 .7rem 2rem #0008; }
.orange.serving { border-color: #f97316; background: linear-gradient(#7c2d12cc, #1c1917); }
.blue.serving { border-color: #38bdf8; background: linear-gradient(#075985cc, #0c1928); }
.team-number { align-self: start; justify-self: start; max-width: 100%; color: #f8fafc; font-size: clamp(1.1rem, 1.7vw, 2rem); font-weight: 900; letter-spacing: .08em; overflow-wrap: anywhere; }
.team-image { grid-column: 1; grid-row: 2; align-self: center; justify-self: center; width: auto; max-width: min(92%, 14rem); height: auto; max-height: clamp(5rem, 17vh, 12rem); object-fit: contain; filter: drop-shadow(0 .5rem .8rem #0008); }
.team-image[hidden] { display: none; }
.serve { visibility: hidden; align-self: start; justify-self: end; font-size: clamp(.7rem, 1vw, 1rem); font-weight: 900; letter-spacing: .16em; }
.serving .serve { visibility: visible; }
.orange .serve { color: #fdba74; } .blue .serve { color: #7dd3fc; }
.team strong { grid-row: 2; grid-column: 2; align-self: center; font-size: clamp(5rem, 8vw, 8rem); line-height: .8; }
.players { grid-column: 1 / -1; min-height: 1.4rem; color: #e0f2fe; font-size: clamp(.8rem, 1.1vw, 1.25rem); font-weight: 900; overflow-wrap: anywhere; }
.hint { grid-column: 1 / -1; align-self: end; justify-self: center; font-size: clamp(.55rem, .7vw, .8rem); color: #cbd5e1; letter-spacing: .08em; }
.service { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .8rem; padding: .55rem 1rem; border-radius: .8rem; text-align: left; color: #94a3b8; background: #0f2133; }
.service small { font-weight: 800; }
.service b { font-size: clamp(2.2rem, 3vw, 3.4rem); line-height: 1; color: #fbbf24; }
#server-name { font-size: clamp(.75rem, 1.2vw, 1.2rem); }
.scoring-mode-label { min-height: 2.1rem; display: grid; place-items: center; padding: .4rem .8rem; border: 2px solid #334155; border-radius: .7rem; color: #e0f2fe; background: #082f49; font-size: clamp(.75rem, 1vw, 1.05rem); font-weight: 900; letter-spacing: .12em; text-align: center; }
#message { min-height: 2.5rem; text-align: center; font-size: clamp(1rem, 2vw, 2rem); font-weight: 700; }
footer { display: flex; justify-content: center; gap: 1rem; }
footer button, .choice, .fullscreen-button { border: 0; border-radius: .8rem; padding: .9rem 1.5rem; background: #1e3a52; font-weight: 900; cursor: pointer; }
.fullscreen-button { min-width: 8.8rem; padding: .45rem .75rem; border: 2px solid #334155; border-radius: .55rem; background: #075985; font-size: clamp(.62rem, .8vw, .78rem); letter-spacing: .08em; white-space: nowrap; }
footer .danger { background: #9a3412; }
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: #020617dc; }
.overlay[hidden] { display: none; }
.pickle-overlay { padding: 0; background: #000; z-index: 20; overflow: hidden; }
.pickle-overlay video { position: relative; z-index: 1; width: 100vw; height: 100vh; display: block; object-fit: contain; background: #000; }
.pickle-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: #020617; font-size: clamp(4rem, 12vw, 13rem); font-weight: 900; letter-spacing: .06em; text-shadow: 0 0 32px #f59e0b; z-index: 0; }
.dialog { width: min(90vw, 560px); padding: 2rem; border: 2px solid #475569; border-radius: 1.5rem; text-align: center; background: #0f2133; }
.dialog h2 { font-size: 3rem; margin: 0 0 2rem; }
.choice { min-width: 9rem; margin: .5rem; font-size: 1.5rem; }
.choice.selected { outline: 5px solid #f59e0b; background: #9a3412; }
.dialog p { color: #94a3b8; }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; }
.result-btn { min-width: 9rem; margin: .5rem; padding: .9rem 1.5rem; font-size: 1.5rem; border: 0; border-radius: .8rem; background: #1e3a52; color: inherit; font-weight: 900; cursor: pointer; }
.result-btn.danger { background: #7f1d1d; }
#stats-list { margin: 0 0 1rem; padding: 0; list-style: none; display: grid; gap: .5rem; max-height: 40vh; overflow-y: auto; text-align: left; }
#stats-list[hidden] { display: none; }
#stats-list li { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; padding: .6rem .9rem; border-radius: .6rem; background: #16283c; color: #e2e8f0; font-weight: 700; font-size: 1.1rem; }
#stats-list li span:last-of-type { text-align: right; }
#stats-list li small { grid-column: 1 / -1; color: #bae6fd; font-size: .9rem; font-weight: 800; overflow-wrap: anywhere; }
#qr-banner { position: fixed; right: 1.2rem; bottom: 9.8rem; display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border: 2px solid #334155; border-radius: 1rem; background: #0f2133f0; box-shadow: 0 .5rem 1.5rem #0008; z-index: 5; }
#qr-banner[hidden] { display: none; }
#qr-banner-image { width: 84px; height: 84px; border-radius: .4rem; background: white; padding: .3rem; }
#qr-banner div { display: grid; gap: .2rem; color: #f8fafc; }
#qr-banner b { font-size: .85rem; letter-spacing: .08em; color: #fbbf24; }
#qr-banner-timer { font-size: .75rem; color: #94a3b8; }
#control-code-banner { position: fixed; top: 5.2rem; left: 50%; transform: translateX(-50%); min-width: min(92vw, 760px); display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 1.2rem; padding: 1rem 1.3rem; border: 4px solid #fbbf24; border-radius: 1rem; background: #020617f5; box-shadow: 0 .8rem 2rem #000b; z-index: 8; }
#control-code-banner[hidden] { display: none; }
#control-code-banner div { min-width: 0; display: grid; gap: .25rem; }
#control-code-banner b { color: #fbbf24; font-size: clamp(.85rem, 1.4vw, 1.2rem); letter-spacing: .12em; }
#control-code-email { overflow-wrap: anywhere; color: #e0f2fe; font-size: clamp(.85rem, 1.5vw, 1.25rem); font-weight: 800; }
#control-code-value { color: #fff; font-size: clamp(2.8rem, 6vw, 5.2rem); line-height: .9; letter-spacing: .08em; }
#control-code-timer { color: #94a3b8; font-size: clamp(.8rem, 1.2vw, 1rem); font-weight: 900; }
#start-qr { position: fixed; right: 1.2rem; bottom: 1.2rem; width: 8rem; display: grid; gap: .45rem; justify-items: center; padding: .65rem; border: 2px solid #f59e0b; border-radius: 1rem; background: #020617eb; box-shadow: 0 .7rem 1.6rem #0009; z-index: 4; }
#start-qr img { width: 6.6rem; height: 6.6rem; padding: .35rem; border-radius: .45rem; background: white; }
#start-qr b { color: #fbbf24; font-size: .74rem; line-height: 1.05; text-align: center; letter-spacing: .08em; }
.screensaver { position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 35% 20%, #1e3a52, #020617 58%, #000 100%); z-index: 30; pointer-events: none; }
.screensaver[hidden] { display: none; }
.screensaver::before { content: ""; position: absolute; inset: 8vh 8vw; border: 2px solid #1e3a52; border-radius: 2rem; opacity: .45; }
.screensaver-brand { position: absolute; top: 7vh; left: 7vw; color: #f59e0b; font-size: clamp(1rem, 2vw, 2.4rem); font-weight: 900; letter-spacing: .18em; }
.screensaver-message { position: relative; max-width: min(84vw, 980px); padding: 1.4rem 2rem; border: 3px solid #f59e0b; border-radius: 1.2rem; background: #020617d9; box-shadow: 0 1rem 3rem #000b, 0 0 2rem #f59e0b44; color: #fff7ed; font-size: clamp(2.2rem, 6vw, 6.6rem); font-weight: 900; line-height: 1.05; text-align: center; animation: screensaver-float 9s ease-in-out infinite alternate; }
@keyframes screensaver-float {
  from { transform: translate(-7vw, -4vh); }
  to { transform: translate(7vw, 4vh); }
}
@media (max-width: 900px) {
  header { font-size: .75rem; } .brand { display: none; }
  header > div { gap: .8rem; }
  .dashboard { grid-template-columns: minmax(260px, 40%) 1fr; }
  .team { border-radius: 1rem; } .hint { display: none; }
  .team strong { font-size: clamp(4rem, 9vw, 6rem); }
  .fullscreen-button { min-width: 7.2rem; padding: .35rem .5rem; font-size: .62rem; }
  #start-qr { width: 6.8rem; padding: .5rem; }
  #start-qr img { width: 5.4rem; height: 5.4rem; }
  #start-qr b { font-size: .62rem; }
  #qr-banner { bottom: 8.3rem; }
  #control-code-banner { top: 4rem; grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .screensaver-message { font-size: clamp(1.7rem, 8vw, 4rem); }
}
