*{box-sizing:border-box}body{margin:0;background:#0c1120;color:#fff1d5;font-family:system-ui,"Malgun Gothic",sans-serif;min-height:100svh;display:grid;place-items:center}main{width:min(1120px,96vw,calc((100svh - 95px)*1.778));margin:auto}header,footer{display:flex;align-items:center;justify-content:space-between;color:#9fa7bb;font-size:12px;letter-spacing:.08em}header{height:52px}header strong{font: bold 15px monospace;color:#efdbbe;letter-spacing:.12em}header i{color:#ffca78;font-size:24px;vertical-align:middle}footer{height:38px;font-size:11px}#screen{position:relative;aspect-ratio:16/9;overflow:hidden;container-type:inline-size;background:#171b47;outline:1px solid #55556d;box-shadow:0 12px 50px #0005}#world,#ui{position:absolute;inset:0;width:100%;height:100%}canvas{image-rendering:pixelated}.title{position:absolute;left:9%;top:12%;z-index:1}.title small,article small,.prompt small{font:bold clamp(10px,1.3cqw,16px) monospace;letter-spacing:.12em;color:#ffdb99}.title h1{font-size:8.4cqw;line-height:.99;letter-spacing:-.09em;margin:2.3cqw 0;color:#ffecce;font-weight:1000;text-shadow:0 .35cqw #9d6370,.45cqw .63cqw #30243f}.title em{font-style:normal;color:#ffcf79}.title p{font-size:1.55cqw;text-shadow:1px 2px #24273e}.crew{position:absolute;right:7%;bottom:8%;display:flex;align-items:end}.sprite{width:10cqw;height:auto;vertical-align:bottom}.crew .sprite{width:7.5cqw;animation:hop 1.4s steps(2) infinite}.crew div:nth-child(even) .sprite{animation-delay:-.7s}@keyframes hop{50%{transform:translateY(-3px)}}button{font:700 clamp(12px,1.7cqw,20px) system-ui;color:#ffedcd;background:#252842;border:2px solid #8e849e;padding:.65em 1em;cursor:pointer;touch-action:manipulation}button:hover,button:focus-visible{border-color:#ffcf76;outline:2px solid #ffcf76}button.gold{background:#ffcb74;color:#362940;border:3px solid #473449;box-shadow:inset 0 3px #ffe6a2,0 4px #261f39;padding:.52em 1.8em}.home .gold{font:bold 2.1cqw monospace;letter-spacing:.12em}.panel{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2cqw;background:#12192e55}.panel h2{font-size:3cqw;margin:0;text-shadow:0 2px #29263a}.cards,.stages{display:flex;gap:1cqw;width:88%;justify-content:center}.cards button{flex:1;min-width:0;background:#222940eF}.cards span,.cards b,.cards small{display:block}.cards b{font-size:2.4cqw;margin:.5em}.cards span{font-size:1.4cqw}.cards small{color:#ffcf85;margin-top:.8em}.stages{flex-direction:column;width:60%;gap:.5cqw}.stages button{padding:.4em}.stages button:disabled{color:#a9a9b6;background:#25283b;opacity:.85}.back{font-size:max(11px,1.25cqw);padding:.4em .8em}.story article,.prompt{display:flex;align-items:center;background:#1a2037f2;border:2px solid #a89791;padding:2.2cqw;gap:2cqw}.story article{width:80%}.story article p{line-height:1.7;font-size:max(13px,1.7cqw)}.story article h2{margin-top:1cqw}.hud{position:absolute;top:3%;left:3%;right:3%;display:flex;align-items:center;justify-content:space-between;padding:.5em 1em;background:#181d34ef;font-size:max(13px,1.7cqw)}.hp{color:#ff93a3}.prompt{position:absolute;top:49%;left:50%;transform:translate(-50%,-50%);z-index:1;width:max-content;max-width:91%;pointer-events:none;padding:.5cqw 2cqw;font-size:max(12px,1.5cqw)}.prompt .sprite{width:6cqw}.english{font-size:max(17px,2.5cqw);font-weight:750}.english b{color:#ffcc76}.field{position:absolute;inset:15% 3% 9%}.token{position:absolute;z-index:2;border-color:#ddbb87;background:#2f304b;box-shadow:2px 3px #181a30;min-height:36px;padding:.3em .75em}.note{position:absolute;bottom:2%;left:0;right:0;text-align:center;font-size:max(11px,1.4cqw);text-shadow:1px 2px #111}.field{pointer-events:none}.token{pointer-events:auto}.play .field{clip-path:inset(0)}@media(max-aspect-ratio:1/1){main{width:98vw}#screen{aspect-ratio:1.32}.title{top:15%}.title h1{font-size:12cqw}.title p,.cards span{font-size:2.7cqw}.home .gold{font-size:4cqw}.cards{width:95%;gap:1%}.cards button{padding:.5em .15em}.cards b{font-size:4cqw}.crew{right:3%}.panel h2{font-size:5cqw}.prompt{gap:1cqw}.prompt small{letter-spacing:0}.stages{width:85%}}@media(max-height:540px) and (orientation:landscape){main{width:min(100vw,177.78svh)}header,footer{display:none}}@media(prefers-reduced-motion:reduce){.crew .sprite{animation:none}}
.play:not(.reading) .prompt{top:16%;left:4%;right:4%;height:19%;width:auto;max-width:none;transform:none;justify-content:center}
.play:not(.reading) .field{inset:38% 4% 10%;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:clamp(3px,.7cqw,8px);padding:clamp(4px,.8cqw,10px);background:#191c32ed;border:1px solid #827792;clip-path:none}
.field .token{position:static;min-width:0;min-height:0;padding:.2em;line-height:1.1;font-size:clamp(12px,1.65cqw,20px);overflow-wrap:anywhere}
@media(max-aspect-ratio:1/1){#screen:has(.play:not(.reading)){aspect-ratio:3/4}.play:not(.reading) .field{grid-template-columns:repeat(4,minmax(0,1fr))}}
.review{max-height:24cqw;overflow:auto;color:#ffead0;background:#11192c;padding:0 1em;font-size:clamp(13px,1.5cqw,18px);margin:.5em 0;overscroll-behavior:contain}
.review li{padding:.4em}.story article:has(.review){padding:1cqw 2cqw}.story article:has(.review) p{margin:.2em 0}.story article:has(.review)>div{flex:1}
@media(max-aspect-ratio:1/1){.play .prompt .sprite{width:9cqw}.review{max-height:28cqw}}

.fighter{display:inline-block;flex:none;aspect-ratio:1;height:auto;background-image:url("assets/fighters.png");background-size:400% 400%;background-repeat:no-repeat;image-rendering:pixelated}
.cards .fighter{display:inline-block;width:13cqw}.prompt .fighter{width:7cqw}.crew .fighter{width:9cqw}

#sound{position:absolute;right:1%;bottom:1%;font:700 clamp(10px,1.15cqw,14px) monospace;padding:.35em .55em;color:#ffdb99;background:#181d34;border:1px solid #8e849e}

.expedition{position:absolute;bottom:6%;left:2%;width:29%;height:16%;pointer-events:none;z-index:0}
.expedition canvas{width:100%;height:100%;image-rendering:pixelated}
.expedition .explorer{position:absolute;bottom:7%;width:14%;transition:left .4s}
.expedition small{position:absolute;left:4%;top:0;color:#ffdf9f;text-shadow:1px 1px #19182b;font-weight:bold;font-size:clamp(9px,1cqw,14px)}
.play:not(.reading) .expedition{top:41%;left:1%;bottom:auto;width:20%;height:15%}
.play:not(.reading) .expedition small{display:none}
.play .prompt{z-index:2}
.reading .expedition{top:13%;bottom:auto;left:18%;width:64%;height:33%;background:#191c3288}
.expedition.climax{background:linear-gradient(transparent,#e8b07455)}
.readout{position:absolute;top:47%;left:7%;width:86%;bottom:6%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5cqw;text-align:center;background:#191e34ed;border:2px solid #ddbb87;padding:1cqw}
.readout .translation{font-size:clamp(13px,1.9cqw,23px);color:#ffe1a7}
.readout .reward{font-size:clamp(10px,1.35cqw,16px);color:#bcc7ce}
.reading-controls{display:flex;gap:1cqw;margin-top:.5cqw}.reading-controls button{font-size:clamp(11px,1.35cqw,17px);padding:.4em .8em}
.focused .face{position:relative}.focused .face:after{content:attr(data-power);position:absolute;right:0;bottom:0}.focused .prompt{border-color:#8ee3cf}
#living-world,#spark-layer{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#spark-layer{z-index:4;overflow:hidden}#spark-layer i{position:absolute;width:clamp(3px,.48cqw,6px);aspect-ratio:1}
@media(prefers-reduced-motion:no-preference){
 .crew{animation:party-walk 8s ease-in-out infinite alternate}
 .crew .sprite{animation:arcade-stride .58s steps(3) infinite alternate, walk-frame .58s steps(1,end) infinite}
 .crew div:nth-child(2n) .sprite{animation-delay:-.32s}
 .cards button .fighter,.story article>.fighter{animation:ready-breathe 1.7s ease-in-out infinite alternate;transform-origin:50% 94%}
 .cards button:nth-child(2n) .fighter{animation-delay:-.8s}
 .cards button:is(:hover,:focus-visible) .fighter{animation:hero-salute .52s ease-out infinite alternate;filter:drop-shadow(0 0 4px #ffcd80)}
 .story article,.readout{animation:scene-arrives .33s ease-out}
 .stages button:not(:disabled){transition:transform .15s,background .15s}
 .stages button:not(:disabled):is(:hover,:focus-visible){transform:translateX(4px);background:#424160}
 .expedition .explorer{animation:ready-breathe 1s ease-in-out infinite alternate;transform-origin:50% 96%}
 .reading .explorer{animation:hero-salute .48s ease-out 2 alternate}
 .focused .face:after{animation:focus-orbit 1.2s ease-in-out infinite alternate}
}
@keyframes party-walk{from{transform:translateX(0)}to{transform:translateX(-5cqw)}}
@keyframes arcade-stride{to{transform:translateY(-.6cqw) rotate(-3deg)}}
@keyframes ready-breathe{to{transform:translateY(-2px) scale(1.018,.988)}}
@keyframes hero-salute{to{transform:translateY(-.65cqw) rotate(-4deg)}}
@keyframes scene-arrives{from{opacity:.5;translate:0 6px}to{opacity:1;translate:0 0}}
@keyframes focus-orbit{to{transform:translate(3px,-5px) rotate(12deg)}}

@keyframes walk-frame{0%,100%{background-position-x:0%}50%{background-position-x:33.333333%}}
.mistake{width:min(78%,520px);color:#fff1dc;background:#24253e;border:2px solid #edac92;padding:clamp(12px,2cqw,24px);line-height:1.5}
.mistake::backdrop{background:#0c1027ba}.mistake h2{margin:0;color:#ffd2a4;font-size:clamp(17px,2.6cqw,26px)}.mistake p{margin:.55em 0}.mistake button{margin-top:.3em}
.review summary{cursor:pointer;padding:.35em 0;color:#ffdf9d}.review details p{font-size:inherit;line-height:1.55}.review details dl{display:flex;flex-wrap:wrap;gap:.4em;margin:.4em 0 1em}.review dl div{border:1px solid #55536d;padding:.25em .45em}.review dt{font-weight:700;color:#b4dcff}.review dd{margin:0}
#world{background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#292744}
#screen:has(.play) #world{filter:brightness(.71) saturate(.88)}
#screen:has(.home) #ui{background:linear-gradient(90deg,#171732b8,transparent 72%)}
#screen:has(.panel) #ui{background:linear-gradient(0deg,#17132a77,#17132a18)}
#spark-layer .relic-spark{width:clamp(13px,2.7cqw,32px);background-size:500% 500%;image-rendering:pixelated;background-color:transparent!important}
.field .token{border:2px solid #262037;border-top-color:#f6ce91;border-left-color:#cca47a;background:linear-gradient(#454360 0 12%,#302d49 12% 85%,#262239 85%);box-shadow:2px 3px #1d192e;color:#fff2cc;text-shadow:1px 1px #171528}
.expedition{filter:drop-shadow(1px 2px 1px #171529)}.reading .expedition{border:2px solid #b99c79;background-size:cover;background-position:center 67%}

/* Warm ink and paper tones on the title screen. */
body:has(.home) { background: #faf3e9; }
body:has(.home) :is(header, footer, header strong) { color: #594036; }
body:has(.home) header i { color: #965943; }
#screen:has(.home) #ui {
  background: linear-gradient(90deg, #39241ff2, #513429b8 42%, transparent 78%);
}
.home .title h1 { color: #fff4e4; text-shadow: 0 .35cqw #8b5143, .45cqw .63cqw #3d2823; }
.home .title em, .home .title small { color: #f5c499; }
.home .gold { background: #eec6a0; color: #3d2823; border-color: #58382f; }
