:root{font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;color:#fdf4ff;background:#110b2b;--gold:#ffd87d;--violet:#2d165f;--mint:#85f1d2;--border:rgba(244,201,255,.36)}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;overscroll-behavior-y:contain}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer}button:disabled{opacity:.48;cursor:not-allowed}[hidden]{display:none!important}
body{background:radial-gradient(ellipse at 50% 60%,#3a1670,#140b35 70%);overflow-x:hidden}body::before{content:"";position:fixed;inset:0;pointer-events:none;background:linear-gradient(180deg,rgba(14,7,36,.10),rgba(14,7,36,.46));z-index:-1}
.world-bg{position:fixed;inset:0;z-index:-2;background:url('assets/lettresia-world-v034.webp') center center/cover no-repeat;opacity:.95}
.app-shell{max-width:1360px;margin:auto;min-height:100svh;padding:12px clamp(12px,3.6vw,46px) 10px;display:flex;flex-direction:column;gap:10px}
.app-header{display:flex;align-items:center;justify-content:space-between;gap:15px;min-height:62px;padding:4px 15px;background:rgba(24,10,57,.76);border:1px solid rgba(235,191,112,.28);box-shadow:0 8px 26px rgba(12,5,32,.2),inset 0 1px 0 #ffffff1a;border-radius:22px;backdrop-filter:blur(12px)}
.brand{display:flex;align-items:center;gap:8px;text-decoration:none;color:inherit}.brand img{height:49px;width:49px;object-fit:contain}.brand span{display:flex;flex-direction:column}.brand small{font-size:10px;font-weight:800;letter-spacing:.19em;color:#d9cbf8}.brand strong{font-family:Georgia,'Times New Roman',serif;font-weight:900;font-size:27px;letter-spacing:-.03em;color:#ffe9a6;text-shadow:0 2px 6px #d36525}
.header-actions{display:flex;gap:9px;align-items:center}.round-action,.outline-action,.back-btn{color:#ffecc4;background:linear-gradient(155deg,#46226f,#210c4a);border:1.5px solid #ab78dd;border-radius:14px;padding:10px 14px;box-shadow:inset 0 1px 0 #ffffff38}.round-action{min-width:43px;min-height:43px;font-size:21px;font-weight:900}.outline-action{border-color:#e5ba57;font-size:13px;font-weight:800}.back-btn{font-size:13px}.round-action:focus-visible,.outline-action:focus-visible,.back-btn:focus-visible,button:focus-visible,a:focus-visible{outline:3px solid #fbe7a0;outline-offset:3px}
.home-view{display:flex;flex:1;align-items:center;justify-content:center;min-height:calc(100svh - 118px);padding:25px 4px 20px}.home-panel{isolation:isolate;position:relative;width:min(100%,580px);text-align:center;border-radius:60px;padding:86px clamp(23px,5vw,48px) 34px;background:linear-gradient(160deg,#5c34bded 0%,#1c124ccf 38%,#271162e6 82%,#6430a9d8 100%);border:2px solid rgba(255,214,142,.86);box-shadow:0 0 0 5px #8454ff5c,0 0 42px #f1a5ff38,0 28px 95px #0a061f9c,inset 0 0 40px #9e5ef43d;backdrop-filter:blur(16px)}
.home-panel::before{content:"";pointer-events:none;position:absolute;inset:10px;border:1px solid #cba8ff70;border-radius:50px}.home-crest{position:absolute;top:-71px;left:50%;transform:translateX(-50%);height:146px;width:160px;object-fit:contain;filter:drop-shadow(0 7px 16px #efac3770)}
.eyebrow{font-weight:900;font-size:11px;letter-spacing:.27em;color:#e2d6ff;margin:0 0 7px}.home-panel h1,.home-panel h2,.puzzle-intro h2,.castle-head h2,.result-panel h2{font-family:Georgia,'Times New Roman',serif;margin:0}
.home-panel h1{font-size:clamp(48px,7.2vw,74px);color:#ffdc8d;text-shadow:0 3px 0 #92502e,0 6px 16px #140822;line-height:1.08}.rule{height:2px;margin:13px auto 19px;max-width:330px;background:linear-gradient(90deg,transparent,#ffe5a2,transparent)}
.home-panel h2{font-size:clamp(28px,4vw,40px);line-height:1.12;color:#fff3e2;text-shadow:0 3px 4px #15052c}.home-panel h2 em{color:#ffd065;font-style:italic;display:inline-block}.intro{line-height:1.53;color:#e9e3ff;font-size:16px;margin:20px auto;max-width:445px}
.mission-banner{display:flex;align-items:center;gap:12px;text-align:left;padding:12px 16px;border:1px solid #f9d28c78;border-radius:18px;background:linear-gradient(90deg,#46238bad,#2c1856);margin:14px auto 16px;max-width:435px}.mission-icon{font-size:32px}.mission-banner b{display:block;font-size:15px;color:#fff2bb}.mission-banner small{display:block;color:#e8dcff;font-size:12px;margin-top:3px}
.gold-cta{width:100%;max-width:440px;min-height:66px;padding:12px 18px;display:inline-flex;justify-content:center;align-items:center;gap:20px;border:2px solid #fff7c0;border-radius:25px;background:linear-gradient(180deg,#fff5b9 0%,#ffd15b 53%,#f5a82e 100%);color:#371365;font-weight:1000;font-size:21px;box-shadow:0 7px 0 #a65f0e,0 0 24px #ffd45b7f,inset 0 3px 5px #ffffffaa;text-shadow:0 1px #fffaeb;transition:transform .14s ease}.gold-cta:hover{transform:translateY(-2px)}.gold-cta:active{transform:translateY(3px);box-shadow:0 3px 0 #a65f0e}
.classic-link{display:inline-flex;align-items:center;gap:10px;color:#cabaf9;text-decoration:none;padding:13px 8px;font-size:13px;border-bottom:1px solid #c5a2ff57}.classic-link:hover{color:#fff}
.mini-facts{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-top:15px;color:#e3d9f4;font-size:11px;letter-spacing:.01em}.mini-facts span{padding:4px 6px}
.game-view{flex:1;max-width:1100px;width:100%;margin:0 auto}.game-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:5px 0}.game-heading .eyebrow{margin-top:9px}.game-hud{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));max-width:770px;margin:0 auto 15px;gap:9px}.hud-item{background:linear-gradient(145deg,#58309bad,#21144bdf);border:1.5px solid #d6a3f669;border-radius:17px;text-align:center;padding:8px 15px;box-shadow:inset 0 1px 0 #ffffff40}.hud-item small,.mission-counter small{display:block;font-size:10px;font-weight:850;letter-spacing:.15em;color:#ded5fb}.hud-item strong{font-size:clamp(24px,4vw,38px);color:#ffdfa0;text-shadow:0 2px 4px #300c56}.hud-item.time strong{color:#fff}
.game-layout{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,.85fr);align-items:start;gap:18px}.puzzle-column,.castle-column{background:linear-gradient(165deg,rgba(27,9,69,.93),rgba(43,20,89,.9));border:1.5px solid #c18fe074;border-radius:25px;padding:16px;box-shadow:0 12px 50px #07041d73,inset 0 1px 0 #ffffff22;backdrop-filter:blur(12px)}
.puzzle-intro{display:flex;align-items:center;justify-content:space-between;gap:13px}.puzzle-intro h2{font-size:clamp(29px,4vw,45px);color:#ffe79d;text-shadow:0 3px 10px #df9b5e59;line-height:1}.puzzle-intro h2 span:first-child{font-family:system-ui;font-size:.83em}.puzzle-intro p:not(.eyebrow){font-size:13px;margin:6px 0 0;color:#e8dafa}.mission-counter{border:1px solid #b785e1;border-radius:12px;text-align:center;padding:6px 12px;min-width:68px}.mission-counter b{display:block;font-size:22px;color:#ffdb79}.how-to{line-height:1.5;color:#d4c4ee;font-size:13px;margin:13px 0 10px}
.letter-grid{touch-action:none;user-select:none;-webkit-user-select:none;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:repeat(7,minmax(0,1fr));gap:6px;width:min(100%,438px);aspect-ratio:6/7.05;margin:0 auto;padding:11px;border-radius:19px;border:2px solid rgba(251,202,110,.7);background:radial-gradient(circle at 30% 25%,#7d55d44a,transparent 52%),linear-gradient(135deg,#32146c,#1b1250 80%);box-shadow:0 0 23px #c668d048,inset 0 0 22px #12052fa8}
.tile{min-width:0;min-height:0;display:flex;align-items:center;justify-content:center;padding:0;border:1.5px solid #ffe5b0b8;border-radius:13px;box-shadow:0 4px 0 #682878,0 5px 9px #070316bb,inset 0 2px 5px #ffffffc9;background:linear-gradient(145deg,#ffdfff 0%,#aa65e8 57%,#6933ae 100%);font-size:clamp(18px,3.2vw,33px);font-weight:1000;color:#3b1656;text-shadow:0 1px #fef8ff;transform:translateY(0);transition:transform .12s,filter .12s,border-color .12s;outline:none}.tile[data-tone="1"]{background:linear-gradient(135deg,#e2faff,#84bdfa 65%,#3978c9)}.tile[data-tone="2"]{background:linear-gradient(135deg,#fff4bb,#ffd16d 64%,#e68d33)}.tile[data-tone="3"]{background:linear-gradient(135deg,#f7cdf4,#fc91ad 66%,#c94092)}
.tile:focus-visible{outline:3px solid #fff;outline-offset:-3px}.tile.selected{transform:translateY(-4px) scale(1.04);border-color:#fff7b2;box-shadow:0 0 0 3px #ffe66b87,0 5px 16px #fff3a698}.tile.hinted{animation:hint-bounce .65s ease-in-out 3;border-color:#fff7ad;box-shadow:0 0 18px #ffed72}.tile.burst{animation:tile-burst .29s ease-out forwards;pointer-events:none}.tile:hover:not(:disabled){filter:brightness(1.09)}
.puzzle-actions{display:flex;gap:10px;justify-content:center;margin:14px auto 8px}.game-control{display:inline-flex;align-items:center;justify-content:center;gap:6px;flex-wrap:wrap;min-height:46px;padding:10px 13px;border:1.5px solid #a774d7;border-radius:13px;background:linear-gradient(#56318a,#2b154e);color:#f7e6ff;font-weight:800;font-size:13px;box-shadow:inset 0 1px 0 #ffffff4a}.game-control small{font-size:10px;color:#d8c4ed}.help-note{font-size:11px;line-height:1.5;color:#b9a9d3;margin:9px 0 4px}.game-message{min-height:25px;font-weight:800;color:#ffdf89;font-size:13px;margin:9px 0 0;text-align:center}
.castle-viewport{position:relative;isolation:isolate;overflow:hidden;min-height:360px;border:1px solid #d0a36370;border-radius:20px;background:linear-gradient(180deg,#22124ac9,#19103332 58%,#17102fc9),url('assets/lettresia-world-v034.webp') 78% 42%/auto 135% no-repeat;box-shadow:inset 0 0 25px #0b042d66}.castle-head{position:absolute;left:17px;top:17px;right:17px;padding:9px 12px;border-radius:13px;background:linear-gradient(90deg,#210b4dcc,transparent)}.castle-head h2{font-size:clamp(18px,2.5vw,29px);color:#ffe5a8;text-shadow:0 2px 5px #0d0425}.castle-head .eyebrow{font-size:9px}.castle-light{position:absolute;inset:20% 0 5%;background:radial-gradient(circle at 73% 36%,#ce85fd55,transparent 45%);transition:background .5s}.castle-effect{position:absolute;left:13px;right:13px;bottom:15px;border:1px solid #e8ce9b7a;border-radius:12px;padding:11px 14px;font-weight:850;font-size:14px;text-align:center;background:rgba(27,10,53,.88);text-shadow:0 2px 3px #13041e}.castle-viewport.stage-0::after,.castle-viewport.stage-1::after,.castle-viewport.stage-2::after,.castle-viewport.stage-3::after{position:absolute;top:43%;right:21%;font-size:66px;filter:drop-shadow(0 5px 16px #100124c5)}.castle-viewport.stage-0::after{content:'🌿'}.castle-viewport.stage-1::after{content:'🔥'}.castle-viewport.stage-2::after{content:'🌫️'}.castle-viewport.stage-3::after{content:'🧱'}.castle-viewport.stage-4 .castle-light{background:radial-gradient(circle at 72% 38%,#ffd875a0,transparent 63%)}.castle-viewport.flashing{animation:scene-flash .8s ease-out}
.mission-objectives{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-top:12px}.objective{display:flex;gap:8px;align-items:center;padding:11px 10px;border:1px solid #956dca8a;border-radius:13px;background:#301455b8;opacity:.56}.objective.current{opacity:1;background:linear-gradient(110deg,#68429b,#3c1b71);border-color:#ffd17e;box-shadow:0 0 12px #b967ff50}.objective.done{opacity:1;background:#1d584abb;border-color:#6fe0bc}.objective .objective-icon{font-size:23px}.objective b{display:block;font-size:12px;color:#ffedcc}.objective small{display:block;margin-top:2px;font-size:10px;color:#dfd6f0}.mission-progress-track{height:10px;border-radius:15px;overflow:hidden;background:#1a123a;border:1px solid #a46bc2;margin-top:12px}.mission-progress-track>div{width:0;height:100%;background:linear-gradient(90deg,#45ddac,#ffd465);transition:width .5s}.scene-foot{font-size:11px;color:#e0caef;text-align:center}
.status-banner{margin:0;padding:8px 15px;color:#ffe49c;background:#31215ee8;border-radius:8px;font-size:12px}.result-overlay{position:fixed;inset:0;z-index:10;background:#0a0519c9;display:flex;align-items:center;justify-content:center;padding:18px;backdrop-filter:blur(7px)}.result-panel{max-width:440px;width:100%;text-align:center;border:2px solid #ffe0aa;border-radius:35px;padding:32px 25px;background:linear-gradient(150deg,#6634b8,#28125e 63%,#54359c);box-shadow:0 0 38px #dc78ff50}.result-symbol{font-size:65px}.result-panel h2{font-size:36px;color:#ffe59b;line-height:1.13}.result-panel p{color:#eee1fb;line-height:1.45}.result-score{font-size:56px;color:#ffe6a1;font-weight:1000;text-shadow:0 4px 4px #4d195e}.result-panel .gold-cta{margin:17px 0;max-width:100%}.result-buttons{display:flex;flex-direction:column;align-items:stretch}.result-panel .game-control{width:100%}.site-footer{text-align:center;color:#d4bde2d9;font-size:10px;padding:8px 5px 13px;margin-top:auto}
@keyframes hint-bounce{50%{transform:translateY(-6px) scale(1.05)}}@keyframes tile-burst{to{transform:scale(.05) rotate(18deg);opacity:0;filter:brightness(2)}}@keyframes scene-flash{20%{filter:brightness(1.8)}80%{filter:brightness(1.1)}}
@media(max-width:820px){.game-layout{grid-template-columns:1fr}.castle-column{display:grid;grid-template-columns:1fr;gap:2px}.castle-viewport{min-height:210px;background-size:cover;background-position:73% 39%}.castle-viewport.stage-0::after,.castle-viewport.stage-1::after,.castle-viewport.stage-2::after,.castle-viewport.stage-3::after{top:39%;right:23%;font-size:49px}.puzzle-column,.castle-column{max-width:620px;width:100%;margin:auto}.home-view{min-height:calc(100svh - 135px)}}
@media(max-width:460px){.app-shell{padding:8px 9px}.app-header{padding:4px 10px;min-height:54px;border-radius:15px}.brand img{width:40px;height:40px}.brand strong{font-size:23px}.brand small{font-size:8px}.outline-action{font-size:10px;padding:8px}.round-action{padding:6px;min-width:37px;min-height:37px}.home-view{padding:64px 5px 20px;align-items:flex-start}.home-panel{padding:67px 18px 25px;border-radius:35px}.home-panel::before{inset:7px;border-radius:28px}.home-crest{top:-62px;width:135px;height:129px}.eyebrow{font-size:8.5px;letter-spacing:.16em}.home-panel h1{font-size:49px}.home-panel h2{font-size:29px}.intro{font-size:13px}.mission-banner{padding:10px}.mission-banner b{font-size:12px}.mission-banner small{font-size:10px}.gold-cta{min-height:59px;font-size:18px}.mini-facts{font-size:9px}.game-heading .eyebrow{font-size:9px}.game-hud{gap:6px;margin:8px 0}.hud-item{padding:7px 4px}.puzzle-column,.castle-column{padding:11px;border-radius:18px}.puzzle-intro h2{font-size:30px}.how-to{font-size:11px;margin:9px 0}.letter-grid{gap:4px;padding:7px}.tile{border-radius:10px;font-size:clamp(19px,6vw,28px);box-shadow:0 3px 0 #682878,0 4px 6px #070316bb}.puzzle-actions{gap:6px}.game-control{min-height:42px;font-size:11px;padding:7px 9px}.mission-objectives{gap:6px}.objective{padding:8px 6px}.objective .objective-icon{font-size:19px}.objective b{font-size:10px}}
@media(max-width:355px){.home-panel h1{font-size:43px}.home-panel h2{font-size:26px}.home-panel{padding-left:12px;padding-right:12px}.brand strong{font-size:20px}.puzzle-intro h2{font-size:28px}.game-heading .eyebrow{font-size:8px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* The active fantasy mission is visible above the grid on mobile, not hidden below the fold. */
.puzzle-intro{position:relative;isolation:isolate;overflow:hidden;border-radius:16px;padding:11px 12px;background:linear-gradient(90deg,#28104eea 0%,#29134cb8 58%,#2a19545e 100%),url('assets/lettresia-world-v034.webp') 79% 40%/auto 220% no-repeat;border:1px solid #ecb86c8a;min-height:100px}
.puzzle-intro::after{content:'✧';font-family:Georgia,serif;position:absolute;right:27%;top:12%;color:#ffe39b;font-size:26px;text-shadow:0 0 17px #ffe56b;z-index:-1}
.puzzle-intro .eyebrow{color:#ffecb7}.puzzle-intro>div:first-child{max-width:77%;text-shadow:0 2px 5px #120825}
@media(max-width:460px){.puzzle-intro{padding:8px 10px;min-height:95px}.puzzle-intro>div:first-child{max-width:78%}}

.tile.falling{animation:fall-in .39s cubic-bezier(.18,.95,.36,1.15) backwards;animation-delay:var(--fall-delay,0ms)}
@keyframes fall-in{from{opacity:.2;transform:translateY(-42px) scale(.92)}to{opacity:1;transform:translateY(0) scale(1)}}
.hud-item.time.danger{border-color:#ff8e9b;box-shadow:inset 0 0 16px #df304c77}
.hud-item.time.danger strong{color:#ff9999}
@media(prefers-reduced-motion:reduce){.tile.falling{animation:none}}

/* V0.4.1: Daily mode, beginner help and visible first gesture */
.mode-switch{display:grid;grid-template-columns:1fr 1fr;gap:4px;background:#201244dc;padding:5px;border:1px solid #a880e9;border-radius:19px;margin:12px 0 4px}
.mode-option{border:1px solid transparent;min-height:48px;background:transparent;color:#efe4ff;border-radius:15px;font-size:15px;font-weight:900;white-space:normal}
.mode-option.active{background:linear-gradient(135deg,#a1ffe0,#42cca8);color:#1b1151;border-color:#d6fff0;box-shadow:0 3px 0 #228b7e,0 0 15px #7affe88a}
.mode-description{font-size:12px;line-height:1.5;color:#e2d8f7;min-height:33px;margin:8px auto 10px;text-align:center}
.guide-link{display:block;margin:7px auto 10px;background:#2a185aaa;color:#fbe8b4;border:1px solid #b78fdb;border-radius:12px;padding:9px 14px;font-size:13px;font-weight:800;max-width:100%}
.guide-link span{font-size:11px;color:#e9ddff;font-weight:500}
.how-to{display:flex;align-items:center;justify-content:space-between;gap:8px}
.how-to>span{flex:1}
.guide-mini{flex:0 0 auto;color:#231244;background:#ffe3a0;border:1px solid #fff3c9;font-size:12px;font-weight:900;border-radius:10px;padding:9px 8px;min-height:38px}
.tile.hinted{border:3px solid #fff6a7!important;box-shadow:0 0 0 2px #ffb834,0 0 21px #ffdb4d!important;animation:hint-bounce .95s ease-in-out infinite}
.tutorial-overlay{z-index:50}
.tutorial-panel{max-width:530px;padding:24px 22px}
.tutorial-panel h2{font-size:clamp(24px,5vw,33px)}
.tutorial-panel p{font-size:14px;margin:11px 0}
.tutorial-panel .tutorial-timer{font-size:12px;color:#ffebaa}
.tutorial-tiles{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px;max-width:396px;margin:14px auto}
.tutorial-tiles span{font-weight:1000;font-size:clamp(18px,5vw,27px);padding:10px 0;border-radius:11px;color:#3a1454;border:1px solid #e6bdff;box-shadow:0 4px #603287;background:linear-gradient(#ffe7fa,#cb83ea)}
.tutorial-tiles span.to-swap{border:3px solid #fff3aa;box-shadow:0 0 14px #ffe368,0 3px #a87828}
.tutorial-tiles span.word-made{background:linear-gradient(#f0ffe3,#78eac1);border:2px solid #e5ffde}
.tutorial-arrow{font-weight:900;color:#ffe29d;margin:6px auto}
@media(max-width:460px){.home-panel{padding-top:67px}.mode-switch{margin-top:9px}.mode-option{min-height:44px;font-size:12px}.mode-description{min-height:0;font-size:11px}.guide-link{font-size:11px}.guide-link span{display:block}.tutorial-panel{padding:23px 15px}.how-to{font-size:11px}}
@media(prefers-reduced-motion:reduce){.tile.hinted{animation:none}}
/* Keep highlighted tiles stationary, so pointer targeting stays reliable. */
@keyframes hint-glow{50%{filter:brightness(1.23)}}
.tile.hinted{animation:hint-glow 1.3s ease-in-out infinite}


/* V0.4.2 – viewport-first gameplay, without document scrolling. */
body.in-game{height:100dvh;min-height:0;overflow:hidden}
body.in-game .app-shell{height:100dvh;min-height:0;max-height:100dvh;max-width:1600px;padding:5px clamp(8px,1.7vw,22px) 5px;gap:4px;overflow:hidden}
body.in-game .app-header{flex:0 0 auto;min-height:43px;height:43px;padding:2px 10px;border-radius:13px}
body.in-game .brand img{width:39px;height:39px}
body.in-game .brand strong{font-size:21px}
body.in-game .brand small{font-size:8px}
body.in-game .header-actions{gap:5px}
body.in-game #btnInstall,body.in-game #btnUpdate{display:none!important} /* No install/update during a timed round */
body.in-game .round-action{min-width:34px;min-height:34px;padding:4px 9px;font-size:18px;border-radius:10px}
body.in-game .site-footer{display:none}
body.in-game .game-view{min-height:0;flex:1 1 0;display:flex;flex-direction:column;max-width:1350px;overflow:hidden}
body.in-game .game-heading{flex:0 0 auto;min-height:30px;padding:0;gap:8px}
body.in-game .game-heading>div{display:flex;align-items:center;gap:12px}
body.in-game .game-heading .eyebrow{margin:0;font-size:9px;letter-spacing:.12em}
body.in-game .back-btn{padding:5px 10px;min-height:28px;font-size:12px}
body.in-game .game-hud{flex:0 0 auto;max-width:810px;width:100%;gap:8px;margin:0 auto 4px}
body.in-game .hud-item{padding:3px 6px;border-radius:12px;min-height:47px}
body.in-game .hud-item small{font-size:8px}
body.in-game .hud-item strong{font-size:clamp(20px,3.2vh,30px);line-height:1.1}
body.in-game .game-layout{flex:1 1 0;min-height:0;max-height:100%;grid-template-columns:minmax(0,1.04fr) minmax(0,.82fr);gap:10px;align-items:stretch;overflow:hidden}
body.in-game .puzzle-column{display:flex;flex-direction:column;min-height:0;min-width:0;padding:9px;gap:4px;overflow:hidden}
body.in-game .puzzle-intro{flex:0 0 auto;min-height:0;height:70px;padding:7px 12px;gap:5px}
body.in-game .puzzle-intro .eyebrow{margin-bottom:3px;font-size:9px}
body.in-game .puzzle-intro h2{font-size:30px}
body.in-game .puzzle-intro p:not(.eyebrow){font-size:11px;line-height:1.2;margin-top:3px}
body.in-game .mission-counter{padding:3px 7px;min-width:54px}
body.in-game .mission-counter b{font-size:19px}
body.in-game .how-to{flex:0 0 auto;min-height:0;margin:0;line-height:1.28;font-size:10px}
body.in-game .guide-mini{min-height:26px;font-size:10px;padding:3px 6px}
body.in-game .letter-grid{flex:0 0 auto;min-height:0;min-width:0;max-width:100%;margin:auto;border-radius:14px;padding:5px;gap:4px;aspect-ratio:unset;width:1px;height:1px}
body.in-game .tile{font-size:clamp(15px,3.1vh,31px);border-radius:8px;box-shadow:0 2px 0 #6d307a,0 3px 5px #07031699}
body.in-game .puzzle-actions{flex:0 0 auto;margin:0;gap:7px}
body.in-game .game-control{min-height:34px;padding:5px 10px;font-size:11px;border-radius:10px}
body.in-game .game-control small{font-size:9px}
body.in-game .help-note{display:none} /* Developer-only lexicon disclaimer is on the home/README, not the HUD */
body.in-game .game-message{min-height:17px;flex:0 0 auto;margin:0;line-height:1.2;font-size:11px}
body.in-game .castle-column{min-height:0;display:flex;flex-direction:column;padding:10px;gap:6px;overflow:hidden}
body.in-game .castle-viewport{min-height:0;flex:1 1 0;border-radius:12px}
body.in-game .castle-head{left:8px;top:8px;right:8px;padding:6px}
body.in-game .castle-head h2{font-size:clamp(16px,2vw,24px)}
body.in-game .castle-effect{left:9px;right:9px;bottom:9px;padding:7px;font-size:12px}
body.in-game .mission-objectives{flex:0 0 auto;margin:0;gap:5px}
body.in-game .objective{padding:5px 7px;gap:5px;min-height:40px}
body.in-game .objective .objective-icon{font-size:19px}
body.in-game .objective small{font-size:9px}
body.in-game .mission-progress-track{flex:0 0 auto;margin:0;height:6px}
body.in-game .scene-foot{flex:0 0 auto;margin:0;font-size:10px;line-height:1.1}
/* Landscape tablets and narrow desktops: maximize board space; maintain two panels. */
@media(max-width:820px){
 body.in-game .app-shell{padding:4px 6px;gap:3px}
 body.in-game .app-header{height:39px;min-height:39px;padding:0 6px}
 body.in-game .brand img{width:34px;height:34px}
 body.in-game .brand strong{font-size:19px}
 body.in-game .game-heading{min-height:24px}
 body.in-game .game-heading .eyebrow{font-size:8px}
 body.in-game .game-hud{margin:0 auto 2px;gap:4px}
 body.in-game .hud-item{min-height:40px;padding:1px 4px}
 body.in-game .hud-item strong{font-size:23px}
 body.in-game .game-layout{display:flex;flex-direction:column;gap:4px;overflow:hidden}
 body.in-game .castle-column{order:-1;flex:0 0 auto;height:77px;min-height:0;max-width:none;width:100%;margin:0;display:grid;grid-template-columns:minmax(0,.98fr) minmax(0,1.15fr);gap:5px;padding:5px;border-radius:12px}
 body.in-game .castle-viewport{min-height:0;height:100%;background-size:cover;background-position:80% 42%}
 body.in-game .castle-head{left:3px;top:2px;right:3px;padding:3px 5px}
 body.in-game .castle-head .eyebrow{font-size:7px;letter-spacing:.04em}
 body.in-game .castle-head h2{font-size:12px;line-height:1.05}
 body.in-game .castle-effect{left:3px;right:3px;bottom:3px;padding:3px;font-size:8px;line-height:1.1}
 body.in-game .castle-viewport.stage-0::after,body.in-game .castle-viewport.stage-1::after,body.in-game .castle-viewport.stage-2::after,body.in-game .castle-viewport.stage-3::after{top:40%;right:16%;font-size:21px}
 body.in-game .mission-objectives{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:3px;margin:0;min-height:0}
 body.in-game .objective{min-height:0;padding:2px 4px;border-radius:6px;gap:3px}
 body.in-game .objective .objective-icon{font-size:13px}
 body.in-game .objective b{font-size:10px}
 body.in-game .objective small{display:none}
 body.in-game .mission-progress-track,body.in-game .scene-foot{display:none}
 body.in-game .puzzle-column{order:1;flex:1 1 0;max-width:none;width:100%;margin:0;gap:3px;padding:6px;border-radius:12px}
 body.in-game .puzzle-intro{min-height:0;height:48px;padding:3px 7px;border-radius:8px}
 body.in-game .puzzle-intro h2{font-size:23px}
 body.in-game .puzzle-intro .eyebrow{font-size:7px;letter-spacing:.08em;margin:0}
 body.in-game .puzzle-intro p:not(.eyebrow){font-size:9px;margin:0;line-height:1.1}
 body.in-game .mission-counter{min-width:45px;padding:1px 3px}
 body.in-game .mission-counter b{font-size:15px}
 body.in-game .mission-counter small{font-size:7px}
 body.in-game .how-to{margin:0;font-size:10px;line-height:1.1;gap:4px}
 body.in-game .how-to>span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body.in-game .guide-mini{min-height:22px;font-size:9px;padding:1px 6px}
 body.in-game .letter-grid{padding:4px;gap:3px;border-radius:10px}
 body.in-game .tile{font-size:clamp(13px,3.5vh,25px);border-radius:6px}
 body.in-game .game-control{min-height:28px;padding:3px 8px;font-size:10px}
 body.in-game .game-control small{font-size:9px}
 body.in-game .puzzle-actions{margin:0;gap:4px}
 body.in-game .game-message{min-height:14px;font-size:10px;line-height:1.1}
}
@media(max-width:820px) and (max-height:690px){
 body.in-game .app-header{height:34px;min-height:34px}
 body.in-game .brand img{width:30px;height:30px}
 body.in-game .brand strong{font-size:17px}
 body.in-game .game-heading{min-height:22px}
 body.in-game .game-heading .eyebrow{font-size:7px}
 body.in-game .hud-item{min-height:33px}
 body.in-game .hud-item strong{font-size:19px}
 body.in-game .hud-item small{font-size:7px}
 body.in-game .castle-column{height:61px}
 body.in-game .castle-head h2{font-size:11px}
 body.in-game .castle-effect{font-size:7px}
 body.in-game .puzzle-intro{height:42px}
 body.in-game .puzzle-intro h2{font-size:19px}
 body.in-game .puzzle-intro p:not(.eyebrow){font-size:8px}
 body.in-game .how-to>span{font-size:9px}
 body.in-game .game-control{min-height:26px}
 body.in-game .game-message{font-size:9px}
}
@media(max-height:650px){
 body.in-game .game-heading .eyebrow{max-width:58vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .tutorial-panel{max-height:calc(100dvh - 24px);padding:10px 13px;overflow:auto}
 .tutorial-panel h2{font-size:22px}
 .tutorial-panel p{font-size:12px;margin:4px 0}
 .tutorial-tiles{margin:5px auto}
 .tutorial-tiles span{padding:6px 0}
 .tutorial-panel .gold-cta{min-height:44px;margin:5px auto;font-size:15px}
}
/* Game and overlay focus remain within the viewport on installation. */

/* Show short, readable gameplay instruction on narrow devices; keep full guide available via Aide. */
.how-to-short{display:none}
@media(max-width:820px){body.in-game .how-to-long{display:none}body.in-game .how-to-short{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:10px}}
@media(max-width:355px){body.in-game .how-to-short{font-size:9px}}

/* Small landscape screens: never present a microscopic, unplayable 7x6 grid. */
.rotate-overlay{display:none}
@media (orientation:landscape) and (max-height:500px){
 body.in-game .rotate-overlay{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:15px;background:linear-gradient(130deg,#170a3c,#52248d);text-align:center;overflow:hidden}
 .rotate-card{padding:14px 26px;max-width:500px;border:1px solid #f2cd83;border-radius:22px;background:#281251;color:#ffedc7;box-shadow:0 0 30px #e3a1563d}
 .rotate-card>span{display:block;font-size:32px}.rotate-card strong{font-size:24px}.rotate-card p{font-size:14px}
}
/* Keep the detailed lexicon notice available to screen readers. */
body.in-game .help-note{display:block;position:absolute;width:1px;height:1px;padding:0;margin:0;overflow:hidden;white-space:nowrap;clip-path:inset(50%);border:0}


/* V0.4.3 — stateful illustrated spell scenes; no layout box is added, so the 100dvh fit is unchanged. */
.castle-viewport{background:#201146!important}
.castle-viewport::before{content:"";position:absolute;inset:-14px;z-index:0;background-image:linear-gradient(180deg,#160d3a30,#160d3a27),var(--spell-scene-image);background-position:center;background-size:cover;filter:blur(12px) saturate(.94);opacity:.73;pointer-events:none}
.castle-viewport .castle-scene-image{position:absolute;inset:0;width:100%;height:100%;display:block;object-fit:contain;object-position:center;z-index:1;pointer-events:none;filter:saturate(1.07) contrast(1.02)}
.castle-viewport .castle-scene-image.scene-enter{animation:spell-scene-reveal .62s ease-out both}
.castle-viewport .castle-head{z-index:3;background:linear-gradient(90deg,#1b0a3be8,#1b0a3ba8,transparent)}
.castle-viewport .castle-light{z-index:2;pointer-events:none;background:linear-gradient(180deg,#12082c25,transparent 40%,#12082c44)}
.castle-viewport .castle-effect{z-index:3;backdrop-filter:blur(6px)}
.castle-viewport.stage-1::after,.castle-viewport.stage-2::after,.castle-viewport.stage-3::after{content:none!important}
.castle-viewport.stage-0{background:linear-gradient(180deg,#22124ac9,#19103332 58%,#17102fc9),url('assets/lettresia-world-v034.webp') 78% 42%/auto 135% no-repeat!important}
.castle-viewport.stage-0::before{opacity:0}
.castle-viewport.stage-0::after{content:'🌿'!important;z-index:2}
.castle-viewport.stage-4 .castle-scene-image{filter:saturate(1.2) brightness(1.13)}
@keyframes spell-scene-reveal{from{opacity:.32;transform:scale(1.045);filter:brightness(1.42) saturate(1.35)}to{opacity:1;transform:scale(1);filter:brightness(1) saturate(1.07)}}
@media(max-width:820px){body.in-game .castle-viewport .castle-scene-image{object-fit:cover;object-position:center 52%}body.in-game .castle-viewport::before{filter:blur(5px)}body.in-game .castle-head{background:linear-gradient(90deg,#190a39df,transparent)}body.in-game .castle-effect{background:#170a37de}}
@media(prefers-reduced-motion:reduce){.castle-viewport .castle-scene-image.scene-enter{animation:none!important}}

@media(max-width:820px){body.in-game .castle-viewport.stage-0{background-size:cover!important;background-position:80% 42%!important}}
