/* Shared classroom whiteboard timeline race. All rules scoped to the race overlay. */
#ctc-race-launch{background:#214b73;color:white;border:1px solid #18364f;font-weight:800;padding:8px 14px;min-height:36px;cursor:pointer}
#ctc-race-launch:hover{background:#163a60}
#ctc-race[hidden]{display:none!important}
html.ctc-race-open,html.ctc-race-open body{overflow:hidden!important}
#ctc-race{--r-ink:#192b38;--r-paper:#fffaf0;--r-line:#d6c3a1;position:fixed;inset:0;z-index:2147482000;box-sizing:border-box;width:100%;height:100%;height:100dvh;background:#192b38;color:#fff;font:16px/1.25 system-ui,-apple-system,'Segoe UI',sans-serif;overflow:hidden;display:flex;flex-direction:column;padding:7px;gap:6px;text-align:left;letter-spacing:normal}
#ctc-race *,#ctc-race *::before,#ctc-race *::after{box-sizing:border-box}
#ctc-race button{border:1px solid #f0e2c7;background:#fffaf0;color:#192b38;border-radius:4px;cursor:pointer;font:750 15px/1.05 system-ui,sans-serif;padding:7px 11px;min-height:40px;box-shadow:none;letter-spacing:normal;text-transform:none;white-space:normal}
#ctc-race button:disabled{opacity:.46;cursor:default}
#ctc-race button:focus-visible,#ctc-race .r-card:focus-visible{outline:3px solid #f4cc5f;outline-offset:2px}
#ctc-race [hidden]{display:none!important}
#ctc-race .r-primary{background:#a90d1d;color:#fff;border-color:#dfadb3}
#ctc-race .r-head{display:flex;align-items:center;gap:10px;min-height:0;flex:none;padding:1px 2px}
#ctc-race .r-brand{font-size:10px;color:#e5d1b0;font-weight:800;letter-spacing:.1em}
#ctc-race .r-title{font:700 clamp(17px,1.55vw,31px)/1.08 Georgia,serif;color:white;margin:0;overflow-wrap:anywhere}
#ctc-race .r-head-copy{flex:1;min-width:0}
#ctc-race .r-clock{flex:none;background:#0d1d29;border:1px solid #f5e6c966;padding:6px 12px;color:#fff;font:800 clamp(20px,2vw,32px)/1 system-ui;font-variant-numeric:tabular-nums;border-radius:5px}
#ctc-race .r-tools{display:flex;align-items:center;gap:5px;flex:none}
#ctc-race .r-status{flex:none;min-height:0;margin:0;background:#e7d7ba;color:#192b38;font:800 clamp(12px,1vw,18px)/1.18 system-ui;padding:5px 10px;border-radius:3px;overflow-wrap:anywhere}
#ctc-race .r-stage{min-height:0;min-width:0;flex:1;display:grid;grid-template-columns:repeat(var(--r-teams,2),minmax(0,1fr));gap:6px}
#ctc-race .r-team{--team:#245584;--team-light:#dceafb;display:flex;flex-direction:column;min-width:0;min-height:0;gap:4px;border:3px solid var(--team);border-radius:5px;background:#eae1ce;padding:4px;color:#192b38;position:relative}
#ctc-race .r-team-head{flex:none;display:flex;align-items:center;justify-content:space-between;gap:4px;background:var(--team);color:white;padding:4px 7px;border-radius:2px;min-width:0}
#ctc-race .r-team-head strong{font:900 clamp(15px,1.45vw,25px)/1.1 system-ui;color:white;min-width:0}
#ctc-race .r-team-head span{font-size:clamp(11px,.85vw,15px);font-weight:650;color:white;white-space:normal;text-align:right}
#ctc-race .r-grid{flex:1;min-height:0;min-width:0;display:grid;grid-template-columns:repeat(var(--r-cols,4),minmax(0,1fr));grid-template-rows:repeat(var(--r-rows,3),minmax(0,1fr));gap:4px;touch-action:none;user-select:none;-webkit-user-select:none}
#ctc-race .r-card{position:relative;display:flex;flex-direction:column;min-height:0;min-width:0;padding:3px;border:1px solid #a59b86;border-radius:3px;background:#fffaf0;overflow:hidden;touch-action:none;cursor:grab;user-select:none;-webkit-user-select:none;outline-offset:-2px}
#ctc-race .r-card.r-selected{outline:3px solid var(--team);background:var(--team-light)}
#ctc-race .r-card.r-target{outline:3px dashed var(--team);background:var(--team-light)}
#ctc-race .r-card.r-dragging{opacity:.52}
#ctc-race .r-num{position:absolute;top:3px;left:3px;z-index:1;padding:2px 4px;min-width:19px;line-height:1.05;background:var(--team);color:white;border-radius:2px;font:800 var(--r-number,12px)/1.1 system-ui;text-align:center}
#ctc-race .r-photo{display:block;flex:1 1 0;min-height:var(--r-photo-min,20px);height:0;width:100%;object-fit:contain;object-position:center;background:#e8e0d2;border:0;margin:0;pointer-events:none}
#ctc-race .r-copy{flex:0 0 auto;min-width:0;padding:3px 1px 0}
#ctc-race .r-card h3{margin:0;color:#192b38;font:700 var(--r-card-title,16px)/1.08 Georgia,serif;text-transform:none;letter-spacing:0;overflow-wrap:anywhere}
#ctc-race .r-clue{font:550 var(--r-card-clue,12px)/1.15 system-ui,sans-serif;margin:3px 0 0;color:#31434c;overflow-wrap:anywhere;white-space:normal}
#ctc-race.r-title-only .r-clue{display:none}
#ctc-race .r-date{font:800 var(--r-card-clue,12px)/1.08 system-ui;margin:3px 0 0;padding-top:2px;color:#74202b;border-top:1px solid #d6c3a1}
#ctc-race .r-team-foot{flex:none;display:flex;align-items:center;gap:5px;min-height:0}
#ctc-race .r-team-foot button{background:var(--team);color:white;border:0;min-height:clamp(34px,4.5vh,48px);flex:1;padding:5px;font-size:clamp(12px,1.05vw,18px)}
#ctc-race .r-team-foot button.r-clear{flex:none;width:auto;background:#fffaf0;color:#192b38;border:1px solid #9a927e;font-size:12px}
#ctc-race .r-team.r-winner{border-color:#e6bd46;box-shadow:0 0 0 3px #e6bd46 inset}
#ctc-race .r-team.r-winner .r-team-head{background:#326a38}
#ctc-race .r-ghost{position:fixed;z-index:4;margin:0;pointer-events:none;opacity:.9;transform:translate(-50%,-50%) rotate(2deg);box-shadow:0 4px 18px #0009;outline:3px solid #f4cc5f}
#ctc-race .r-ghost.r-card{position:fixed}
#ctc-race .r-setup{flex:1;min-height:0;overflow:auto;padding:10px 12px;display:flex;justify-content:center;align-items:center}
#ctc-race .r-setup-inner{width:min(1140px,100%);max-height:100%;color:#192b38;background:#fffaf0;border:2px solid #d6c3a1;border-top:6px solid #a90d1d;box-shadow:5px 7px 0 #08141c88;padding:clamp(16px,2.7vw,32px);border-radius:4px}
#ctc-race .r-setup h2{font:700 clamp(25px,3vw,48px)/1.08 Georgia,serif;margin:0 0 7px;color:#192b38}
#ctc-race .r-setup p{font:500 clamp(13px,1.1vw,19px)/1.35 system-ui;margin:6px 0 10px;color:#33434c}
#ctc-race .r-choice{display:flex;gap:8px;margin:8px 0 12px}
#ctc-race .r-choice button{flex:1;min-height:49px;background:#e8e1d2;font-size:clamp(15px,1.4vw,21px);border:2px solid #a89a83}
#ctc-race .r-choice button[aria-pressed="true"]{background:#192b38;color:white;border-color:#192b38}
#ctc-race .r-pads{display:grid;grid-template-columns:repeat(var(--r-teams,2),minmax(0,1fr));gap:8px;touch-action:none;user-select:none}
#ctc-race .r-pad{background:#245584;color:white;border:2px solid transparent;border-radius:5px;padding:10px;text-align:center;min-height:clamp(70px,13vh,130px);display:flex;align-items:center;justify-content:center;font-size:clamp(17px,2vw,30px);font-weight:800;touch-action:none;user-select:none}
#ctc-race .r-pad.r-held{border-color:white;box-shadow:0 0 0 4px #2c703f;filter:brightness(1.17)}
#ctc-race .r-test-copy{font-weight:800!important}
#ctc-race .r-start-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px;flex-wrap:wrap}
#ctc-race .r-start-row .r-primary{font-size:20px;min-height:50px;padding:10px 25px}
#ctc-race .r-overlay{position:absolute;inset:0;z-index:5;display:grid;place-items:center;background:#192b38ac;pointer-events:none}
#ctc-race .r-countdown{font:900 clamp(92px,21vw,280px)/1 system-ui;color:white;text-shadow:0 5px 0 #a90d1d,0 14px 25px #0008}
@media(max-width:1050px){#ctc-race .r-head{gap:5px}#ctc-race .r-tools{gap:3px}#ctc-race .r-tools button{padding:5px;font-size:12px;min-height:34px}#ctc-race .r-brand{font-size:9px}#ctc-race .r-team-head{padding:3px}#ctc-race .r-grid{gap:3px}#ctc-race .r-team{padding:3px;gap:3px;border-width:2px}}
@media(max-width:650px){#ctc-race .r-head{flex-wrap:wrap}#ctc-race .r-tools{flex:1 0 100%;justify-content:space-between}#ctc-race .r-setup{align-items:flex-start;padding:4px}#ctc-race .r-setup-inner{max-height:none;padding:14px}}
@media print{#ctc-race,#ctc-race-launch{display:none!important}}
#ctc-race .r-credit{font:12px/1.3 system-ui;color:#5a5a51;margin:10px 0 0}
#ctc-race .r-credit a{color:#74202b;text-decoration:underline}
#ctc-race .r-end-controls button{min-height:36px}

/* Immediate feedback in both timelines and whiteboard race mode. The tick
   remains visible independently of colour; correctly placed cards aren't locked. */
@media screen{
 #grid>.event.ctc-position-correct{background:#d9efcf!important;border-color:#36834b!important}
 #grid>.event.ctc-position-correct .number{background:#2f6a3a!important;color:#fff!important}
 #grid>.event.ctc-position-correct .number::after{content:" ✓";font-weight:900}
 #ctc-race .r-card.r-correct,#ctc-race .r-card.r-correct.r-selected,#ctc-race .r-card.r-correct.r-target{background:#d9efcf;border-color:#36834b}
 #ctc-race .r-card.r-correct .r-num{background:#2f6a3a;color:#fff}
 #ctc-race .r-card.r-correct .r-num::after{content:" ✓";font-weight:900}
 #ctc-race .r-volume{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:1px;flex:none;min-width:90px;width:clamp(90px,8vw,155px);min-height:40px;padding:2px 5px;background:#243b4c;color:#fff;border:1px solid #f5e6c955;border-radius:4px;touch-action:manipulation}
 #ctc-race .r-volume-label{font:750 11px/1.1 system-ui;text-align:center;white-space:nowrap;color:white}
 #ctc-race input.r-volume-slider{display:block;width:100%;margin:0;padding:0;min-height:25px;cursor:pointer;accent-color:#f3cc62;touch-action:none}
 #ctc-race input.r-volume-slider:focus-visible{outline:2px solid #f4cc5f;outline-offset:1px}
 @media(max-width:1150px){#ctc-race .r-tools{gap:3px;flex-wrap:wrap;max-width:76%;justify-content:flex-end}#ctc-race .r-volume{width:88px;min-width:88px;padding:1px 3px}}
 @media(max-width:650px){#ctc-race .r-tools{max-width:100%;justify-content:space-between}}
}

/* Independent difficulty controls. Setup can show both choices on a whiteboard
   without using another full-height row. */
@media screen{
 .ctc-solo-difficulty{display:inline-flex;align-items:center;gap:5px;font:750 13px/1.15 system-ui;color:inherit;white-space:nowrap}
 .ctc-solo-difficulty select{min-height:36px;padding:5px 7px;border:1px solid #192b38;border-radius:4px;background:#fffaf0;color:#192b38;font:750 13px/1.1 system-ui}
 body.board-mode.ctc-fit .ctc-solo-difficulty select{min-height:var(--ctc-fit-control,34px)}
 #ctc-race .r-setup-options{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.6fr);gap:12px}
 #ctc-race .r-option-group h3{font:800 13px/1.2 system-ui;text-transform:uppercase;letter-spacing:.07em;margin:4px 0;color:#33434c}
 #ctc-race .r-option-group .r-choice{margin:4px 0 3px}
 #ctc-race .r-mode-description{font-weight:750;color:#2f6a3a}
 @media(max-width:700px){#ctc-race .r-setup-options{grid-template-columns:1fr;gap:5px}}
}
@media print{.ctc-solo-difficulty{display:none!important}}

/* The chosen colours are tied to the lane, not the display order. Text remains
   legible on yellow, and the actual correct-position tick is independent. */
@media screen{
 #ctc-race [data-color="green"]{--team:#2f6a3a;--team-light:#dcead9;--team-text:#fff;--team-stroke:#224d2a}
 #ctc-race [data-color="red"]{--team:#9d2831;--team-light:#f9dfe1;--team-text:#fff;--team-stroke:#7f1b23}
 #ctc-race [data-color="blue"]{--team:#245584;--team-light:#dceafb;--team-text:#fff;--team-stroke:#173c60}
 #ctc-race [data-color="yellow"]{--team:#e6be35;--team-light:#fff0c2;--team-text:#192b38;--team-stroke:#8c6a13}
 #ctc-race .r-team{border-color:var(--team-stroke,var(--team))}
 #ctc-race .r-team-head,#ctc-race .r-team-head strong,#ctc-race .r-team-head span{color:var(--team-text,#fff)}
 #ctc-race .r-num,#ctc-race .r-team-foot button:not(.r-clear){color:var(--team-text,#fff)}
 #ctc-race .r-team.r-winner .r-team-head{background:var(--team);color:var(--team-text,#fff)}
 #ctc-race .r-card.r-selected:not(.r-correct),#ctc-race .r-card.r-target:not(.r-correct){background:#fff1ce;outline-color:#a06917}
 #ctc-race .r-pad{background:var(--team);color:var(--team-text,#fff)}
 #ctc-race .r-pad.r-held{box-shadow:0 0 0 4px #2c703f}
 #ctc-race .r-setup-lane{min-width:0;display:flex;flex-direction:column;gap:5px}
 #ctc-race .r-colour-label{font:750 12px/1.2 system-ui;color:#33434c;text-align:center}
 #ctc-race .r-colour-choices{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
 #ctc-race button.r-colour-option{background:var(--team);color:var(--team-text,#fff);border:2px solid var(--team-stroke,var(--team));font:800 clamp(11px,1vw,15px)/1.1 system-ui;padding:5px 2px;min-height:39px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 #ctc-race button.r-colour-option[aria-pressed="true"]{outline:3px solid #192b38;outline-offset:1px;box-shadow:inset 0 0 0 2px #fffaf0}
 #ctc-race button.r-colour-option:disabled{opacity:.28;cursor:not-allowed}
 #ctc-race button.r-colour-option:focus-visible{outline:3px solid #192b38;outline-offset:2px}
 @media(max-width:1100px){#ctc-race .r-colour-choices{grid-template-columns:repeat(2,minmax(0,1fr))}#ctc-race button.r-colour-option{min-height:32px}#ctc-race .r-pad{min-height:62px}}
 @media(max-height:760px) and (min-width:651px){#ctc-race .r-setup-inner{padding:12px 18px}#ctc-race .r-setup h2{font-size:clamp(24px,2.8vw,36px)}#ctc-race .r-setup p{margin:4px 0 7px;font-size:clamp(12px,1.1vw,16px)}#ctc-race .r-choice button{min-height:39px}#ctc-race .r-pad{min-height:65px}#ctc-race .r-start-row{margin-top:8px}}
}

/* Small-screen team selector. One full-width board is shown at a time.
   Desktop lanes and the multi-pointer whiteboard layout remain unchanged. */
#ctc-race .r-team-tabs[hidden]{display:none!important}
#ctc-race .r-team-tabs{display:flex;gap:5px;flex:none;flex-wrap:wrap}
#ctc-race .r-team-tab{flex:1 1 0;background:var(--team,#245584);color:var(--team-text,#fff);border:2px solid var(--team-stroke,#173c60);min-height:40px;font-size:13px;padding:5px}
#ctc-race .r-team-tab[aria-pressed=true]{outline:2px solid #fffaf0;outline-offset:-4px;box-shadow:0 0 0 1px #fffaf0}
#ctc-race .r-phone-note{display:none}
#ctc-race.r-compact .r-phone-note{display:block;color:#235238;font-weight:750}
#ctc-race.r-compact{height:100%;height:100dvh;max-height:100dvh;padding:7px;gap:5px;overflow:hidden}
#ctc-race.r-compact .r-head{flex-wrap:wrap;align-items:center;gap:4px}
#ctc-race.r-compact .r-head-copy{flex:1;min-width:0}
#ctc-race.r-compact .r-title{font-size:clamp(16px,4vw,23px)}
#ctc-race.r-compact .r-clock{font-size:20px;padding:5px 8px}
#ctc-race.r-compact .r-tools{flex:0 0 100%;max-width:100%;justify-content:flex-start;flex-wrap:wrap;gap:4px}
#ctc-race.r-compact .r-tools button{min-height:34px;font-size:12px;padding:5px 8px}
#ctc-race.r-compact .r-status{font-size:12px;line-height:1.25;padding:5px 8px}
#ctc-race.r-compact .r-setup{display:block!important;position:relative!important;overflow:auto!important;padding:4px!important;min-height:0;overscroll-behavior:contain}
#ctc-race.r-compact .r-setup[hidden]{display:none!important}
#ctc-race.r-compact .r-setup-inner{position:relative!important;top:auto!important;left:auto!important;transform:none!important;width:100%!important;max-height:none!important;margin:0!important;padding:12px!important}
#ctc-race.r-compact .r-setup-options{grid-template-columns:1fr;gap:6px}
#ctc-race.r-compact .r-setup p{font-size:14px;line-height:1.4}
#ctc-race.r-compact .r-pads{grid-template-columns:repeat(2,minmax(0,1fr));touch-action:pan-y}
#ctc-race.r-compact .r-pad{min-height:56px;font-size:16px}
#ctc-race.r-compact .r-colour-choices{grid-template-columns:repeat(2,minmax(0,1fr))}
#ctc-race.r-compact .r-colour-option{min-height:36px}
#ctc-race.r-compact .r-start-row .r-primary{width:100%;min-height:48px;font-size:18px}
#ctc-race.r-compact .r-stage{display:block!important;overflow:auto!important;overscroll-behavior:contain;touch-action:pan-y;min-height:0}
#ctc-race.r-compact .r-stage[hidden],#ctc-race.r-compact .r-team[hidden]{display:none!important}
#ctc-race.r-compact .r-team{min-height:100%;height:auto;overflow:visible;padding:6px;gap:6px}
#ctc-race.r-compact .r-team-head{padding:8px;gap:8px}
#ctc-race.r-compact .r-team-head strong{font-size:17px}
#ctc-race.r-compact .r-team-head span{font-size:13px}
#ctc-race.r-compact .r-grid{flex:0 0 auto;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:auto;gap:6px;touch-action:pan-y}
#ctc-race.r-compact .r-card{min-height:120px;overflow:visible;touch-action:pan-y;cursor:pointer;padding:5px;gap:4px}
#ctc-race.r-compact .r-card .r-photo{flex:none;height:75px;width:100%;min-height:0;object-fit:contain}
#ctc-race.r-compact .r-card h3{font:700 16px/1.2 Georgia,serif}
#ctc-race.r-compact .r-clue,#ctc-race.r-compact .r-date{font-size:12px;line-height:1.25}
#ctc-race.r-compact .r-num{font-size:12px}
#ctc-race.r-compact .r-team-foot{position:sticky;bottom:0;background:#eae1ce;padding:5px;z-index:2}
#ctc-race.r-compact .r-team-foot button{min-height:44px;font-size:13px}
#ctc-race.r-compact .r-end-controls{flex-wrap:wrap}
@media(max-height:460px){#ctc-race.r-compact .r-tools .r-volume{display:none}#ctc-race.r-compact .r-title{font-size:16px}}

#ctc-race.r-compact .r-start-row{position:sticky;bottom:0;background:#fffaf0;border-top:1px solid #d6c3a1;padding:7px 0;z-index:3}
