/* Title and Continue. The rescue illustration stays whole; the copy column sits on
   warm paper at its left. A saved run gets its own card with Continue as the main
   action; starting over is a quieter, separate control. */
html:has(.title-cover),body:has(.title-cover){overflow:hidden}
.cover-mobile-hint{display:none}
.overlay:has(.title-cover){position:fixed;inset:0;z-index:45;height:100dvh;padding:20px;background:radial-gradient(ellipse at 50% 45%,#2b3c37,#121918 75%);backdrop-filter:none;display:flex;align-items:center;justify-content:center;overflow:hidden}
.title-cover{position:relative;isolation:isolate;width:min(1180px,96vw,calc((100dvh - 40px) * 1.77778));aspect-ratio:16/9;overflow:hidden;background:#f8e7bf;border:3px solid var(--frame-dark);border-radius:8px;box-shadow:0 0 0 2px #d8c487 inset,0 0 0 2px #d8c487,10px 10px 0 #00000066;text-align:left;color:var(--ink);font-family:var(--font-ui)}
.title-cover::before{content:'';position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#fbefd2 0%,#fbefd2e6 26%,#fbefd28c 36%,#fbefd200 48%);pointer-events:none}
.cover-art{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:-2;pointer-events:none}
.cover-copy{position:absolute;left:5%;top:9%;width:34%;height:84%;display:flex;flex-direction:column;align-items:flex-start;gap:0}
.cover-kicker{padding-bottom:7px;border-bottom:3px solid var(--leaf);color:var(--leaf-dark);font-size:clamp(11px,1.2vw,15px);font-weight:900;letter-spacing:3px}
.cover-copy h2{margin:clamp(10px,1.8vw,22px) 0 clamp(8px,1.2vw,14px);color:#1f3a2c;font-size:clamp(32px,5.4vw,72px);font-weight:950;line-height:1.04;letter-spacing:5px;text-shadow:3px 3px 0 #fff3d0,5px 5px 0 #e9c46a;font-family:var(--font-ui)}
.cover-copy h2 span{display:block}
.cover-story{margin:0 0 clamp(10px,1.6vw,20px);color:var(--ink-2);font-size:clamp(12px,1.25vw,16px);font-weight:700;line-height:1.75;text-shadow:0 1px #fff4d3}
.cover-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;width:100%}
.cover-actions .primary,.cover-save .primary{display:flex;justify-content:space-between;align-items:center;gap:16px;width:min(100%,290px);min-height:52px;margin:0;padding:10px 18px;border:2px solid var(--leaf-dark)!important;border-bottom-width:5px!important;border-radius:7px!important;background:var(--leaf);color:#fff6da;font-size:17px;font-weight:900;box-shadow:0 0 0 2px #fff3d0;touch-action:manipulation}
.cover-actions .primary:hover,.cover-save .primary:hover{background:#4a7d52;filter:none}
.cover-actions .primary:active,.cover-save .primary:active{transform:translateY(2px);border-bottom-width:3px!important}
.cover-help,.cover-restart{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:7px 14px;border:2px solid #9b8c5e;border-radius:6px;background:#fdf4dcee;color:var(--ink);font-size:13px;font-weight:800;touch-action:manipulation}
.cover-restart{border-color:#b9867a;color:#7d3a33;background:#fdf1ea}
.cover-restart::before{content:'↺';font-size:15px;line-height:1}
.cover-sandbox{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:7px 14px;border:2px solid #6f8f78;border-radius:6px;background:#eef5e2ee;color:var(--leaf-dark);font-size:13px;font-weight:800;touch-action:manipulation}
.cover-sandbox::before{content:'';flex:none;width:14px;height:14px;background:currentColor;clip-path:polygon(38% 0,62% 0,62% 38%,100% 38%,100% 62%,62% 62%,62% 100%,38% 100%,38% 62%,0 62%,0 38%,38% 38%)}
.cover-sandbox:hover{background:#e2eecb}
.cover-help::before{content:'?';display:inline-grid;place-items:center;width:17px;height:17px;border-radius:50%;background:var(--ink-2);color:var(--cream);font-size:11px;font-weight:900}
/* Boot splash in index.html: the cover shows while the scripts load. */
.cover-loading{display:flex;align-items:center;gap:10px;min-height:52px;color:var(--leaf-dark);font-size:15px;font-weight:900}
.cover-loading i{position:relative;width:96px;height:8px;overflow:hidden;border:2px solid var(--leaf-dark);border-radius:5px;background:#fff6dc}
.cover-loading i::after{content:'';position:absolute;top:0;bottom:0;left:-40%;width:40%;background:var(--leaf);animation:cover-load 1.1s ease-in-out infinite}
@keyframes cover-load{to{left:100%}}
@media (prefers-reduced-motion:reduce){.cover-loading i::after{animation:none;left:0;width:100%;opacity:.5}}
.cover-hint{margin:12px 0 0;color:var(--ink-3);font-size:12px;font-weight:700;line-height:1.6}
.cover-hint a{display:inline-flex;align-items:center;min-height:32px;color:var(--leaf-dark)!important;font-weight:900;text-decoration:underline;text-underline-offset:3px}
.cover-edition{position:absolute;right:22px;bottom:16px;color:#fff6d2;font-size:10px;font-weight:900;letter-spacing:3px;text-shadow:1px 2px #29493c}
.title-cover button:focus-visible,.title-cover a:focus-visible{outline:3px solid #f0a842;outline-offset:3px}
/* Saved run card */
.cover-save{display:flex;flex-direction:column;gap:6px;width:min(100%,320px);margin:0 0 10px;padding:10px 12px 12px;border:3px solid var(--frame-dark);border-radius:8px;background:#fffaf0f2;box-shadow:0 0 0 2px #d8c487 inset,4px 4px 0 #00000033}
.cover-save-label{color:#a08548;font-size:11px;font-weight:900;letter-spacing:1px}
.cover-save-info{display:flex;flex-direction:column;gap:1px;margin:0;color:var(--ink-2);font-size:13px;font-weight:700;line-height:1.45}
.cover-save-info b{color:var(--ink);font-size:16px;font-weight:900}
.cover-save .primary{width:100%;font-size:18px}
.has-save .cover-copy{top:6%;height:90%}
.has-save .cover-copy h2{margin:10px 0 12px;font-size:clamp(30px,4.6vw,62px)}
.has-save .cover-story{display:none}

@media (max-width:780px),(pointer:coarse),(max-width:1100px) and (max-height:600px){
 .cover-desktop-hint{display:none}.cover-mobile-hint{display:inline}
 .overlay:has(.title-cover){height:var(--game-vh,100dvh);width:var(--game-vw,100vw);padding:0}
 .title-cover{width:100%;height:100%;aspect-ratio:auto;border:0;border-radius:0;box-shadow:none;background:#fbefd2}
 .title-cover::before{display:none}
 /* The artwork keeps its proportions at the right and fades into the paper. */
 .cover-art{left:auto;right:0;width:min(100%,calc(var(--game-vh,100dvh) * 1.77683));height:100%;object-fit:contain;object-position:right center;-webkit-mask-image:linear-gradient(90deg,transparent 0%,#000 26%);mask-image:linear-gradient(90deg,transparent 0%,#000 26%)}
 .cover-copy{left:max(5%,calc(env(safe-area-inset-left,0px) + 16px));top:max(7%,env(safe-area-inset-top,0px));width:37%;height:88%}
 .cover-kicker{padding-bottom:4px;font-size:11px;letter-spacing:2px;border-bottom-width:2px}
 .cover-copy h2{margin:8px 0 8px;font-size:clamp(30px,8.4vh,46px);letter-spacing:3px;text-shadow:2px 2px 0 #fff3d0,4px 4px 0 #e9c46a}
 .cover-story{margin:0 0 12px;font-size:12px;line-height:1.65}
 /* The main action keeps its own row; the quieter buttons share the next one. */
 .cover-actions{flex-wrap:wrap;gap:8px;max-width:300px}
 .cover-actions .primary{flex:1 0 100%;width:100%;min-width:0;min-height:48px;padding:8px 14px;font-size:15px}
 .cover-help,.cover-restart,.cover-sandbox{flex:1 1 0;min-width:0;min-height:44px;padding:6px 11px;font-size:13px;white-space:nowrap}
 .cover-hint{margin-top:8px;max-width:270px;font-size:11px;line-height:1.5}
 .cover-edition{right:max(12px,env(safe-area-inset-right,0px));bottom:max(10px,env(safe-area-inset-bottom,0px));font-size:8px;letter-spacing:1px}
 .has-save .cover-copy{top:max(5%,env(safe-area-inset-top,0px));height:92%}
 .has-save .cover-copy h2{margin:6px 0 8px;font-size:clamp(28px,7.6vh,40px)}
 .cover-save{width:100%;max-width:300px;margin-bottom:8px;padding:8px 10px 10px;gap:5px}
 .cover-save-info{font-size:12px}.cover-save-info b{font-size:14px}
 .cover-save .primary{min-height:48px;font-size:16px}
 .has-save .cover-actions{width:100%;max-width:300px}
 .has-save .cover-actions{gap:6px}
 .has-save .cover-actions>*{flex:1 1 0;padding:6px 4px;font-size:12px;gap:4px}
 .has-save .cover-restart::before{font-size:13px}.has-save .cover-help::before{width:14px;height:14px;font-size:10px}.has-save .cover-sandbox::before{width:11px;height:11px}
}
@media (max-height:340px) and (orientation:landscape){
 .cover-copy{top:5%;height:92%;width:40%}
 .cover-kicker{display:none}
 .cover-copy h2{margin:0 0 6px;font-size:30px;letter-spacing:2px}.cover-copy h2 span{display:inline}
 .cover-story{margin-bottom:8px;font-size:11px;line-height:1.55}
 .cover-actions .primary{min-width:150px;min-height:46px;font-size:14px}
 .cover-help,.cover-restart,.cover-sandbox{padding:5px 9px;font-size:12px}
 .cover-actions{gap:6px}
 .cover-hint{margin-top:6px;font-size:10px}.cover-hint a{min-height:28px}
 .cover-edition{display:none}
 .has-save .cover-copy{top:4%;height:94%}
 .has-save .cover-copy h2{margin:0 0 5px;font-size:27px}
 .cover-save{margin-bottom:6px;padding:6px 9px 8px;gap:3px}
 .cover-save-label{font-size:10px}.cover-save-info{font-size:11px;line-height:1.35}.cover-save-info b{font-size:13px}
 .cover-save .primary{min-height:44px;padding:6px 12px}
}
