/* Spelling Range, adapted from lab 16/17: child colours, target corners,
   mastery pips and large, thumb-friendly marking controls. */
.sp-phone { background-color: #080e0c; }
.sp-app { --sp-colour: #38bdf8; max-width: 620px; margin: auto; padding: 22px 20px 50px; }
.sp-app button, .sp-app input, .sp-app select, .sp-app textarea { font: inherit; }
.sp-app button { min-height: 44px; border: 1px solid #345348; border-radius: 12px; padding: 10px 16px; background: #101d17; color: #d9eee5; cursor: pointer; font-weight: 600; font-size: 17px; touch-action: manipulation; }
.sp-app button:active { transform: scale(.97); }
.sp-app button:disabled { opacity: .45; cursor: default; }
.sp-app button:focus-visible, .sp-app a:focus-visible, .sp-app input:focus-visible, .sp-app select:focus-visible, .sp-app textarea:focus-visible { outline: 2px solid var(--sp-colour); outline-offset: 3px; }
.sp-app [hidden] { display: none !important; }
.sp-top, .sp-title-row, .sp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sp-top a { color: #acc9bd; text-decoration: none; font-size: 18px; }
.sp-eyebrow { color: #8faa9d; font: 11px/1.5 'Share Tech Mono', monospace; letter-spacing: .14em; text-transform: uppercase; }
.sp-title-row { margin: 22px 0; }
.sp-title-row h1 { font-size: 36px; line-height: 1; color: var(--sp-colour); }
.sp-range-mark { font: 42px 'Share Tech Mono', monospace; color: var(--sp-colour); }
.sp-chips { display: flex; gap: 8px; padding: 4px 0 14px; overflow-x: auto; }
.sp-chips button { flex: 1 0 auto; border-radius: 28px; color: var(--cc); border-color: var(--cc); font-size: 20px; }
.sp-chips button[aria-pressed="true"] { background: var(--cc); color: #07120d; box-shadow: 0 6px 22px #0005; }
.sp-chips small { display: block; font: 11px 'Share Tech Mono', monospace; margin-top: 3px; }
#sp-message { margin: 4px 0 14px; color: #ffd166; font-size: 17px; }
#sp-message:empty { display: none; }
.sp-card { position: relative; padding: 24px; border: 1px solid #284739; border-radius: 20px; background: linear-gradient(145deg, #14221b, #0b130f); margin: 16px 0; }
.sp-card::before { content: ''; position: absolute; left: 10px; top: 10px; width: 18px; height: 18px; border-left: 2px solid var(--sp-colour); border-top: 2px solid var(--sp-colour); pointer-events: none; }
.sp-card h2 { font-size: 29px; line-height: 1.15; overflow-wrap: anywhere; margin: 8px 0; }
.sp-muted { color: #9cb3a7; font-size: 16px; line-height: 1.5; }
.sp-empty { padding: 30px 0; font-size: 22px; color: #b7cbbf; }
.sp-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.sp-buttons > * { flex: 1; }
.sp-app button.sp-primary { background: var(--sp-colour); color: #07130e; border-color: var(--sp-colour); }
.sp-app button.sp-hit { background: #22c55e; border-color: #22c55e; color: #07130e; }
.sp-app button.sp-miss { background: #392819; border-color: #b88638; color: #ffd166; }
.sp-app .sp-marking button { min-height: 82px; font-size: 25px; }
.sp-app label { display: block; font-size: 18px; margin: 16px 0 8px; color: #c1d6ca; }
.sp-app input, .sp-app textarea, .sp-app select { width: 100%; background: #08110c; border: 1px solid #385247; border-radius: 10px; padding: 12px; color: #e2f6ea; font-size: 18px; }
.sp-app textarea { min-height: 280px; resize: vertical; line-height: 1.6; }
.sp-schedule { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0; }
.sp-schedule label { margin: 0; }
.sp-schedule select { width: auto; }
.sp-word-wall { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.sp-word-tile { border: 1px solid #273b31; border-radius: 12px; padding: 12px; background: #102017; }
.sp-word-tile b { display: block; overflow-wrap: anywhere; font-size: 21px; }
.sp-word-tile small { display: block; color: #91ad9c; margin-top: 4px; }
.sp-pips { display: inline-flex; gap: 4px; }
.sp-pips i { width: 8px; height: 8px; background: #304339; border-radius: 2px; }
.sp-pips i.on { background: var(--sp-colour); box-shadow: 0 0 6px #ffffff20; }
.sp-word { font-size: clamp(36px, 10vw, 64px); line-height: 1.12; color: #f1fff7; overflow-wrap: anywhere; font-weight: 700; }
.sp-question { min-height: 240px; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 18px; }
.sp-question .sp-sentence { font-size: 21px; color: #b8d0c2; line-height: 1.4; overflow-wrap: anywhere; }
.sp-progress { display: flex; gap: 4px; margin: 18px 0; }
.sp-progress i { flex: 1; height: 7px; background: #2c4034; border-radius: 2px; }
.sp-progress .hit { background: #22c55e; }
.sp-progress .miss { background: #ffba57; }
.sp-progress .skip { background: #91a4b5; }
.sp-score { font: 68px 'Share Tech Mono', monospace; color: var(--sp-colour); }
.sp-score small { color: #8aa999; font-size: 28px; }
.sp-history { display: flex; align-items: end; gap: 10px; height: 120px; margin: 16px 0 26px; }
.sp-history > div { flex: 1; display: flex; height: 100%; flex-direction: column; justify-content: end; text-align: center; }
.sp-history i { display: block; background: var(--sp-colour); opacity: .65; min-height: 2px; border-radius: 4px 4px 0 0; }
.sp-history small { color: #a5b9ad; font-size: 12px; }
.sp-archive { display: block; width: 100%; text-align: left; margin: 10px 0; }
.sp-archive small { display: block; font-size: 14px; color: #9eb5a7; }
.sp-tv-controls { margin-top: 30px; border-top: 1px solid #2c4437; padding-top: 20px; }
.sp-tv-controls button { font-size: 15px; }
.sp-tiles, .sp-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 16px 0; min-height: 50px; }
.sp-tiles button, .sp-slots button { font: 24px 'Share Tech Mono', monospace; padding: 8px; width: 44px; }
.sp-slots button { border-color: var(--sp-colour); color: var(--sp-colour); }
.sp-feedback { font-size: 23px; color: var(--sp-colour); text-align: center; margin: 16px 0; }
.sp-result-word { padding: 9px 0; border-bottom: 1px solid #21382a; display: flex; justify-content: space-between; gap: 10px; font-size: 20px; }
.sp-result-word span { overflow-wrap: anywhere; }
.sp-result-word small { color: #adc5b5; white-space: nowrap; }
.sp-app [aria-busy="true"] { opacity: .7; }

/* The paired TV uses the same visual vocabulary, without a simulated phone. */
.sp-tv { --sp-colour: #14fdce; color: #e4f5eb; background: #050d09; font-family: 'Rajdhani', sans-serif; }
#spelling-takeover { position: fixed; inset: 0; z-index: 900; padding: 4vh 4vw; display: none; }
#spelling-takeover.sp-visible { display: block; }
#screen-spelling { padding: 2vh 3vw; }
.sp-tv .sp-tv-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #345242; padding-bottom: 1.5vh; margin-bottom: 2vh; }
.sp-tv h1 { font-size: 4.6vh; color: #14fdce; }
.sp-tv .sp-eyebrow { font-size: 1.5vh; }
.sp-tv .sp-tv-columns { display: flex; gap: 2vw; height: 70vh; }
.sp-tv .sp-tv-column { flex: 1; min-width: 0; border-top: 3px solid var(--sp-colour); padding: 1.5vh 1vw; display: flex; flex-direction: column; }
.sp-tv .sp-tv-column h2 { font-size: 4vh; color: var(--sp-colour); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-tv .sp-muted { font-size: 2vh; }
.sp-tv .sp-word-wall { gap: 1vh; flex: 1; min-height: 0; grid-auto-rows: minmax(0, 1fr); }
.sp-tv .sp-word-tile { padding: 1.1vh 1vw; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.sp-tv .sp-word-tile b { font-size: var(--sp-word-size, 3vh); line-height: 1.2; margin-bottom: .8vh; }
.sp-tv .sp-word-tile small { font-size: 1.5vh; }
.sp-tv .sp-word-tile .sp-pips i { width: .65vw; height: .65vw; }
.sp-tv .sp-test-stage { margin: 3vh auto; max-width: 85vw; text-align: center; }
.sp-tv .sp-test-stage h2 { font-size: 5vh; color: var(--sp-colour); }
.sp-tv .sp-word { font-size: clamp(40px, 9vh, 110px); margin: 4vh 0; }
.sp-tv .sp-reticle { width: 16vh; height: 16vh; margin: 4vh auto; border: 2px solid var(--sp-colour); border-radius: 50%; display: grid; place-items: center; color: var(--sp-colour); font: 9vh 'Share Tech Mono', monospace; box-shadow: 0 0 0 2vh #14fdce06, 0 0 0 4vh #14fdce04; }
.sp-tv .sp-score { font-size: 18vh; }
.sp-tv .sp-score small { font-size: 6vh; }
.sp-tv .sp-sentence { font-size: 3vh; }
.sp-tv .sp-history { height: 30vh; }
.sp-tv .sp-history small { font-size: 1.7vh; }
.sp-tv .sp-result-word { font-size: 2.6vh; }
.sp-tv .sp-tv-footer { position: absolute; bottom: 2vh; left: 4vw; right: 4vw; display: flex; justify-content: space-between; color: #8ead9b; font: 1.5vh 'Share Tech Mono', monospace; }
.sp-tv .sp-stale { color: #ffd166; text-align: center; font-size: 2vh; }
@media (prefers-reduced-motion: reduce) { .sp-app button:active { transform: none; } }
