:root { color-scheme: dark; font-family: 'Segoe UI', Arial, sans-serif; --ivory: #f2f1e7; --muted: #c3c6b9; --gold: #cfb78a; --panel: #111d1bee; }
* { box-sizing: border-box; }
body { margin: 0; background: #151b17; color: var(--ivory); overflow: hidden; }
#game { position: relative; width: 100%; height: 100vh; height: 100svh; min-height: 280px; overflow: hidden; }
#world { display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -4px; }
.vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 140px #050b0855; background: linear-gradient(#060d1266, transparent 23% 77%, #070e11bb); }
.topbar { position: absolute; inset: 0 0 auto; padding: 28px 36px; display: flex; align-items: center; gap: 25px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.wordmark { color: var(--ivory); text-decoration: none; font-family: Georgia, serif; font-size: 25px; letter-spacing: 5px; text-shadow: 0 2px 14px #000; }
.wordmark span { display: block; font: 8px/2.5 'Segoe UI', sans-serif; letter-spacing: 4px; color: var(--gold); }
.hud { display: flex; gap: 32px; margin-left: auto; padding: 12px 25px; background: #111b184f; border: 1px solid #c7d3bd1f; backdrop-filter: blur(12px); }
.hud div > span { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); margin-bottom: 4px; }
.hud strong { font-size: 25px; font-weight: 400; font-variant-numeric: tabular-nums; }
.hud small { font: 10px 'Segoe UI', sans-serif; color: var(--muted); }
button, select, input { font: inherit; }
button { color: var(--ivory); min-height: 44px; padding: 10px 18px; border: 1px solid #ccd4bf44; background: #101b1877; cursor: pointer; transition: background .2s, border-color .2s; touch-action: manipulation; }
button:hover:not(:disabled) { background: #38463bea; border-color: var(--gold); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid #f6d68b; outline-offset: 4px; }
.icon-button { width: 48px; padding: 10px; font-size: 21px; }
.overlay { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; padding: 105px 8vw 80px; background: linear-gradient(90deg, #07120fec, #0b171aad 43%, #101c1710 85%); animation: reveal .55s ease-out; overflow-y: auto; }
[hidden] { display: none !important; }
.menu-card { max-width: 470px; margin: auto 0; }
.eyebrow { font-size: 9px; letter-spacing: 4px; color: var(--gold); font-weight: 600; margin-bottom: 20px; }
h1 { font: 400 clamp(44px, 6vw, 88px)/.98 Georgia, 'Times New Roman', serif; letter-spacing: -2px; margin: 0 0 24px; text-shadow: 0 5px 30px #0003; }
.menu-card > p { color: #cbd0c3; font-size: 14px; line-height: 1.9; max-width: 385px; }
.menu-rule { width: 55px; height: 1px; background: var(--gold); margin: 24px 0; }
.menu-card .instructions { font-size: 12px; color: #b5c1b5; line-height: 1.9; }
kbd { font: inherit; color: var(--ivory); }
.primary { background: #d4bd87; border-color: #d4bd87; color: #17211a; min-width: 260px; padding: 17px 23px; margin-top: 16px; font-size: 12px; font-weight: 600; letter-spacing: 1.5px; text-align: left; }
.primary span { float: right; margin-left: 40px; font-size: 17px; }
.primary:hover:not(:disabled) { color: white; }
.menu-actions { display: flex; gap: 24px; margin-top: 10px; }
.menu-actions button { background: none; border: 0; padding: 10px 0; font-size: 11px; color: #d3d6c7; }
.menu-footnote { display: block; font-size: 8px; letter-spacing: 1.8px; margin-top: 24px; color: #9ea995; }
.bottom-bar { position: absolute; bottom: 0; left: 0; right: 0; padding: 22px 36px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.location { display: grid; gap: 6px; font-size: 9px; letter-spacing: 2px; }
.location small { font-size: 8px; color: var(--gold); letter-spacing: 1px; }
.desktop-hint { font-size: 11px; color: #c0c8b7; }
.desktop-hint span { margin: 0 12px; color: var(--gold); }
.quick-actions { display: flex; gap: 8px; }
.quick-actions button { font-size: 10px; padding: 8px 13px; background: #111b1877; }
.objective { position: absolute; top: 135px; right: 37px; display: flex; align-items: center; gap: 10px; font-size: 11px; color: #e1e4d5; text-shadow: 0 1px 6px black; }
.gold-dot { width: 6px; height: 6px; background: var(--gold); border-radius: 50%; }
#bearing { display: inline-block; color: var(--gold); font-size: 24px; margin-left: 5px; }
#notice { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); text-align: center; letter-spacing: 3px; text-transform: uppercase; color: #f3dfb3; font-size: 12px; padding: 13px 25px; background: #15251bd9; border-bottom: 1px solid var(--gold); opacity: 0; transition: opacity .4s; pointer-events: none; z-index: 2; white-space: nowrap; }
#notice.visible { opacity: 1; }
#settings { justify-content: center; background: #08120fd9; backdrop-filter: blur(12px); padding: 24px; z-index: 7; }
.settings-card { width: min(100%, 440px); margin: auto; padding: 30px; background: var(--panel); border: 1px solid #8f9d7c55; }
h2 { font: 34px Georgia, serif; margin: 0 0 25px; }
.settings-card label { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid #b2c3a722; padding: 15px 0; font-size: 12px; }
select { background: #253027; border: 1px solid #778467; color: var(--ivory); padding: 9px; max-width: 65%; font-size: 11px; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--gold); }
.settings-card p { font-size: 11px; color: #b9c4b3; line-height: 1.8; }
#graphicsInfo { color: var(--gold); }
#errorPanel { z-index: 10; background: #111a17; padding: 20px; }
.touch-controls { position: absolute; bottom: 96px; left: 24px; right: 24px; display: none; align-items: center; justify-content: space-between; pointer-events: none; }
.touch-controls button { pointer-events: auto; width: 76px; height: 66px; border-radius: 50%; font-size: 33px; background: #14201cbb; user-select: none; touch-action: none; -webkit-user-select: none; }
.touch-controls button.held { border-color: var(--gold); background: #796c43bb; }
.touch-controls span { font-size: 8px; letter-spacing: 3px; opacity: .5; }
body.menu-open .touch-controls, body.menu-open .objective { visibility: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.world-caption { position: absolute; top: 140px; left: 36px; display: grid; gap: 9px; font-size: 9px; letter-spacing: 3px; text-shadow: 0 2px 8px #000; pointer-events: none; }
.world-caption span + span { color: var(--gold); letter-spacing: 1px; }
.discovery-hud { position: absolute; right: 37px; top: 180px; display: grid; gap: 9px; text-align: right; font-size: 9px; letter-spacing: 2px; text-shadow: 0 2px 6px #000; pointer-events: none; }
.discovery-hud small { color: var(--muted); font-size: 10px; letter-spacing: 0; }
body.menu-open .discovery-hud, body.menu-open .world-caption { visibility: hidden; }
.wordmark { font-size: 26px; letter-spacing: 9px; }
.wordmark span { letter-spacing: 2px; }
.hud { border-radius: 3px; background: #101d1b66; }
.overlay { background: linear-gradient(90deg, #081411f2, #081411b0 42%, #08141112 90%); }
.menu-card { max-width: 510px; }
h1 { font-size: clamp(56px, 7vw, 104px); letter-spacing: -4px; }
.secondary { display: block; margin-top: 9px; min-width: 260px; font-size: 11px; letter-spacing: 1px; }
.menu-card .career-stats { font-size: 10px; color: var(--gold); max-width: 440px; line-height: 1.8; }
.menu-chapter { margin-left: auto; align-self: flex-end; padding: 0 0 30px 40px; text-align: right; }
.menu-chapter span { font-size: 9px; letter-spacing: 3px; color: #e4ddc8; }
.menu-chapter p { font: italic 36px/1.2 Georgia, serif; color: #eeeade; text-shadow: 0 3px 18px #000; }
.photo-panel { position: absolute; bottom: 24px; left: 24px; right: 24px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; padding: 18px; background: #0c171bcc; border: 1px solid #cfb78a66; backdrop-filter: blur(12px); }
.photo-panel .eyebrow { margin: 0; }
.photo-panel p { font-size: 11px; margin: 7px 20px 0 0; }
.photo-panel button { font-size: 11px; }
.photo-zoom { display: grid; gap: 4px; font-size: 10px; color: var(--muted); }
.photo-zoom input { width: 100px; min-height: 24px; accent-color: var(--gold); }
body.photo-mode .topbar, body.photo-mode .bottom-bar, body.photo-mode .touch-controls, body.photo-mode .objective, body.photo-mode .world-caption, body.photo-mode .discovery-hud, body.photo-mode #notice { visibility: hidden; }

@media (max-width: 900px) { .menu-chapter { display: none; } .world-caption { left: 20px; top: 110px; } .discovery-hud { top: 145px; right: 20px; } }
@media (max-width: 700px) { .world-caption { display: none; } .discovery-hud { top: 141px; } .quick-actions { gap: 4px; } .quick-actions button { padding: 8px; } .photo-panel { bottom: 12px; left: 12px; right: 12px; } .photo-panel p { line-height: 1.6; } }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (any-pointer: coarse), (max-width: 700px) { .touch-controls { display: flex; } .desktop-hint { display: none; } }
@media (max-width: 700px) {
    .topbar { padding: 18px 16px; gap: 10px; } .wordmark { font-size: 17px; letter-spacing: 2px; } .wordmark span { font-size: 6px; letter-spacing: 1.9px; }
    .hud { gap: 14px; padding: 10px 12px; } .hud div > span { font-size: 7px; letter-spacing: 1px; } .hud strong { font-size: 20px; } .speed-stat { display: none; }
    .icon-button { width: 40px; min-height: 40px; } .bottom-bar { padding: 18px 16px; } .objective { right: 20px; top: 100px; font-size: 10px; }
    .overlay { padding: 100px 28px 85px; background: linear-gradient(90deg, #0a1613ef, #0a1613b0 65%, #0a161355); }
    h1 { font-size: 59px; } .eyebrow { font-size: 8px; letter-spacing: 3px; } .menu-card > p { font-size: 12px; } .menu-rule { margin: 17px 0; }
    .menu-card .instructions { font-size: 11px; } .menu-footnote { font-size: 7px; letter-spacing: 1px; margin-top: 16px; }
    .settings-card { padding: 23px; } .settings-card .primary { min-width: 100%; } .quick-actions button { padding: 8px 10px; }
}
@media (max-width: 400px) {
    .topbar { padding: 14px 12px; gap: 6px; }
    .wordmark { font-size: 14px; letter-spacing: 1.5px; }
    .wordmark span { font-size: 5px; letter-spacing: 1.4px; }
    .hud { gap: 10px; padding: 9px 8px; }
    .hud strong { font-size: 18px; }
    .icon-button { width: 34px; padding: 7px; }
    .location { font-size: 8px; letter-spacing: 1px; }
}
@media (max-height: 620px) { .overlay { padding-top: 95px; padding-bottom: 75px; } h1 { font-size: 43px; } .eyebrow { margin-bottom: 12px; } .menu-card > p { margin: 10px 0; } .menu-rule, .menu-footnote { display: none; } .primary { margin-top: 8px; padding: 12px 20px; } .touch-controls { bottom: 76px; } }
.settings-card { width: min(100%, 510px); border-radius: 8px; box-shadow: 0 25px 90px #0006; }
.advanced-settings, .journal { border-top: 1px solid #b2c3a733; margin: 8px 0; }
summary { cursor: pointer; padding: 16px 0; font-size: 12px; color: var(--gold); min-height: 44px; }
summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.settings-card input[type=range] { width: 48%; min-height: 32px; accent-color: var(--gold); }
.journal article { padding: 12px 14px; margin-bottom: 8px; background: #d5c39708; border-left: 2px solid #cfb78a66; }
.journal h3 { margin: 0 0 6px; font: 16px Georgia, serif; }
.journal p { margin: 0; }
.photo-pan { display: flex; gap: 4px; }
.photo-pan button { padding: 8px 14px; min-width: 44px; }
.menu-card { border-left: 1px solid #cfb78a66; padding-left: 28px; }
.menu-chapter p { font-size: clamp(28px, 3vw, 44px); }
.menu-chapter { border-bottom: 1px solid #cfb78a66; }
.primary { border-radius: 2px; box-shadow: 0 8px 40px #0003; }
.quick-actions button[aria-pressed=true] { border-color: var(--gold); color: #f1d8a9; }
@media (max-width: 700px) {
    .menu-card { padding-left: 18px; }
    .quick-actions { gap: 3px; }
    .quick-actions button { padding: 8px 7px; font-size: 9px; }
    .bottom-bar { gap: 8px; }
    .photo-panel { max-height: 55vh; overflow-y: auto; padding: 12px; }
    .photo-panel button { padding: 8px 12px; }
}
@media (max-width: 400px) { .location { max-width: 80px; line-height: 1.5; } }
.replay-button { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 260px; font-size: 10px; letter-spacing: 1px; margin-top: 10px; color: var(--gold); border-color: #cfb78a44; }
.replay-button span { font-size: 20px; }
.replay-panel label { display: grid; gap: 6px; font-size: 10px; letter-spacing: 1px; color: var(--gold); }
.replay-panel input { width: min(38vw, 320px); min-width: 150px; min-height: 32px; accent-color: var(--gold); }
.replay-panel output { min-width: 90px; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); }
.replay-panel { border-top: 2px solid var(--gold); }
@media (max-width: 700px) { .replay-panel input { width: 45vw; } .replay-button { min-height: 44px; } }
@media (max-width: 400px) { .menu-card { width: 100%; } .menu-card .primary, .menu-card .secondary, .replay-button { min-width: 0; width: 100%; } }
/* The selector belongs to the main menu, including the paused menu. */
#overlay { display: flex; flex-direction: column; align-items: stretch; gap: 26px; padding: 30px clamp(16px,4vw,60px); background: linear-gradient(130deg,#071511f5,#102021de); }
#overlay > * { flex-shrink: 0; }
#overlay .menu-card { max-width: none; width: 100%; margin: 0; padding: 18px 24px; border: 1px solid #cfb78a33; background: #0b151766; }
#overlay .menu-card h1 { font-size: clamp(30px,4vw,48px); letter-spacing: -1px; margin-bottom: 12px; }
#overlay .menu-card > p { max-width: 780px; }
#overlay .menu-rule, #overlay .menu-chapter { display: none; }
#overlay .menu-card .eyebrow { margin-bottom: 10px; }
.map-select { --map-accent: #81b887; width: 100%; }
.map-select-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.map-select-heading .eyebrow { display: block; margin: 0 0 7px; letter-spacing: 2px; }
.map-select-heading h2 { margin: 0; font: 500 26px/1.2 'Segoe UI',sans-serif; letter-spacing: 5px; }
.map-select-heading > span { font-size: 11px; color: var(--muted); }
.map-cards { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; }
.map-card { position: relative; display: flex; flex-direction: column; text-align: left; padding: 0 0 12px; min-width: 0; overflow: hidden; border: 1px solid #97b3ab44; border-radius: 9px; background: #101e23; }
.map-card:hover:not(:disabled) { background: #1d3133; border-color: var(--map-accent); }
.map-card[aria-pressed=true] { border: 2px solid var(--map-accent); box-shadow: 0 0 22px color-mix(in srgb,var(--map-accent) 18%,transparent); }
.map-art { display: block; width: 100%; height: 80px; object-fit: cover; }
.map-schematic { display: block; width: 100%; height: 110px; object-fit: contain; background: #101c24; border-block: 1px solid #abc8c11a; }
.map-card strong { font-size: 11px; letter-spacing: 1px; line-height: 1.5; padding: 12px 10px 5px; }
.map-card-description { font-size: 10px; line-height: 1.5; color: #b9cac6; padding: 0 10px; }
.map-selected { position: absolute; top: 7px; right: 7px; font-size: 8px; letter-spacing: 1px; background: var(--map-accent); color: #102021; border-radius: 12px; padding: 4px 7px; opacity: 0; }
.map-card[aria-pressed=true] .map-selected { opacity: 1; }
.map-preview-panel { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; margin-top: 18px; border: 1px solid #aec5ba33; border-radius: 10px; overflow: hidden; background: #0d1a1ecc; }
.map-preview-art { position: relative; align-self: stretch; min-height: 200px; }
#mapPreview { width: 100%; height: 100%; min-height: 200px; object-fit: cover; display: block; }
#mapPreviewPlan { position: absolute; right: 12px; bottom: 12px; width: min(36%, 170px); height: auto; border: 1px solid #c7d9c8aa; border-radius: 4px; box-shadow: 0 4px 20px #0009; }
.map-preview-copy { padding: 22px; }
.map-preview-copy .eyebrow { margin-bottom: 10px; font-size: 8px; letter-spacing: 2px; color: var(--map-accent); }
.map-preview-copy h3 { font: 26px Georgia,serif; margin: 0 0 10px; }
.map-preview-copy p { font-size: 12px; color: #c7d6ce; line-height: 1.65; margin: 8px 0; }
.map-preview-copy .map-legend, .map-preview-copy .map-save-note { font-size: 10px; color: #91aaa5; }
.map-preview-copy .primary { min-width: 0; width: 100%; letter-spacing: .5px; margin-top: 8px; }
.map-preview-copy .secondary { min-width: 0; width: 100%; }
#mapValidationResult { white-space: pre-line; }
@media (max-width: 1000px) {
    .map-cards { gap: 7px; }
    .map-card-description { display: block; font-size: 9px; }
    .map-card strong { letter-spacing: 0; font-size: 10px; }
    .map-art { height: 60px; }
    .map-schematic { height: 95px; }
}
@media (max-width: 650px) {
    #overlay { padding: 20px 14px; }
    .map-cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
    .map-card:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
    .map-card:last-child strong,.map-card:last-child .map-card-description { grid-column: 1 / -1; }
    .map-card:last-child .map-art { height: 95px; }
    .map-select-heading > span { display: none; }
    .map-preview-panel { grid-template-columns: 1fr; }
    #mapPreview { max-height: 180px; object-fit: contain; }
    .map-preview-copy { padding: 16px; }
    #overlay .menu-card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
