@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@600;700;800;900&display=swap');

:root {
  color-scheme: light;
  --ink: #2b203d;
  --orange: #ff6844;
  --yellow: #ffe34d;
  --pink: #ffa9d0;
  --lime: #c7ef77;
  --blue: #9db4ff;
  --teal: #75e0d5;
  --paper: #fffaf1;
  --background: var(--orange);
  --border: 2.5px solid var(--ink);
  font-family: 'Nunito', 'Trebuchet MS', sans-serif;
  font-weight: 700;
  font-synthesis: none;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; background: var(--background); transition: background-color .32s ease; -webkit-tap-highlight-color: transparent; }
body[data-scene="setup"] { --background: #ffe776; }
body[data-scene="handoff"] { --background: #a8c2ff; }
body[data-scene="place"] { --background: #80ded5; }
body[data-scene="solve"] { --background: #ffa9d0; }
body[data-scene="verify"] { --background: #ffbf80; }
body[data-scene="success"] { --background: #c7ef77; }
body[data-scene="failure"] { --background: #c7b1f1; }
body[data-scene="winner"] { --background: #ff6844; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .45; }
button, input, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--ink); outline-offset: 5px; }
button:focus:not(:focus-visible) { outline: none; }
button svg { flex-shrink: 0; }
h1,h2,h3,p { margin: 0; }
h1,h2,h3 { font-family: 'Fredoka', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif; font-weight: 600; letter-spacing: -.025em; line-height: 1.08; }
p { line-height: 1.5; }
.icon { width: 1.4rem; height: 1.4rem; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.ambient { position: fixed; inset: 0; background-image: radial-gradient(var(--ink) .7px, transparent .7px); background-size: 20px 20px; opacity: .10; z-index: -1; pointer-events: none; }
.app-shell { width: min(100%, 920px); margin: auto; padding: max(16px,env(safe-area-inset-top)) 24px max(20px,env(safe-area-inset-bottom)); min-height: 100svh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; width: 100%; }
.top-tools { display: flex; align-items: center; gap: 6px; }
.icon-button { border: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; width: 44px; height: 44px; border-radius: 50%; transition: background .15s, transform .15s; }
.icon-button:hover { background: #ffffff40; }
.icon-button:active { transform: scale(.94); }
.studio { width: 152px; max-width: calc(100% - 156px); flex-shrink: 0; }
.studio img { display: block; width: 100%; height: auto; }
.home-return { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 10px 4px 0; background: transparent; border: 0; border-radius: 10px; text-align: left; }
.home-return > .icon { width: 24px; height: 24px; }
.home-return > span { font-size: 1rem; font-weight: 900; line-height: 1.15; }
.home-return small { display: block; margin-top: 3px; font-family: 'Fredoka','Trebuchet MS',sans-serif; font-size: .75rem; letter-spacing: .04em; }
.home-return:hover { background: #ffffff40; }
.screen { width: min(100%,520px); margin: 0 auto; position: relative; animation: enter .27s ease both; }
.eyebrow { font-weight: 900; letter-spacing: .09em; font-size: .75rem; line-height: 1.5; text-transform: uppercase; }
.button { border: var(--border); border-radius: 20px; padding: 16px 22px; background: var(--paper); min-height: 60px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 900; font-size: 1.15rem; box-shadow: 0 5px 0 var(--ink); transition: transform .12s, box-shadow .12s, background .12s; text-decoration: none; line-height: 1.25; }
.button:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.button.primary { background: var(--yellow); }
.button.secondary { background: var(--paper); }
.button.big { width: 100%; font-family: 'Fredoka','Trebuchet MS',sans-serif; font-weight: 600; font-size: 1.5rem; min-height: 68px; }
.button.big .icon { width: 1.55rem; height: 1.55rem; }
.text-button { border: 0; background: transparent; padding: 14px 12px; font-size: 1rem; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; min-height: 44px; }
.text-button:hover { text-decoration-thickness: 2px; }
.text-button.subtle { font-size: .875rem; }
.home { width: min(100%,650px); min-height: calc(100svh - 100px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 36px 0 6px; }
.home-title { position: relative; width: 100%; padding: 24px 0 32px; }
.wordmark { display: flex; justify-content: center; align-items: center; gap: 4px; font-size: clamp(2.25rem,8vw,4.9rem); position: relative; isolation: isolate; }
.logo-tile { display: inline-flex; justify-content: center; align-items: center; width: 1.13em; height: 1.3em; background: var(--tile); border: 2.5px solid var(--ink); border-radius: .19em; box-shadow: 0 .09em 0 var(--ink); transform: rotate(var(--tilt)); animation: logo-in .6s cubic-bezier(.2,.9,.3,1.25) both; animation-delay: calc(var(--i)*.07s); font-weight: 700; position: relative; }
.logo-tile:nth-child(3) { z-index: 2; }
.placement-hints { display: flex; justify-content: space-between; width: 82%; margin: 24px auto 0; }
.placement-hints span { display: inline-flex; align-items: center; gap: 7px; font-family: 'Fredoka','Trebuchet MS',sans-serif; font-size: 1.05rem; border: 2px solid var(--ink); border-radius: 100px; padding: 5px 13px; background: #ffffff45; transform: rotate(-6deg); }
.placement-hints span:last-child { transform: rotate(6deg); }
.placement-hints .icon { width: 18px; height: 18px; }
.home-intro h2 { font-size: clamp(1.65rem,5.9vw,2.35rem); line-height: 1.12; margin: 2px 0 16px; }
.home-intro p { font-size: 1rem; line-height: 1.55; }
.home-intro strong { font-weight: 900; }
.home-actions { width: min(100%,340px); margin: 30px auto 16px; display: flex; flex-direction: column; }
.home-actions .text-button { margin-top: 11px; }
.game-facts { display: flex; align-items: center; justify-content: center; gap: 20px; font-size: .875rem; padding: 5px 0 8px; }
.game-facts span { display: flex; gap: 6px; align-items: center; }
.game-facts .icon { width: 18px; height: 18px; }
.screen-heading { text-align: center; padding: 0 4px; }
.screen-heading h1 { font-size: clamp(2.2rem,8vw,3.25rem); margin: 8px 0 12px; overflow-wrap: anywhere; }
.screen-heading p:not(.eyebrow) { font-size: 1rem; }
.setup { padding: 34px 0 26px; }
.setup .screen-heading { margin-bottom: 28px; }
.player-inputs { display: flex; flex-direction: column; gap: 12px; }
.name-row { position: relative; display: flex; align-items: center; border: var(--border); border-radius: 16px; background: var(--paper); min-height: 60px; box-shadow: 0 3px 0 var(--ink); padding: 6px 9px; gap: 10px; }
.name-number { flex-shrink: 0; width: 34px; height: 34px; background: var(--avatar); border-radius: 11px; display: flex; align-items: center; justify-content: center; font-weight: 900; border: 1.5px solid var(--ink); transform: rotate(-5deg); }
.name-row input { flex: 1; min-width: 0; background: transparent; border: 0; padding: 7px 2px; width: 100%; font-size: 1.125rem; font-weight: 800; border-radius: 5px; }
.name-row input::placeholder { color: #776b83; opacity: 1; font-weight: 700; }
.remove-player { flex-shrink: 0; background: transparent; border: 0; width: 40px; height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.remove-player:hover { background: #ff684422; }
.remove-player .icon { width: 18px; height: 18px; }
.add-player { width: 100%; margin: 17px 0 28px; border: 2px dashed #2b203d70; border-radius: 14px; padding: 13px; min-height: 50px; background: transparent; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; }
.add-player:hover { background: #ffffff40; }
.timer-choice { padding: 0; margin: 4px 0 24px; border: 0; text-align: center; }
.timer-choice legend { width: 100%; margin-bottom: 12px; font-weight: 900; }
.timer-options { display: flex; gap: 10px; }
.timer-options label { flex: 1; position: relative; cursor: pointer; }
.timer-options input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.timer-options span { display: block; padding: 13px 6px; border: 2px solid var(--ink); border-radius: 14px; background: var(--paper); font-family: 'Fredoka','Trebuchet MS',sans-serif; font-size: 1.7rem; box-shadow: 0 3px 0 var(--ink); }
.timer-options small { font-family: inherit; font-size: 1rem; }
.timer-options input:checked + span { background: var(--yellow); transform: translateY(-2px); box-shadow: 0 5px 0 var(--ink); }
.timer-options input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 4px; }
.timer-choice p { margin-top: 12px; font-size: .8rem; }
.form-error { color: #821f21; font-size: .875rem; min-height: 14px; margin: 14px 0 10px; }
.game-screen { min-height: calc(100svh - 100px); display: flex; flex-direction: column; align-items: center; padding: 20px 0 10px; text-align: center; }
.game-hud { display: grid; grid-template-columns: 1fr auto; width: 100%; align-items: center; gap: 10px; text-align: left; }
.round-label { font-size: .875rem; font-weight: 900; white-space: nowrap; }
.players-count { display: flex; align-items: center; gap: 5px; border: 0; background: #fffaf150; padding: 7px 11px; min-height: 36px; border-radius: 100px; font-size: .8rem; }
.players-count .icon { width: 18px; height: 18px; }
.handoff-person { margin: auto 0 30px; padding-top: 28px; }
.avatar { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; border: 1.5px solid var(--ink); font-family: 'Fredoka','Trebuchet MS',sans-serif; font-size: 1.05rem; font-weight: 600; background: var(--avatar); }
.avatar-large { width: 88px; height: 88px; font-size: 3.2rem; border: var(--border); border-radius: 24px; box-shadow: 0 5px 0 var(--ink); transform: rotate(-7deg); margin-bottom: 25px; }
.handoff-person .eyebrow { margin-bottom: 5px; }
.player-name { font-size: clamp(2rem,10vw,3.8rem); max-width: 100%; overflow-wrap: anywhere; }
.board-block { width: 100%; container-type: inline-size; }
.board-block > .eyebrow { margin-bottom: 15px; font-size: .75rem; }
.letter-rack { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 12px 0 15px; width: 100%; min-height: 78px; }
.placed-tile { display: inline-flex; align-items: center; justify-content: center; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 0 4px 0 var(--ink); font-family: 'Fredoka','Trebuchet MS',sans-serif; font-weight: 600; width: min(52px, calc((100% - (var(--count) - 1) * 5px) / var(--count))); aspect-ratio: .79; font-size: clamp(1rem,calc((100vw - 100px)/var(--count) * .67),2rem); flex-shrink: 0; }
.placement-rack { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 0 23px; }
.placement-rack .letter-rack { flex: 1; min-width: 0; width: auto; gap: 2px; }
.placement-rack .placed-tile { width: min(52px,calc((100% - (var(--count) - 1)*2px)/var(--count))); min-height: 40px; border-width: 1.5px; border-radius: 7px; font-size: clamp(.875rem,calc((100vw - 165px)/var(--count)*.66),2rem); }
.drop-zone { position: relative; display: flex; align-items: center; justify-content: center; width: 52px; height: 68px; flex-shrink: 0; padding: 0; border: 2.5px dashed var(--ink); border-radius: 12px; background: #fffaf144; transition: background .12s, transform .12s; }
.drop-plus .icon { width: 23px; height: 23px; opacity: .7; }
.drop-preview { display: none; font-family: 'Fredoka','Trebuchet MS',sans-serif; font-weight: 600; font-size: 2rem; }
.drop-caption { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); font-size: .625rem; font-weight: 900; letter-spacing: .045em; white-space: nowrap; }
.drop-zone:hover, .drop-zone.is-over { background: var(--yellow); }
.drop-zone.before:hover, .drop-zone.before.is-over { background: var(--pink); }
.drop-zone.is-over { transform: scale(1.07); box-shadow: 0 4px 0 var(--ink); }
.drop-zone.is-over .drop-plus { display: none; }
.drop-zone.is-over .drop-preview { display: block; }
.bottom-action { width: 100%; margin-top: auto; padding-top: 27px; }
.bottom-action > p { font-size: .875rem; margin-top: 16px; }
.bottom-action .text-button { margin-top: 10px; }
.turn-heading { margin: 29px 0 24px; width: 100%; }
.turn-heading > .eyebrow { font-size: .875rem; letter-spacing: .05em; }
.turn-heading h1 { font-size: clamp(2rem,7.4vw,2.85rem); margin-top: 9px; overflow-wrap: anywhere; }
.inline-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--avatar); border: 1px solid var(--ink); margin-right: 3px; }
.incoming { margin: auto 0; padding: 23px 0 25px; }
.incoming > p { margin-bottom: 12px; }
.incoming-tile { font-family: 'Fredoka','Trebuchet MS',sans-serif; font-weight: 600; display: flex; align-items: center; justify-content: center; width: 122px; height: 140px; font-size: 6.1rem; background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 8px 0 var(--ink); border-radius: 24px; transform: none; animation: letter-in .4s cubic-bezier(.2,.8,.3,1.2) both; }
.drag-letter { cursor: grab; padding: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.drag-letter.is-dragging { opacity: .22; }
.drag-ghost { position: fixed; left: 0; top: 0; margin: 0; z-index: 1000; pointer-events: none; animation: none; transition: none; will-change: transform; }
.letter-is-dragging, .letter-is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.drag-instruction { width: 100%; font-size: .875rem; font-weight: 800; padding: 8px 0 4px; }
.solve .turn-heading { margin-bottom: 12px; }
.timer { position: relative; width: 166px; height: 166px; margin: auto 0 16px; flex-shrink: 0; }
.timer svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.timer circle { fill: none; stroke-width: 10px; }
.timer-track { stroke: #fffaf17a; }
.timer-progress { stroke: var(--ink); stroke-dasharray: 439.823; stroke-dashoffset: 0; stroke-linecap: round; }
.timer > div { display: flex; flex-direction: column; align-items: center; justify-content: center; position: absolute; inset: 0; }
.timer strong { font-family: 'Fredoka','Trebuchet MS',sans-serif; font-weight: 600; font-size: 4.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.timer span { font-size: .875rem; margin-top: 1px; }
.timer.urgent .timer-progress { stroke: #a52832; }
.timer.urgent strong { color: #a52832; animation: countdown-pulse 1s ease infinite; }
.solve .bottom-action { padding-top: 12px; }
.solve .bottom-action .answer-instruction { font-size: 1rem; margin: 0 0 16px; }
.result-symbol { width: 84px; height: 84px; border-radius: 24px; display: flex; align-items: center; justify-content: center; margin: 26px auto 25px; background: var(--yellow); border: var(--border); transform: rotate(-6deg); box-shadow: 0 5px 0 var(--ink); }
.result-symbol .icon { width: 42px; height: 42px; stroke-width: 1.8; }
.result-symbol.bad { background: var(--pink); }
.verify .screen-heading h1 { font-size: clamp(1.8rem,7.5vw,2.7rem); }
.verify .screen-heading p { font-size: .875rem; }
.solution-block { width: 100%; background: var(--paper); border: var(--border); box-shadow: 0 5px 0 var(--ink); border-radius: 22px; padding: 21px 12px; margin: 26px 0; }
.solution-block .eyebrow { font-size: .75rem; }
.solution-word { font-family: 'Fredoka','Trebuchet MS',sans-serif; font-weight: 600; font-size: clamp(1.55rem,calc((100vw - 96px)/var(--letters) * 1.2),2.75rem); line-height: 1.15; margin-top: 9px; overflow-wrap: anywhere; }
.verify-hint { font-size: .875rem; max-width: 320px; }
.judge-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; width: 100%; margin-top: auto; padding-top: 28px; }
.judge-buttons .button { padding: 15px 9px; font-size: 1rem; }
.result { justify-content: center; }
.result .result-symbol { margin-top: 35px; }
.result .screen-heading h1 { font-size: clamp(2rem,8vw,3rem); }
.survivors { width: 100%; margin: 3px 0 10px; }
.survivors > p { margin-bottom: 12px; }
.roster { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px; }
.roster-player { display: inline-flex; align-items: center; gap: 6px; border-radius: 100px; font-size: .875rem; background: #fffaf155; padding: 5px 11px 5px 5px; max-width: 100%; text-align: left; }
.roster-player > span:not(.avatar):not(.sr-only) { overflow-wrap: anywhere; }
.roster-player.out { opacity: .6; }
.roster-player.out > span:not(.avatar):not(.sr-only) { text-decoration: line-through; }
.roster-player.out .avatar { filter: grayscale(1); }
.winner { min-height: calc(100svh - 100px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 0 15px; }
.winner-crown { color: var(--yellow); width: 112px; height: 112px; background: var(--ink); border-radius: 50%; display: flex; align-items: center; justify-content: center; transform: rotate(-8deg); margin: 5px 0 32px; box-shadow: 7px 8px 0 #ffb28c; }
.winner-crown .icon { width: 67px; height: 67px; stroke-width: 1.7; }
.winner-name { color: var(--paper); -webkit-text-stroke: 1px var(--ink); text-shadow: 3px 4px 0 var(--ink); font-size: clamp(2.8rem,12vw,5rem); overflow-wrap: anywhere; width: 100%; margin: 8px 0 23px; }
.winner-sticker { border: var(--border); background: var(--lime); box-shadow: 0 4px 0 var(--ink); border-radius: 13px; transform: rotate(-5deg); font-family: 'Fredoka','Trebuchet MS',sans-serif; font-weight: 600; font-size: 1.5rem; padding: 9px 18px; }
.winner-meta { font-size: .875rem; margin: 28px 0 20px; }
.winner-actions { width: min(100%,350px); display: flex; flex-direction: column; margin-top: 15px; gap: 12px; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.confetti i { position: absolute; width: 9px; height: 18px; background: var(--tile); border: 1px solid #2b203d70; top: -30px; left: var(--x); transform: rotate(var(--rotate)); animation: confetti-fall 3.8s ease-out both; animation-delay: var(--delay); }
dialog { color: var(--ink); background: var(--paper); border: var(--border); border-radius: 26px; padding: 24px; width: min(94vw,490px); max-height: calc(100dvh - 40px); box-shadow: 0 8px 0 var(--ink); overscroll-behavior: contain; }
dialog::backdrop { background: #2b203d80; backdrop-filter: blur(5px); }
dialog h2 { font-size: 1.9rem; margin: 0 0 18px; }
dialog > p { font-size: 1rem; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 8px; }
.dialog-top > h2 { margin-bottom: 0; }
.dialog-top .icon-button { margin: -10px -9px -3px 0; flex-shrink: 0; }
.rules-list { list-style: none; counter-reset: rule; padding: 0; margin: 26px 0 22px; display: flex; flex-direction: column; gap: 22px; }
.rules-list li { counter-increment: rule; position: relative; padding-left: 41px; }
.rules-list li::before { content: counter(rule); display: flex; align-items: center; justify-content: center; position: absolute; left: 0; top: 0; width: 28px; height: 28px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--yellow); font-family: 'Fredoka','Trebuchet MS',sans-serif; font-size: 1.1rem; transform: rotate(-5deg); }
.rules-list li:nth-child(2)::before { background: var(--pink); transform: rotate(6deg); }
.rules-list li:nth-child(3)::before { background: var(--teal); }
.rules-list li:nth-child(4)::before { background: var(--blue); transform: rotate(5deg); }
.rules-list strong { font-size: 1rem; font-weight: 900; }
.rules-list p { margin-top: 5px; font-size: .875rem; line-height: 1.55; }
.rule-finish { background: var(--lime); border-radius: 12px; padding: 13px; display: flex; align-items: center; justify-content: center; gap: 9px; font-size: .875rem; margin-bottom: 22px; }
dialog > .button { width: 100%; }
.dialog-actions { display: flex; flex-direction: column; margin-top: 26px; gap: 12px; }
#players-dialog .roster { justify-content: flex-start; margin-top: 24px; }
#players-dialog .roster-player { background: #e5ddec; }
#toast { position: fixed; left: 50%; bottom: max(24px,env(safe-area-inset-bottom)); transform: translate(-50%,20px); width: max-content; max-width: calc(100% - 32px); background: var(--ink); color: var(--paper); border-radius: 15px; padding: 13px 20px; font-size: .875rem; text-align: center; opacity: 0; transition: opacity .2s,transform .2s; pointer-events: none; z-index: 20; }
#toast.visible { opacity: 1; transform: translate(-50%,0); }
@keyframes enter { from { opacity: .4; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes logo-in { from { opacity: 0; transform: translateY(-30px) rotate(calc(var(--tilt) - 14deg)); } to { opacity: 1; transform: translateY(0) rotate(var(--tilt)); } }
@keyframes letter-in { from { opacity: .3; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes countdown-pulse { 0%,100% { transform: scale(1); } 15% { transform: scale(1.06); } }
@keyframes confetti-fall { from { top: -30px; transform: rotate(0deg); } to { top: 104%; transform: rotate(calc(var(--rotate) + 200deg)); } }

/* One shared malus banner and neutral tiles: no category colour coding. */
.malus-banner { grid-column: 1/-1; display: flex; align-items: center; gap: 12px; padding: 12px 15px; background: var(--paper); border: var(--border); border-radius: 18px; box-shadow: 0 4px 0 var(--ink); }
.malus-emblem { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 44px; border-radius: 12px; background: var(--ink); color: var(--yellow); }
.malus-emblem .icon { width: 24px; height: 24px; }
.malus-copy { min-width: 0; }
.malus-title { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; row-gap: 2px; }
.malus-title small { font-size: .75rem; font-weight: 900; letter-spacing: .06em; }
.malus-title strong { font-family: 'Fredoka','Trebuchet MS',sans-serif; font-weight: 600; font-size: 1.75rem; line-height: 1.1; }
.malus-copy p { margin-top: 4px; font-size: .875rem; line-height: 1.35; }
.event-note { margin-top: 13px; font-size: .875rem; font-weight: 900; line-height: 1.3; padding: 8px 12px; border-radius: 12px; background: var(--yellow); width: 100%; }
.tile-glyph { display: inline-flex; align-items: center; justify-content: center; width: 1em; height: 1em; flex-shrink: 0; line-height: 1; transform: rotate(var(--angle,0deg)); transform-origin: center; }
.tile-hidden { background: var(--ink); color: var(--paper); }
.tile-double { background: var(--yellow); }
.dual-glyph { display: inline-flex; flex-direction: column; width: 1.1em; height: 1.75em; font-size: .55em; }
.dual-glyph > span { display: flex; align-items: center; justify-content: center; width: 100%; height: 50%; }
.dual-glyph > span + span { border-top: 1.5px solid currentColor; }
.placed-tile .dual-glyph { font-size: max(.75rem,.55em); }
.incoming-tile .dual-glyph { font-size: .48em; }
.inverted-rack { transform: rotate(180deg); }
.drop-preview { width: 100%; align-items: center; justify-content: center; }
.drop-zone.is-over .drop-preview { display: flex; }
.drop-zone:disabled { opacity: 1; border-style: solid; background: #2b203d18; cursor: not-allowed; }
.drop-zone:disabled .drop-plus .icon { opacity: 1; }
.drop-zone:disabled .drop-caption { font-size: .625rem; letter-spacing: 0; }
.place-title { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 9px; }
.place-title h1 { margin: 0; }
.place-title:has(.turn-clock) { justify-content: space-between; text-align: left; }
.place-title:has(.turn-clock) h1 { font-size: clamp(1.5rem,6vw,2.3rem); }
.turn-clock { width: 78px; flex-shrink: 0; border: 2px solid var(--ink); background: var(--yellow); border-radius: 13px; padding: 7px 9px; }
.turn-clock > div { display: flex; align-items: center; justify-content: center; gap: 4px; }
.turn-clock strong { font-family: 'Fredoka','Trebuchet MS',sans-serif; font-weight: 600; font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.turn-clock span:not(.move-track) { font-size: .75rem; line-height: 1.05; }
.move-track { display: block; height: 4px; margin-top: 5px; background: #2b203d20; border-radius: 2px; overflow: hidden; }
.move-track i { display: block; width: 100%; height: 100%; background: var(--ink); transform-origin: left; }
.turn-clock.urgent { background: var(--pink); }
.verify-heading { margin: 27px 0 10px; }
.verify .answer-rule { font-size: .875rem; font-weight: 900; margin: 6px 0 0; }
.verify .solution-block { margin: 18px 0 14px; padding: 17px 12px; }
.verify .judge-buttons { padding-top: 20px; }
.malus-guide { text-align: left; margin: 0 0 22px; border-top: 1px solid #2b203d40; }
.malus-guide summary { padding: 15px 0; cursor: pointer; font-weight: 900; min-height: 44px; }
.malus-guide ul { list-style: none; padding: 0; margin: 0 0 15px; }
.malus-guide li { padding: 9px 0; }
.malus-guide li strong { display: block; margin-bottom: 3px; }
.malus-guide li span { font-size: .875rem; line-height: 1.4; display: block; }

@media (min-width: 720px) {
  .app-shell { padding-top: 25px; padding-bottom: 25px; }
  .topbar { min-height: 48px; }
  .screen { min-height: 0; }
  .home { min-height: calc(100svh - 110px); padding-top: 18px; }
  .home-title { padding-bottom: 26px; }
  .home-intro { margin-top: 0; }
  .home-actions { margin-top: 30px; }
  .game-screen { min-height: min(740px,calc(100svh - 120px)); padding-top: 30px; }
  .handoff-person { padding-top: 30px; }
  .turn-heading { margin-top: 38px; }
  .incoming { padding: 30px 0; }
  .incoming-tile { width: 135px; height: 155px; font-size: 6.75rem; }
  .bottom-action { margin-top: auto; }
  .winner { min-height: calc(100svh - 130px); }
}
@media (max-width: 380px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .top-tools { gap: 0; }
  .wordmark { gap: 3px; padding-right: 0; }
  .wordmark { font-size: clamp(1.8rem,9vw,2.25rem); }
  .game-facts { gap: 12px; font-size: .8rem; }
  .game-hud { gap: 7px; }
  .malus-banner { padding: 10px; gap: 10px; }
  .malus-emblem { width: 32px; height: 40px; }
  .studio { max-width: calc(100% - 140px); }
  .placement-rack { gap: 6px; }
  .drop-zone { width: 44px; height: 60px; border-radius: 10px; }
  .letter-rack { gap: 4px; }
  .placed-tile { width: min(52px,calc((100% - (var(--count) - 1)*4px)/var(--count))); border-radius: 7px; }
  .judge-buttons { gap: 10px; }
  .judge-buttons .button { font-size: .875rem; }
}
@media (max-height: 740px) and (max-width: 719px) {
  .app-shell { padding-top: max(10px,env(safe-area-inset-top)); padding-bottom: max(16px,env(safe-area-inset-bottom)); }
  .home { min-height: calc(100svh - 85px); padding-top: 15px; }
  .home-title { padding: 16px 0 18px; }
  .placement-hints { margin-top: 19px; }
  .home-intro h2 { margin-bottom: 10px; }
  .home-actions { margin-top: 22px; margin-bottom: 7px; }
  .game-screen { min-height: calc(100svh - 86px); padding-top: 12px; }
  .turn-heading { margin: 22px 0 12px; }
  .incoming { padding: 14px 0 20px; }
  .incoming-tile { width: 102px; height: 116px; font-size: 5.3rem; border-radius: 20px; }
  .incoming > p { margin-bottom: 9px; }
  .place .incoming { padding: 8px 0 10px; }
  .place .incoming > p { display: none; }
  .place .incoming-tile { width: 90px; height: 100px; font-size: 4.4rem; }
  .place .turn-heading { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 10px; }
  .place .place-title { margin: 0; flex-shrink: 0; }
  .place .place-title h1 { display: none; }
  .place .place-title:not(:has(.turn-clock)) { display: none; }
  .place .turn-clock { padding: 6px 7px; width: 68px; }
  .place .turn-clock strong { font-size: 1.5rem; }
  .place .placement-rack { padding-top: 0; padding-bottom: 20px; }
  .place .placement-rack .letter-rack { min-height: 70px; padding: 8px 0; }
  .place .placed-tile { width: min(42px,calc((100% - (var(--count) - 1)*2px)/var(--count))); }
  .malus-title strong { font-size: 1.55rem; }
  .malus-banner { padding-top: 9px; padding-bottom: 9px; }
  .verify-heading { margin-top: 20px; }
  .drag-instruction { padding-top: 0; }
  .timer { width: 118px; height: 118px; margin-top: 2px; margin-bottom: 5px; }
  .timer strong { font-size: 3.8rem; }
  .solve .turn-heading { margin-top: 18px; margin-bottom: 13px; }
  .solve { display: grid; grid-template-columns: minmax(0,1fr) 118px; grid-template-rows: auto auto 1fr auto; column-gap: 8px; }
  .solve .game-hud { grid-column: 1/-1; }
  .solve .turn-heading { grid-column: 1; grid-row: 2; text-align: left; }
  .solve .turn-heading > .eyebrow { font-size: .75rem; }
  .solve .turn-heading h1 { font-size: 1.7rem; }
  .solve .timer { grid-column: 2; grid-row: 2; align-self: center; }
  .solve .board-block { grid-column: 1/-1; grid-row: 3; align-self: center; }
  .solve .bottom-action { grid-column: 1/-1; grid-row: 4; }
  .solve .bottom-action { padding-top: 7px; }
  .solve .bottom-action .answer-instruction { margin-bottom: 11px; }
  .bottom-action > p { margin-top: 12px; }
  .handoff-person { margin-bottom: 16px; padding-top: 15px; }
  .avatar-large { width: 70px; height: 70px; font-size: 2.7rem; margin-bottom: 20px; }
  .result-symbol { width: 66px; height: 66px; margin: 16px auto; }
  .result-symbol .icon { width: 34px; height: 34px; }
  .solution-block { margin: 18px 0; padding: 18px 10px; }
  .winner-crown { width: 85px; height: 85px; margin-bottom: 24px; }
  .winner-crown .icon { width: 50px; height: 50px; }
}
/* One unbroken row, even for 13 letters plus an intruder. Long placement
   racks get the full width; the two drop targets sit just below their ends. */
.letter-rack.long-rack { display: flex; flex-wrap: nowrap; gap: 2px; }
.letter-rack.long-rack .placed-tile { width: min(52px,calc((100% - (var(--count) - 1)*2px)/var(--count))); min-width: 0; min-height: 36px; border-width: 1px; border-radius: 5px; font-size: clamp(.65rem,calc((100cqw - (var(--count) - 1)*2px)/var(--count)*.75),2rem); }
.placement-rack.wide-placement { display: grid; grid-template-columns: 52px minmax(0,1fr) 52px; row-gap: 8px; }
.placement-rack.wide-placement .letter-rack { grid-column: 1/-1; grid-row: 1; width: 100%; }
.placement-rack.wide-placement .before { grid-column: 1; grid-row: 2; justify-self: start; }
.placement-rack.wide-placement .after { grid-column: 3; grid-row: 2; justify-self: end; }
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .confetti { display: none; }
}
