.tutorial-coach,.tutorial-load-error,.tutorial-brief{--lesson-ink:var(--atlas-ink,#183b30);--lesson-muted:var(--atlas-muted,#60563e);--lesson-paper:#f7f2eb;--lesson-line:#b29965;color:var(--lesson-ink);background:var(--lesson-paper) var(--atlas-paper);background-blend-mode:multiply;border:6px solid transparent;border-image:var(--atlas-frame) 120 180 / 12px / 0 stretch;color-scheme:light;scrollbar-color:#92703c #f6e7c7}
.tutorial-coach{top:152px;right:24px;width:min(370px,calc(100vw - 36px));max-height:calc(100dvh - 280px);overflow:auto;padding:18px 20px;outline:0}
.tutorial-coach h2{margin:0;font:700 26px/1.08 AtlasLoot,Georgia,serif;text-wrap:balance}
.world-game.edge-to-edge-map .tutorial-coach .tutorial-explanation{display:block;font:500 20px/1.4 AtlasLoot,Georgia,serif;margin:14px 0 0;color:var(--lesson-ink)}
.world-game.edge-to-edge-map .tutorial-coach .tutorial-instruction{font:700 20px/1.4 AtlasLoot,Georgia,serif;margin:14px 0 0;color:var(--lesson-ink)}
.tutorial-exit{font:600 18px/1.35 AtlasLoot,Georgia,serif;color:var(--lesson-ink);margin:0;min-height:44px;flex-shrink:0}
.tutorial-exit:hover{color:#21634d}
.tutorial-coach-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid var(--lesson-line);margin-top:16px;padding-top:6px;font:600 18px/1.35 AtlasLoot,Georgia,serif;color:var(--lesson-muted)}
.tutorial-coach-footer button{min-height:44px;padding:4px 6px;border:0;background:none;color:var(--lesson-ink);text-decoration:underline;text-underline-offset:4px;font:inherit;cursor:pointer}
.world-game.edge-to-edge-map .tutorial-coach .tutorial-resources{margin:0;color:var(--lesson-muted);font:500 18px/1.4 AtlasLoot,Georgia,serif;font-variant-numeric:tabular-nums}
.tutorial-card-key{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:14px 0 0;font:600 18px/1.35 AtlasLoot,Georgia,serif}
.tutorial-card-key dt{color:var(--lesson-muted);font-size:18px}
.tutorial-card-key dd{margin:3px 0 0;color:var(--lesson-ink);font-weight:650;overflow-wrap:anywhere}
.tutorial-coach.is-in-dialog{position:relative;top:auto;right:auto;width:100%;max-height:none;overflow:visible;margin:0 0 16px;z-index:auto;border:0;border-image:none;border-radius:10px;padding:16px 18px;background:var(--lesson-paper) var(--atlas-paper);flex:none;text-align:left}
.quest-reveal-dialog>.tutorial-coach.is-in-dialog{border:0;padding:16px 18px}
.tutorial-coach.is-battle{top:auto;bottom:18px;left:18px;right:auto;width:min(370px,calc(100vw - 36px));max-height:35dvh}
.tutorial-coach.is-complete{width:min(500px,calc(100vw - 32px));max-height:calc(100dvh - 32px)}
.tutorial-play{min-height:48px;background:#234b39;color:#fff0cc;border:3px double #bd9a4c}
.tutorial-play:hover{background:#2c5b43}
.tutorial-coach .tutorial-locate{min-height:44px;margin-top:12px;padding:9px 14px;border:1px solid #bda474;border-radius:6px;background:#e7d1a0;color:#183b30;font:700 20px/1.3 AtlasLoot,Georgia,serif;cursor:pointer}
.tutorial-coach .tutorial-locate{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;min-height:48px;border:2px solid #a67e2d;background:#234b39;color:#fff0cc}
.tutorial-coach .tutorial-locate:hover{background:#2c5b43}
.tutorial-locate svg{width:26px;height:26px;flex:none;fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
.world-game.edge-to-edge-map .tutorial-coach .tutorial-scroll-hint{margin:16px 0 0;padding:12px 14px;background:#ead59e;color:#183b30;font:700 21px/1.3 AtlasLoot,Georgia,serif;text-wrap:pretty}
/* Dark and light edges stay distinct against both foliage and parchment. */
body.has-tutorial [data-tutorial-target]{outline:4px solid #fff0bf!important;outline-offset:4px!important;box-shadow:0 0 0 9px #17372b!important;scroll-margin-block:140px 100px}
body.has-tutorial .world-cell[data-tutorial-target]{outline:4px solid #fff0bf!important;outline-offset:-7px!important;box-shadow:inset 0 0 0 11px #17372b!important;background:#fff0bf30!important}
body.has-tutorial [data-tutorial-area]{border:3px solid #17372b!important;outline:3px solid #e2b851;outline-offset:3px}
.tutorial-focus-ring{position:fixed;z-index:109;box-sizing:border-box;pointer-events:none;border:4px solid #fff0bf;border-radius:14px;outline:4px solid #17372b;outline-offset:0;box-shadow:0 0 0 9999px #0b211e66}
.world-game.edge-to-edge-map.has-tutorial .map-hud-resources{pointer-events:none}
.world-game.edge-to-edge-map.has-tutorial .map-hud-resources button.is-finish{pointer-events:auto}
.tutorial-load-error h1{font:700 32px/1.1 AtlasLoot,Georgia,serif}
.tutorial-load-error p{font:500 20px/1.4 AtlasLoot,Georgia,serif}
:is(.tutorial-coach,.tutorial-load-error,.tutorial-brief) :is(a,button,summary):focus-visible{outline:3px solid #21634d;outline-offset:3px}
[data-tutorial-target]{scroll-margin-block:160px 40px}
.world-game.edge-to-edge-map dialog.tutorial-brief{width:min(760px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 32px);height:auto;inset:0;margin:auto;padding:24px 32px;box-sizing:border-box;overflow:auto;background:var(--lesson-paper) var(--atlas-paper);background-blend-mode:multiply;color:var(--lesson-ink);border:8px solid transparent;border-image:var(--atlas-frame) 120 180 / 14px / 0 stretch;border-radius:14px;box-shadow:none;font:500 22px/1.4 AtlasLoot,Georgia,serif;scrollbar-color:#92703c #f6e7c7;text-align:left;color-scheme:light}
.tutorial-brief :is(h1,h2)[tabindex="-1"]:focus{outline:none}
.tutorial-brief::backdrop{background:#14231d55}
body.world-game.edge-to-edge-map.has-tutorial dialog.tutorial-brief :is(a,button,summary):focus-visible{outline:3px solid #21634d;outline-offset:3px}
body.world-game.edge-to-edge-map.has-tutorial dialog.tutorial-brief .expedition-guide summary:focus-visible{outline-color:#21634d}
.tutorial-brief>header{display:flex;align-items:baseline;justify-content:space-between;gap:18px}
.tutorial-brief h1,.tutorial-brief h2{color:var(--lesson-ink);font:700 36px/1.12 AtlasLoot,Georgia,serif;margin:0;text-wrap:balance}
.tutorial-brief>h2{font-size:28px;margin:22px 0 10px}
.world-game.edge-to-edge-map dialog.tutorial-brief p{max-width:68ch;margin:12px 0;color:var(--lesson-ink);font:inherit}
.world-game.edge-to-edge-map dialog.tutorial-brief .tutorial-lead{font-size:24px;line-height:1.35;color:var(--lesson-ink)}
.tutorial-resource-guide{margin:18px 0;display:grid;gap:0;border-block:1px solid var(--lesson-line)}
.tutorial-resource-guide>div{display:grid;grid-template-columns:160px 1fr;gap:20px;padding:12px 0}
.tutorial-resource-guide>div+div{border-top:1px solid #b2996580}
.tutorial-resource-guide dt{font-weight:700;color:var(--lesson-ink)}
.tutorial-resource-guide dd{margin:0;color:var(--lesson-ink)}
.world-game.edge-to-edge-map dialog.tutorial-brief .tutorial-safety{font-size:18px;color:var(--lesson-muted)}
.tutorial-brief footer{display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-top:20px}
.tutorial-brief :is(button,a){font:700 21px/1.3 AtlasLoot,Georgia,serif;text-underline-offset:4px;touch-action:manipulation}
.tutorial-brief a{color:var(--lesson-ink)}
.tutorial-brief button{display:inline-flex;align-items:center;justify-content:center;min-height:48px;padding:10px 16px;border:1px solid #ae9060;border-radius:7px;background:#efddb7;color:var(--lesson-ink);cursor:pointer}
.tutorial-brief button:hover{background:#e7d1a0}
.tutorial-brief .tutorial-primary{display:inline-flex;align-items:center;justify-content:center;min-height:48px;padding:10px 18px;box-sizing:border-box;background:#234b39;color:#fff0cc;border:3px double #bd9a4c;border-radius:7px;text-decoration:none}
.tutorial-brief .tutorial-primary:hover{background:#2c5b43}
.world-game.edge-to-edge-map dialog.tutorial-brief li{margin-block:12px;padding-left:4px;color:var(--lesson-ink);font:inherit}
.tutorial-brief .expedition-guide{background:transparent;padding-inline:0}
.tutorial-brief :is(ul,ol){padding-left:24px}
.tutorial-check{margin:26px 0 0;padding:16px 0 0;border:0;border-top:1px solid var(--lesson-line)}
.tutorial-check legend{font-weight:650;padding:0 0 12px}
body.world-game.edge-to-edge-map.has-tutorial dialog.tutorial-brief .tutorial-check legend{color:var(--lesson-ink)}
.tutorial-check button{margin:0 8px 8px 0;text-align:left}
.tutorial-check p:empty{display:none}
:is(.tutorial-coach,.tutorial-brief,.tutorial-load-error)::selection,:is(.tutorial-coach,.tutorial-brief,.tutorial-load-error) ::selection{background:#234b39;color:#fff0cc}
/* Teaching text stays readable; short screens scroll instead of hiding it. */
.has-tutorial #game-dialog:has(>.tutorial-coach){max-height:calc(100dvh - 24px);overflow-y:auto}
/* The coach needs real space: avoid shrinking the bag behind its supplies. */
.world-game.edge-to-edge-map.has-tutorial dialog.equipment-dialog:not(.restart-dialog){height:auto;overflow-y:auto}
.world-game.edge-to-edge-map.has-tutorial .equipment-dialog .collection{flex:none;height:auto;overflow:visible}
.world-game.edge-to-edge-map.has-tutorial .arsenal-workspace{height:auto}
.world-game.edge-to-edge-map.has-tutorial .arsenal-workspace>div{overflow:visible}
.world-game.edge-to-edge-map.has-tutorial .arsenal-workspace :is(.equipment-bag,.equipment-grid){flex:none;overflow:visible;max-height:none}
.has-tutorial #game-dialog.quest-reveal-dialog:has(>.tutorial-coach){display:block;height:auto;padding:12px;max-height:calc(100dvh - 24px)}
.has-tutorial #game-dialog.quest-reveal-dialog .quest-card-front{max-height:none;height:auto;overflow:visible}
.has-tutorial #game-dialog.quest-reveal-dialog .quest-flight,.has-tutorial #game-dialog.quest-reveal-dialog .quest-flip{height:auto;max-height:none;overflow:visible}
.has-tutorial #game-dialog.quest-reveal-dialog :is(.quest-illustration,.fighter-card-whole){width:auto;max-width:100%;height:clamp(160px,36dvh,330px);margin-inline:auto;object-fit:contain}
@media(max-width:600px){
 .tutorial-coach{top:142px;right:12px;width:calc(100vw - 24px);max-height:calc(100dvh - 270px);padding:14px 16px}
 .tutorial-coach h2{font-size:24px}
 .world-game.edge-to-edge-map .tutorial-coach .tutorial-explanation,.world-game.edge-to-edge-map .tutorial-coach .tutorial-instruction{font-size:20px;margin-top:10px}
 .tutorial-coach.is-battle{left:12px;bottom:12px;width:calc(100vw - 24px);max-height:31dvh}
 .tutorial-coach.is-in-dialog{top:auto;max-height:none;margin-bottom:12px;padding:12px 14px}
 .world-game.edge-to-edge-map dialog.tutorial-brief{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:22px 18px;font-size:20px}
 .tutorial-brief>header{align-items:flex-start;gap:10px}
 .tutorial-brief h1,.tutorial-brief h2{font-size:30px}
 .tutorial-brief>h2{font-size:26px}
 .world-game.edge-to-edge-map dialog.tutorial-brief .tutorial-lead{font-size:22px}
 .tutorial-resource-guide>div{grid-template-columns:1fr;gap:4px;padding:12px 0}
 .tutorial-brief footer{align-items:stretch;flex-direction:column}
 .tutorial-brief footer :is(a,button){text-align:center;justify-content:center;min-height:44px}
}
