body.game-mode { margin: 0; width: 100%; height: 100dvh; overflow: hidden; overscroll-behavior: none; background: #294e40; }
.game-mode #app { width: 100%; height: 100dvh; }
.game-mode .masthead, .game-mode .level-heading, .game-mode .toolbar, .game-mode .under-map, .game-mode .sidebar, .game-mode .footer, .game-mode .map-caption, .game-mode .map-buttons { display: none; }
.game-mode .page { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; padding: 0; margin: 0; overflow: hidden; }
.game-mode .workspace, .game-mode .landscape, .game-mode .board-frame, .game-mode .board-viewport { display: block; position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; max-height: none; margin: 0; padding: 0; }
.game-mode .board-frame { border: 0; border-radius: 0; background: #8c9c6b; box-shadow: none; }
.game-mode canvas { width: 100%; height: 100%; outline-offset: -4px; }
.game-mode .circle-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 48px; height: 48px; min-width: 48px; min-height: 48px; border-radius: 16px; padding: 11px; border: 1px solid #e0d2a84d; background: #244e40ed; color: #fff0c9; box-shadow: 0 3px 0 #143a2d69, 0 5px 15px #183b2926; text-decoration: none; touch-action: manipulation; }
.game-mode .circle-button svg { display: block; width: 24px; height: 24px; }
.game-mode .circle-button:hover:not(:disabled) { background: #3b6752; }
.game-mode .circle-button:disabled { opacity: .45; }
.game-mode .circle-button.active { color: #294735; background: linear-gradient(#f0d8a0, #d6b16b); border-color: #f6e4b5; box-shadow: 0 3px 0 #755a3180, 0 3px 15px #17321d30; }
.game-hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.game-hud button, .game-hud a, .game-hud select { pointer-events: auto; }
.hud-top { position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.hud-heading { min-width: 0; padding: 7px 10px 10px; text-align: center; background: #234b3eea; border: 1px solid #e3d6b03b; border-radius: 16px; color: #fff3d8; box-shadow: 0 4px 16px #183c2026; }
#hud-level-number { display: block; font-size: 8px; letter-spacing: 2px; color: #dec58e; font-weight: 700; }
#hud-level-name { display: block; font-family: Georgia, serif; font-size: 18px; font-weight: 400; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-deliveries { font-size: 9px; color: #d4dfca; white-space: nowrap; }
.hud-history { position: absolute; top: calc(max(14px, env(safe-area-inset-top)) + 68px); left: max(14px, env(safe-area-inset-left)); }
.hud-tools { position: absolute; top: 42%; right: max(14px, env(safe-area-inset-right)); display: grid; gap: 9px; }
.hud-counts { position: absolute; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 68px); left: max(14px, env(safe-area-inset-left)); display: grid; gap: 7px; }
.hud-counts > span { width: 72px; padding: 7px 9px; color: #ffefc6; background: #264f40ed; border: 1px solid #d9cfaa40; border-radius: 12px; box-shadow: 0 3px 12px #1e3d2926; }
.hud-counts small { display: block; font-size: 7px; font-weight: 700; letter-spacing: 1.3px; color: #d0d5b9; margin-bottom: 1px; }
.hud-counts strong { font-size: 21px; font-weight: 600; }
.hud-counts span span { font-size: 10px; margin-left: 4px; color: #d9d8b5; }
.hud-view { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); }
.hud-transport { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); right: max(14px, env(safe-area-inset-right)); width: 70px; height: 70px; }
.game-mode #run { width: 70px; height: 70px; min-width: 70px; margin: 0; padding: 18px; border-radius: 25px; background: linear-gradient(#f3d89d, #d3aa60); color: #294d3a; border: 2px solid #f5e6b5; box-shadow: 0 5px 0 #705c3880, 0 9px 25px #1c3c2d40; }
.game-mode #run:hover { background: linear-gradient(#ffe4aa, #dfb871); }
.game-mode #run svg { width: 30px; height: 30px; }
.game-mode #step { position: absolute; bottom: 86px; right: 10px; }
.game-mode #hud-speed { position: absolute; bottom: 86px; right: 10px; font-size: 13px; font-weight: 700; }
.game-mode .has-step #hud-speed { bottom: 144px; }
.game-mode #status { position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 80px; right: 100px; max-width: 360px; margin: 0 auto; min-height: 0; padding: 10px 12px; border: 1px solid #d9cca747; border-radius: 12px; color: #ffefd4; background: #1e493df0; font-size: 11px; text-align: center; line-height: 1.55; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
.game-mode #status.toast-visible { opacity: 1; transform: none; }
.game-mode #status.error { background: #783d32f5; color: #fff0dd; }
.game-mode #inspector { display: none; position: fixed; z-index: 30; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(390px, calc(100% - 24px)); max-height: 78dvh; overflow-y: auto; padding: 17px; border: 1px solid #e5d8b3; border-radius: 23px; box-shadow: 0 -5px 60px #17362655; background: #fff9e9f7; }
.game-mode #inspector.node-open { display: block; }
.game-mode #inspector h2 { font-size: 17px; margin: 3px 0 20px; }
.game-mode #inspector-close { position: absolute; top: 8px; right: 9px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 8px; font-size: 25px; border-radius: 14px; }
.game-mode .route-row { grid-template-columns: 73px 1fr; gap: 10px; font-size: 12px; }
.game-mode .route-row button { min-height: 48px; padding: 8px 12px; font-size: 13px; background: #f0f0df; }
.game-mode .route-row .sequence { font-size: 12px; margin-top: 3px; }
.game-mode .inspector-empty { font-size: 13px; }
.game-mode .inspector-note { font-size: 11px; }
.game-mode .toggle-junction { min-height: 48px; font-size: 12px; margin: 9px 0; }
.start-screen { position: fixed; inset: 0; z-index: 80; height: 100dvh; background: #172f29 url("./assets/menu-world.png") center 45% / cover no-repeat; isolation: isolate; }
.menu-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(#173e3c8c, transparent 35%, transparent 48%, #1538297a 67%, #0b2825ed); }
.menu-brand { position: absolute; top: max(11dvh, 68px); left: 20px; right: 20px; text-align: center; color: #fff3cd; text-shadow: 0 4px 20px #143527b3, 0 2px 2px #25422f; }
.menu-brand h1 { font-size: clamp(62px, 19vw, 95px); letter-spacing: -4px; line-height: 1.1; margin: 9px 0 10px; font-weight: 700; }
.menu-brand h1 span { color: #f0cd84; }
.menu-kicker { font-size: 9px; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
.menu-brand p { font-size: 13px; letter-spacing: .5px; }
.menu-actions { position: absolute; bottom: max(8dvh, 48px); left: 50%; width: min(320px, calc(100% - 56px)); transform: translateX(-50%); display: grid; gap: 12px; }
.menu-progress { text-align: center; color: #f3e7c9; font-size: 11px; margin-bottom: 4px; letter-spacing: .5px; text-shadow: 0 2px 4px #143528; }
.game-mode .menu-primary { min-height: 62px; padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; color: #2d4935; background: linear-gradient(#f2dba4, #dab772); border: 1px solid #fff2c9; border-radius: 19px; box-shadow: 0 5px 0 #937443b3, 0 12px 25px #071e2b4d; font-size: 21px; }
.menu-primary svg { width: 27px; height: 27px; }
.game-mode .menu-secondary { min-height: 54px; color: #fff2cc; background: #254e40d9; border: 1px solid #bdc3a361; border-radius: 17px; font-size: 16px; box-shadow: 0 4px 15px #123c2533; }
.menu-links { display: flex; gap: 11px; align-items: center; justify-content: center; color: #e4e7cf; font-size: 11px; }
.menu-links a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.menu-links button { min-height: 44px; background: none; border: 0; color: inherit; padding: 5px 0; font-size: 11px; }
.menu-links > span { font-size: 4px; opacity: .5; }
.menu-edition { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-size: 7px; letter-spacing: 2px; color: #b4c1a4; }
.menu-hub { position: absolute; top: max(16px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); }
.menu-help { position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); }
.game-mode[data-screen="game"] #main-menu { visibility: hidden; pointer-events: none; }
.game-mode[data-screen="menu"] .page, .game-mode[data-screen="menu"] #game-hud, .game-mode[data-screen="menu"] #inspector { visibility: hidden; pointer-events: none; }
.game-mode #levels-dialog, .game-mode #guide-dialog { position: fixed; inset: 0; margin: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; padding: max(26px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; background: radial-gradient(ellipse at 50% 10%, #fff8df, #e0e5d2 85%); }
.game-mode #levels-dialog .dialog-heading, .game-mode #guide-dialog .dialog-heading { max-width: 530px; margin: 0 auto 23px; }
.game-mode .dialog-heading > button { min-width: 44px; min-height: 44px; border-radius: 15px; background: #315644; color: #fff0cc; border: 1px solid #f4dca6; }
.game-mode #levels-title { font-size: 32px; line-height: 1.15; margin-top: 9px; }
.game-mode .level-grid { max-width: 530px; margin: 0 auto; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.game-mode .level-card { position: relative; align-items: center; text-align: center; padding: 10px 6px; min-height: 117px; border: 1px solid #fff9dd; border-radius: 21px; background: #f9f5e5; color: #355540; box-shadow: 0 4px 0 #b0b89a69, 0 8px 15px #335d3212; }
.game-mode .level-card .number { color: #8f7343; font: 700 27px Georgia, serif; letter-spacing: -1px; }
.game-mode .level-card strong { font-size: 12px; line-height: 1.25; margin: 5px 0 7px; font-weight: 600; }
.game-mode .level-card .stars { font-size: 14px; letter-spacing: 1px; }
.game-mode .level-card.active { color: #fff0cd; background: linear-gradient(#487252, #2a5140); border-color: #e6cd93; box-shadow: 0 4px 0 #173b2a70, 0 6px 22px #355c3240; }
.game-mode .level-card.active .number, .game-mode .level-card.active .stars { color: #f0d08b; }
.game-mode .level-card .best-result { font-size: 8px; }
.game-mode #guide-dialog .guide-grid { max-width: 530px; margin: auto; grid-template-columns: 1fr; gap: 12px; }
.game-mode .guide-grid article { background: #fff9e9; border-radius: 18px; }
.game-mode .guide-grid p { font-size: 13px; }
.game-mode .result-dialog, .game-mode .mobile-pause, .game-mode .mobile-info { width: min(370px, calc(100% - 36px)); max-width: none; padding: 25px; background: #faf5e4; border: 2px solid #e3cf9d; border-radius: 27px; box-shadow: 0 18px 70px #12332c70; }
.game-mode .mobile-pause[open] { display: grid; gap: 10px; }
.mobile-pause h2 { font: 400 32px Georgia, serif; margin: 4px 0 13px; }
.game-mode .mobile-pause > button, .game-mode .result-dialog button { min-height: 49px; border-radius: 14px; font-size: 14px; }
.mobile-pause details { margin-top: 4px; font-size: 12px; }
.mobile-pause summary { padding: 15px 0; cursor: pointer; text-align: center; }
.pause-extras { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pause-extras button { min-height: 44px; }
.pause-extras .speed-row { grid-column: 1 / -1; }
.game-mode .result-dialog .stars { font-size: 38px; margin: 16px 0 24px; }
.game-mode .result-dialog h2 { font-size: 34px; }
.game-mode .result-dialog p { font-size: 13px; }
.game-mode .mobile-info #info-hint { margin: 20px 0; }
.game-mode .mobile-info .mission { font-size: 13px; }
.game-mode .mobile-info #info-guide { min-height: 46px; width: 100%; }
@media (max-height: 720px) { .menu-brand { top: 12dvh; } .menu-brand h1 { font-size: 62px; } .menu-actions { bottom: 6dvh; gap: 9px; } .menu-brand p { font-size: 11px; } .game-mode .level-card { min-height: 100px; } .game-mode #levels-dialog { padding-top: 20px; } .game-mode #levels-title { font-size: 29px; } .hud-tools { top: 39%; } }
@media (orientation: landscape) and (max-height: 600px) { .menu-brand { left: 6%; width: 40%; right: auto; top: 25%; } .menu-actions { left: auto; right: 7%; transform: none; width: 34%; bottom: 15%; } .menu-edition { display: none; } }
@media (max-height: 650px) {
  .game-mode #inspector { padding: 14px; }
  .game-mode #inspector h2 { margin-bottom: 12px; }
  .game-mode .junction-diagram { width: 200px; }
  .game-mode .junction-sequence { font-size: 10px; }
  .game-mode #inspector .inspector-note { margin-bottom: 0; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { .game-mode #status { transition: none; } }
