/* QuizBoard — in-game stage: scoreboard, number board and question window.
   Presentation only. Loaded last. Scoped to the board view and its dialogs. */

/* ---------- Board screen ---------- */
body[data-board-view="board"] .wrap{max-width:1680px;padding:14px clamp(14px,2.2vw,36px) 18px;justify-content:flex-start}
body[data-board-view="board"] .top{margin-bottom:10px}
body[data-board-view="board"] footer{display:none}
body[data-board-view="board"] #app{flex:1;display:flex;flex-direction:column;min-height:0}

/* No big white card around the game: scores and tiles sit straight on the gradient */
.panel.classBoard{flex:1;display:flex;flex-direction:column;min-height:0;padding:0!important;background:transparent;border:0;box-shadow:none;border-radius:0}
.panel.classBoard::before{display:none}
.classBoard>.row:first-child{flex-wrap:nowrap;align-items:center;gap:12px;margin:0 0 12px}
.classBoard>.row:first-child h1{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.classBoard>.row:first-child .eyebrow{font-size:13px;letter-spacing:.14em;color:#4a2fa6;margin:0}
.classBoard .boardTeacher{margin:0;background:#ffffffb0;border-radius:12px;max-width:none}
.classBoard .boardTeacher:not([open]){flex-basis:auto}
.classBoard .boardTeacher>summary{padding:8px 14px;min-height:40px;display:flex;align-items:center}
.classBoard .boardTeacher::before{display:none}

/* Scoreboard */
.classBoard .scores{display:grid;grid-template-columns:repeat(var(--teams,2),minmax(0,1fr));gap:clamp(8px,1.2vw,16px);margin:0 0 14px;align-items:stretch}
.classBoard .team-score{display:flex;flex-direction:column;justify-content:space-between;gap:2px;border:0;border-radius:20px;padding:14px 18px 12px;background:#fff;border:1px solid #dcd8ea;box-shadow:0 1px 2px #1b17300d;position:relative;overflow:hidden;transition:transform .25s,box-shadow .25s,background .25s}
.classBoard .team-name::before,.classQuestion .activeTeam::before,.turnRow .turn-pill::before{content:"";display:inline-block;width:.55em;height:.55em;border-radius:50%;background:var(--team);margin-right:.45em;vertical-align:.08em}
.classBoard .team-name{font-size:clamp(16px,1.6vw,24px);font-weight:800;line-height:1.15;color:var(--ink);padding-top:4px}
.classBoard .points{font-size:clamp(38px,4.6vw,76px);font-weight:900;line-height:1;letter-spacing:-.03em;margin:4px 0 2px;font-variant-numeric:tabular-nums}
.classBoard .shield{font-size:11px;font-weight:900;letter-spacing:.08em;color:var(--purple)}
.classBoard .turn-label{font-size:11px;font-weight:900;letter-spacing:.16em;color:#ffffffd9}
.classBoard .team-score.current{background:var(--purple);border-color:var(--purple);color:#fff;transform:translateY(-3px) scale(1.025);box-shadow:0 18px 36px -16px var(--purple)}
.classBoard .team-score.current .team-name,.classBoard .team-score.current .points,.classBoard .team-score.current .shield{color:#fff}
.classBoard .team-score.current .team-name::before{box-shadow:0 0 0 2px #fff}

/* Turn line + progress (replaces the old pill and "played" counter) */
.turnRow{display:flex;align-items:center;gap:16px;margin:0 0 14px}
.turnRow .turn-pill{padding:0;background:none;color:var(--ink);font-size:clamp(22px,2.6vw,38px);font-weight:900;letter-spacing:-.02em;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.turnRow .turn-pill span{font-weight:700;color:var(--muted)}
.turnRow .progress{flex:1;min-width:60px;height:8px;border-radius:99px;background:#e6e2f3;overflow:hidden}
.turnRow .progress span{display:block;height:100%;border-radius:inherit;background:var(--purple);transition:width .4s}
.turnRow .small{font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap}

/* Number board fills the rest of the window */
.classBoard .board{flex:1;min-height:0;display:grid;grid-template-columns:repeat(var(--board-columns,6),minmax(0,1fr));grid-auto-rows:minmax(56px,1fr);gap:clamp(8px,1.1vw,16px)}
.classBoard .tile{min-height:0;height:100%;border:1px solid #dcd8ea;border-radius:clamp(14px,1.6vw,22px);color:var(--ink);font-size:clamp(26px,3.6vw,60px);font-weight:900;letter-spacing:-.02em;font-variant-numeric:tabular-nums;background:#fff;box-shadow:0 4px 0 #dcd8ea;transition:transform .15s,box-shadow .15s,background .15s,color .15s;animation:tilePop .28s both}
.classBoard .tile:hover:not(:disabled),.classBoard .tile:focus-visible{transform:translateY(-4px);color:#fff;border-color:transparent;background:var(--purple);box-shadow:0 10px 0 #cfc7f5,0 18px 30px -14px var(--purple)}
.classBoard .tile:active:not(:disabled){transform:scale(.97)}
.classBoard .tile.used{background:transparent;border:2px dashed #1b173033;color:#1b173055;box-shadow:none;font-size:clamp(18px,2vw,30px);opacity:1;animation:none}
@keyframes tilePop{from{opacity:0;transform:scale(.9)}to{opacity:1;transform:none}}

/* ---------- Question window ---------- */
.modal.classQuestion{width:min(1240px,100%)!important;padding:clamp(22px,3vw,44px)!important;border:0;border-radius:28px;position:relative;overflow:auto;box-shadow:0 40px 100px -20px #0008}
.modal.classQuestion::before{content:"";position:absolute;left:0;right:0;top:0;height:10px;background:var(--purple)}
.classQuestion>.row:first-child{align-items:center;flex-wrap:nowrap;gap:20px}
.classQuestion .eyebrow{font-size:12px;letter-spacing:.18em}
.classQuestion .activeTeam{color:var(--ink)!important;font-size:clamp(28px,3.6vw,52px);line-height:1.05;margin:4px 0 6px;letter-spacing:-.03em}
.classQuestion .timer{font-size:clamp(44px,5vw,76px);line-height:1;padding:14px 26px;min-width:clamp(130px,13vw,190px);border-radius:20px;background:#efebff;color:var(--purple)}
.classQuestion .timer.urgent{background:#ffe9ed;color:#d0304e;animation:timerPulse 1s ease-in-out infinite}
.classQuestion .timer.expired{font-size:clamp(26px,3vw,40px)}
.classQuestion .timer-caption{font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.classQuestion .timer-bar{height:12px;margin:18px 0 6px;background:#e6e2f3}
.classQuestion .timer-bar span{background:var(--purple)}
.classQuestion .question-text{font-size:clamp(30px,4.2vw,66px);line-height:1.15;letter-spacing:-.025em;font-weight:900;margin:clamp(18px,3vh,40px) 0;text-wrap:balance}

/* Options: big lettered cards */
.classQuestion .options{gap:14px;margin:0 0 22px}
.classQuestion .option{display:flex;align-items:center;gap:16px;padding:16px 20px;border:0;border-radius:18px;background:#f6f5fa;border:1px solid #e6e2f3;font-size:clamp(20px,2.3vw,34px);font-weight:700;line-height:1.2}
.classQuestion .optKey{flex:none;display:grid;place-items:center;width:1.7em;height:1.7em;border-radius:12px;color:#fff;font-size:.8em;font-weight:900;background:var(--purple)}

/* Answer, hint, judging */
.classQuestion .answer-box{border:0;border-radius:18px;background:linear-gradient(135deg,#e3f8ef,#d4f3ea);color:#0d5b43;font-size:clamp(26px,3vw,46px);padding:20px 24px}
.classQuestion .answer-box .tag{color:#12855f;margin-bottom:4px}
.classQuestion .hint-box{border-radius:16px;font-size:clamp(17px,1.8vw,24px)}
.classQuestion .judgeActions{gap:14px!important;margin-top:0}
.classQuestion .judgeActions>.btn{min-height:clamp(64px,9vh,92px);font-size:clamp(20px,2.2vw,32px);border-radius:18px;letter-spacing:.06em}
.classQuestion .judgeActions>[data-action="correct"]{background:#1caa79;border:0;color:#fff}
.classQuestion .judgeActions>[data-action="incorrect"]{background:#fff;color:#c23f59;border:2px solid #f0c4cf}
.classQuestion .judgeActions>[data-action="reveal"]{min-height:clamp(48px,6vh,60px);font-size:clamp(14px,1.4vw,18px);border-radius:14px}
.classQuestion .questionTools{margin-top:14px;background:transparent}

/* Result and surprise windows */
.modal .result .big{font-size:clamp(70px,10vw,140px);font-weight:900;letter-spacing:-.04em;color:var(--purple);animation:resultPop .5s cubic-bezier(.2,1.4,.4,1) both}
.modal .result .icon{width:96px;height:96px;border-radius:50%;font-size:56px;animation:resultPop .5s cubic-bezier(.2,1.4,.4,1) both}
.modal .result h2{font-size:clamp(34px,4vw,56px);letter-spacing:-.03em}
.modal .actions .btn.primary{min-height:56px;font-size:15px}
@keyframes resultPop{from{opacity:0;transform:scale(.6)}to{opacity:1;transform:none}}
@keyframes timerPulse{50%{transform:scale(1.06)}}

/* ---------- Small screens ---------- */
@media(max-width:900px){
  .classBoard .scores{grid-template-columns:repeat(3,minmax(0,1fr))}
  .classBoard>.row:first-child .eyebrow{font-size:11px}
}
@media(max-width:600px){
  body[data-board-view="board"] .wrap{padding:10px 10px 14px}
  .classBoard>.row:first-child{flex-wrap:wrap;gap:8px}
  .classBoard>.row:first-child>div:first-child{flex:1 1 100%}
  .classBoard .boardTeacher{width:100%}
  .turnRow{flex-wrap:wrap;gap:8px 12px}
  .turnRow .turn-pill{flex:1 1 100%;white-space:normal;font-size:22px}
  .classBoard .scores{grid-template-columns:repeat(2,minmax(0,1fr))}
  .classBoard .team-score{padding:10px 12px}
  .classBoard .points{font-size:34px}
  .classBoard .board{grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:minmax(58px,1fr)}
  .classBoard .tile{font-size:26px}
  .classQuestion>.row:first-child{flex-wrap:wrap}
  .classQuestion .options{grid-template-columns:1fr}
}
@media(prefers-reduced-motion:reduce){.classBoard .tile,.modal .result .big,.modal .result .icon,.classQuestion .timer.urgent{animation:none!important}}

/* ---------- Surprise effects: animated icon + "Team X loses points" headline ---------- */
.fxStage{--fx:var(--purple);position:relative;display:grid;place-items:center;width:clamp(120px,16vw,180px);height:clamp(120px,16vw,180px);margin:0 auto}
.fxStage.fx-g{--fx:#1caa79}.fxStage.fx-b{--fx:#d0304e}
.fxStage::before,.fxStage::after{content:"";position:absolute;inset:0;border-radius:50%;border:3px solid var(--fx);opacity:0;animation:fxRing 1.6s ease-out infinite}
.fxStage::after{animation-delay:.8s}
.fxStage .gameIcon{width:100%;height:100%;border-radius:50%;background:color-mix(in srgb,var(--fx) 12%,#fff);border:2px solid var(--fx);color:var(--fx);animation:fxPop .6s cubic-bezier(.2,1.5,.4,1) both,fxIdleG 2.4s ease-in-out .6s infinite}
.fxStage .gameIcon svg{width:58%;height:58%}
.fxStage.fx-b .gameIcon{animation:fxPop .6s cubic-bezier(.2,1.5,.4,1) both,fxShake .5s ease-in-out .6s 2}
.fxHeadline{font-size:clamp(28px,3.6vw,50px)!important;line-height:1.15!important;letter-spacing:-.025em;text-wrap:balance;margin:22px 0 22px!important;animation:fxRise .5s ease-out .25s both}
.fxTeam::before{content:"";display:inline-block;width:.5em;height:.5em;border-radius:50%;background:var(--team);margin-right:.35em;vertical-align:.06em}
@keyframes fxPop{from{opacity:0;transform:scale(.3) rotate(-12deg)}to{opacity:1;transform:none}}
@keyframes fxRing{0%{opacity:.55;transform:scale(.9)}100%{opacity:0;transform:scale(1.35)}}
@keyframes fxIdleG{50%{transform:translateY(-6px) scale(1.04)}}
@keyframes fxShake{20%{transform:translateX(-9px) rotate(-4deg)}40%{transform:translateX(9px) rotate(4deg)}60%{transform:translateX(-6px)}80%{transform:translateX(6px)}}
@keyframes fxRise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.fxStage::before,.fxStage::after,.fxStage .gameIcon,.fxHeadline{animation:none!important}}
