:root {
  --safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);
  font-family:'Nunito',ui-sans-serif,system-ui,-apple-system,'Segoe UI',sans-serif;font-weight:700;color-scheme:only light;
  color:#30205e;background:#fff5df;font-synthesis:none;
  --bg:#fff5df;--paper:#fffcf5;--ink:#30205e;--muted:#6c5a80;--line:#e8d9bb;
  --primary:#4933c7;--primary-hover:#3824aa;--lavender:#4933c7;--tile:#fff2d6;
  --mint:#38d8ca;--coral:#ff778a;--yellow:#ffd45a;--shadow:0 5px 0 #e6cfa9,0 14px 32px #795b3614;
}
*{box-sizing:border-box}
/* Preserve native panning within scrollable dialogs without text selection or zoom. */
html,body{touch-action:pan-x pan-y}
/* viewport-fit=cover exposes device cutouts; consume only the reported overlap. */
html{scroll-padding:calc(var(--safe-top) + 12px) calc(var(--safe-right) + 12px) calc(var(--safe-bottom) + 12px) calc(var(--safe-left) + 12px)}
body{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;margin:0;min-width:300px;min-height:100dvh;padding:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);-webkit-tap-highlight-color:transparent}
button,a{touch-action:manipulation}
button{font:inherit;cursor:pointer;color:inherit;border:0}
button:disabled{cursor:default;opacity:.5}
button:focus-visible,a:focus-visible{outline:3px solid var(--primary);outline-offset:4px}
a{color:inherit;text-decoration:none}
.ambient{position:fixed;pointer-events:none;z-index:-1;width:600px;height:600px;border-radius:50%;filter:blur(90px);opacity:.32}
.ambient-one{background:#ffc58d;top:-260px;right:-220px}
.ambient-two{background:#74edcf;bottom:-330px;left:-200px}
.app-shell{max-width:1080px;margin:auto;padding:26px 36px 30px}

.language-button{width:44px;height:44px;border-radius:15px;background:var(--paper);border:1px solid #ffffff;display:grid;place-items:center;transition:transform .18s,background .18s;color:#392382;box-shadow:0 3px 0 #d4bce8,inset 0 2px 0 #ffffffb3}

#language-button{background:#ffe38b;box-shadow:0 3px 0 #e8b942,inset 0 2px 0 #ffffff99}

.language-button{font-size:12px;font-weight:800}

.stage-heading{position:relative;overflow:hidden;isolation:isolate;display:flex;justify-content:space-between;align-items:center;padding:23px 28px;margin-bottom:23px;gap:20px;border:1px solid #957bff;border-radius:26px;background:linear-gradient(130deg,#6c46f5,#4933c7 65%,#653cff);color:#fffcf5;box-shadow:0 7px 0 #37218f,0 15px 25px #4933c71a,inset 0 2px 0 #ffffff33}
.stage-heading:after{content:'';position:absolute;right:-24px;top:-118px;width:300px;height:300px;border:45px solid #ffffff0b;border-radius:50%;z-index:-1}
.stage-heading:before{content:'✦';position:absolute;right:205px;bottom:-35px;font-size:160px;color:#ffffff09;line-height:1;z-index:-1}
.stage-info{min-width:0;flex:1}
.stage-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.eyebrow{font-size:11px;font-weight:650;letter-spacing:1.1px;color:#eeebff}
h1{font-size:clamp(25px,3vw,35px);font-weight:1000;letter-spacing:-.7px;margin:6px 0 0;line-height:1.2;overflow-wrap:break-word;text-shadow:0 2px 0 #382085,0 3px 4px #24136944}
.journey-button{background:linear-gradient(#fffef9,#fff0c9);color:#4933c7;padding:11px 14px;border-radius:14px;border:1px solid white;display:flex;gap:13px;align-items:center;white-space:nowrap;min-height:44px;box-shadow:0 4px 0 #2c1b8355,inset 0 -2px 0 #ecd6a1;flex-shrink:0}
.journey-button span:first-child{font-size:11px;font-weight:800;letter-spacing:.3px}
.map-symbol{font-size:23px;line-height:1}
.game-layout{display:grid;grid-template-columns:minmax(0,560px) minmax(250px,1fr);gap:24px;align-items:start}
.puzzle-column{min-width:0;padding:16px 16px 0;background:linear-gradient(145deg,#fffefa,#fff0d0);border:2px solid #ffffff;border-radius:26px;box-shadow:var(--shadow)}
.board-toolbar{display:flex;align-items:center;justify-content:space-between;margin:0 2px 13px;gap:10px}
.found-counter,.timer{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:600}
.found-counter strong{font-size:15px;font-variant-numeric:tabular-nums}
#found-label{color:var(--muted);font-size:11px}
.found-symbol{width:27px;height:27px;display:grid;place-items:center;border-radius:9px;background:#7de9cf;color:#17594f;font-size:17px;box-shadow:inset 0 1px 0 #d9fff4,0 2px 0 #48b49d}
.timer{border-radius:12px;padding:8px 11px;background:#4933c7;color:#fffcf5;box-shadow:inset 0 2px 0 #8c76ed,0 3px 0 #2e1d85}
.timer svg{width:16px;height:16px;display:block}
.timer strong{font-size:16px;font-weight:750;font-variant-numeric:tabular-nums}
.timer.low{color:#8c1434;background:#ffb8c7;box-shadow:0 3px 0 #dc6986;animation:timer-pulse 1s ease-in-out infinite}
.board-card{background:transparent;padding:3px;position:relative;isolation:isolate;border-radius:14px}
.board{display:grid;grid-template-columns:repeat(var(--size,6),minmax(0,1fr));grid-template-rows:repeat(var(--size,6),minmax(0,1fr));aspect-ratio:1;gap:3px;position:relative;touch-action:none;user-select:none;-webkit-user-select:none;z-index:2}
.letter{position:relative;min-width:0;min-height:0;line-height:1;padding:0;display:grid;place-items:center;aspect-ratio:1;border-radius:10px;background:linear-gradient(145deg,#ffffff,#fff0d4);font-size:clamp(17px,calc(360px / var(--size)),38px);font-weight:1000;z-index:1;transition:transform .14s;color:#33218f;box-shadow:inset 0 1px 0 #ffffff,0 2px 0 #e7cda4;text-shadow:none;-webkit-touch-callout:none}
.letter.selected{background:#ffd45a;color:#2c1b79;transform:scale(.96);box-shadow:inset 0 0 0 2px #b78215,0 2px 0 #d3a234}
.letter.found{background:transparent;color:#2c1b79;box-shadow:none}
.letter.stone{background:repeating-linear-gradient(45deg,#e2d2b5 0 4px,#f0e2c8 4px 8px);color:#857357;box-shadow:inset 0 1px 3px #70593224;text-shadow:none;cursor:default}
.letter.stone:after{content:'◆';font-size:12px}
.letter.stone:disabled{opacity:1}
.board-lines{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;z-index:0}
.board-lines line{stroke-width:84;stroke-linecap:round;opacity:1;filter:drop-shadow(0 3px 1px #40235b24)}
.board-lines .active-trail{stroke:#ffd45a;opacity:.9;stroke-width:84}
.board-glow{position:absolute;inset:-4px;border:3px solid #20bfa8;border-radius:16px;opacity:0;pointer-events:none}
.board-card.celebrate .board-glow{animation:glow .6s ease-out}
.board-card.shake{animation:shake .28s}
.board-caption{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:38px}
.direction-note{font-size:10px;line-height:1.4;color:var(--muted)}
.selection-preview{font-weight:800;letter-spacing:1px;color:var(--primary);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.discovery-panel{display:flex;flex-direction:column;gap:15px;min-width:0}
.word-section{background:linear-gradient(150deg,#fffefa,#fff5df);border:2px solid #ffffff;border-radius:24px;padding:22px;box-shadow:var(--shadow)}
.section-label{display:flex;justify-content:space-between;align-items:center;font-size:11px;font-weight:800;letter-spacing:.7px;color:var(--primary);gap:8px}
.counter-badge{border-radius:9px;min-height:26px;min-width:26px;padding:4px;display:grid;place-items:center;background:var(--tile);color:var(--primary);font-size:12px;letter-spacing:0}
.word-list{display:flex;flex-wrap:wrap;gap:9px;margin-top:18px}
.word-chip{background:#fff3d9;border:1px solid #ffffff;padding:12px 11px;border-radius:12px;font-size:12px;font-weight:900;letter-spacing:.3px;display:flex;align-items:center;gap:7px;transition:transform .2s;line-height:1.2;max-width:100%;box-shadow:0 2px 0 #e4cba0}
.word-chip:before{content:'';height:6px;width:6px;background:var(--word-color);border:1px solid #656487;border-radius:50%;flex-shrink:0}
.word-chip.found{background:var(--word-color);color:#2c1b79;transform:scale(.98);border-color:transparent;box-shadow:inset 0 2px 0 #ffffff66,0 2px 0 #4a267333}
.word-chip.found:before{content:'✓';border:0;background:none;width:8px;height:12px;font-size:11px;font-weight:900}
.word-chip.found span{text-decoration:line-through;text-decoration-thickness:1px}
.word-chip.revealed{box-shadow:inset 0 0 0 2px var(--word-color),0 2px 0 #e4cba0}
.word-chip.hidden{position:relative}/* keeps its screen-reader label inside a scrolling word tray */
.word-chip .slots{display:flex;gap:2px;min-width:0;max-width:100%}
.word-chip .slots i{flex:0 1 .8em;min-width:3px;height:1em;border-radius:3px;background:#fffdf7;box-shadow:inset 0 0 0 1.5px #8a7350}
.hint-button small:empty{display:none}
.hint-button{background:linear-gradient(#ffe67a,#ffd045);color:#473316;border:1px solid #eab82c;border-radius:19px;padding:15px 17px;display:flex;align-items:center;gap:12px;text-align:left;box-shadow:inset 0 2px 0 #fff3bc,0 5px 0 #d3a42c;transition:transform .18s,box-shadow .18s;min-height:66px}
.hint-button:not(:disabled):hover{transform:translateY(-2px);box-shadow:0 6px 0 #dbb240}
.hint-button:not(:disabled):active{transform:translateY(2px);box-shadow:0 2px 0 #dbb240}
.hint-icon{font-size:31px;line-height:1}
.hint-button strong{display:block;font-size:14px;font-weight:800}
.hint-button small{font-size:10px;display:block;margin-top:3px}
#hint-count{margin-left:auto;background:#fff7d0;border:1px solid #ba941f;border-radius:10px;min-width:30px;height:30px;padding:0 8px;white-space:nowrap;display:grid;place-items:center;font-size:13px;font-weight:800}
.panel-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:3px 6px}
.stars-total{font-size:13px;font-weight:800;color:var(--primary)}
.text-button{font-size:11px;font-weight:650;color:var(--muted);background:none;padding:8px 0;text-decoration:underline;text-underline-offset:4px;min-height:32px}
.save-status{font-size:10px;color:var(--muted);text-align:center;line-height:1.5}
.save-status:empty{display:none}
.particles{position:absolute;inset:0;pointer-events:none;overflow:visible;z-index:4}
.particle{position:absolute;width:8px;height:8px;background:var(--color);border-radius:2px;animation:burst .75s ease-out forwards}
.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}
@keyframes burst{from{opacity:1;transform:translate(0,0) rotate(0)}to{opacity:0;transform:translate(var(--dx),var(--dy)) rotate(160deg)}}
@keyframes timer-pulse{50%{box-shadow:0 0 0 3px #ff9caf33}}
@keyframes glow{30%{opacity:.85}100%{opacity:0}}
@keyframes shake{25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}
@media(min-width:801px) and (max-height:850px){
  .app-shell{max-width:1000px;padding-top:20px}
  .stage-heading{padding:18px 25px;margin-bottom:22px}
  .game-layout{grid-template-columns:minmax(300px,min(520px,calc(100dvh - 250px))) minmax(250px,1fr)}
  .puzzle-column{padding:12px 12px 0}.word-section{padding:20px}
}
@media(max-width:800px){
  .app-shell{max-width:580px;padding:16px 16px 20px}

  .language-button{width:38px;height:40px;border-radius:12px}
  .language-button{font-size:11px}
  .stage-heading{padding:18px 20px;margin-bottom:19px;border-radius:20px;gap:12px;box-shadow:0 5px 0 #37218f,inset 0 2px 0 #ffffff33}
  h1{font-size:27px}.eyebrow{font-size:9px;letter-spacing:.7px}
  .journey-button{padding:10px;gap:8px;border-radius:11px}.journey-button span:first-child{font-size:9px}.map-symbol{font-size:21px}
  .game-layout{display:flex;flex-direction:column;gap:14px}.puzzle-column,.discovery-panel{width:100%}
  .puzzle-column{padding:12px 10px 0;border-radius:20px}.board-card{padding:1px}
  .board{gap:2px}.letter{font-size:clamp(13px,calc(216px / var(--size)),34px);border-radius:7px}
  .board-toolbar{margin-bottom:10px}.board-caption{min-height:31px;padding:0 3px}
  .word-section{padding:16px;border-radius:20px}.word-list{margin-top:12px;gap:7px}
  .word-chip{font-size:11px;padding:9px 10px;letter-spacing:.35px}.section-label{font-size:10px}
  .discovery-panel{gap:12px}.hint-button{padding:10px 15px;min-height:58px;border-radius:16px}.hint-icon{font-size:27px}
  .panel-footer{padding:0 5px}.direction-note{font-size:9px}.selection-preview{font-size:11px}
}
@media(max-width:380px){
  .app-shell{padding:12px 10px 16px}
  .language-button{width:33px;height:36px;border-radius:10px}
  .stage-heading{padding:16px 15px;gap:8px}h1{font-size:24px}.journey-button{padding:9px 8px;gap:6px}.journey-button span:first-child{font-size:8px}
  .puzzle-column{padding:10px 8px 0}.letter{border-radius:5px}.word-section{padding:14px}.word-chip{font-size:10px;padding:8px;gap:5px}
}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}.particle{display:none}}

/* Touch must never leave a hover surface over a completed word. */
@media(hover:hover) and (pointer:fine){
  .letter:not(.found):not(.selected):not(.hint):not(.stone):hover{background:#ffecbc}
  .language-button:hover{transform:translateY(-1px)}
}
