@import url("./yard-jam.css");
/* NOTE: Use standard iOS, macOS and Android fonts; game startup must not download fonts. */
.picture_grid.age_grid {display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-auto-rows:112px;gap:10px;flex:none;align-self:center;width:min(100%,960px);}
.age_grid .picture_button {min-height:92px;}
.age_grid .picture_emoji {font-size:36px;}
/* NOTE: Keep the first age question readable when place artwork behind it contains dark trees. */
#yard:has([data-stage=age].show) .library_title {align-self:flex-start;width:fit-content;padding:6px 10px;border:1px solid var(--line);border-radius:8px;background:var(--panel);}
  /* NOTE: Keep every saved driver readable; the grid scrolls instead of squeezing accumulated profiles into overlapping rows. */
  .profile_dialog > .picture_grid {
    grid-auto-rows: 112px;
    overflow: auto;
  }
  .game_route_overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
  }
  .game_piece.fire_engine,.game_slot.fire_target {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: auto;
  }
  .fire_badge {
    position: absolute;
    right: 0;
    top: 0;
    min-width: 25px;
    height: 25px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: var(--panel);
    font: 700 15px system-ui;
    border: 2px solid var(--panel);
    pointer-events: none;
  }
  .fire_urgent::after {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: -3px;
    height: 18px;
    border: 3px dashed var(--primary);
    border-radius: 50%;
    pointer-events: none;
  }
  .game_control.fire_priority:disabled {
    opacity: 1;
    grid-column: 1 / -1;
    text-align: left;
    background: transparent;
    box-shadow: none;
    border-color: transparent;
    color: var(--ink);
    font-size: 16px;
    min-height: 38px;
  }
  .fire_priority.selected:disabled {
    background: var(--soft);
    border: 1px solid var(--line);
  }
  .game_control.fire_weather:disabled {
    opacity: 1;
    grid-column: 1 / -1;
    white-space: normal;
    font-size: 13px;
    min-height: 30px;
    background: transparent;
    box-shadow: none;
    border: 0;
    color: var(--ink);
  }
  .fire_board .game_slot {
    min-width: 44px;
    min-height: 44px;
  }
  .fire_spray_effect {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
  }
@media (max-width:900px) {
 .picture_grid.age_grid {grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:96px;gap:8px;}
 .age_grid .picture_button {min-height:76px;}
}
:root { --art_colour_0:#263b4520; --art_colour_1:#fff2d7; --art_colour_2:#fff5dceF; --art_colour_3:#233e50; --art_colour_4:#dce7eb; --art_colour_5:#fff5dfed; --art_colour_6:#243c4c; --art_colour_7:#fff5dedf; --art_colour_8:#e2b97180; --art_colour_9:#233a4520; --art_colour_10:#e9f0edc9; --art_colour_11:#fff2d2; --art_colour_12:#c99a53; --art_colour_13:#aa733f55; --art_colour_14:#3b271433; --art_colour_15:#fff9e9d9; --art_colour_16:#fbf3d8d9; --art_colour_17:#967a55; --art_colour_18:#ecc056; --art_colour_19:#264758; --art_colour_20:#66aaa4; --art_colour_21:#315c65; --art_colour_22:#fff4c9a8; --art_colour_23:#d49e4a; color-scheme: light; --paper:#f6efdc; --panel:#fff9e9; --ink:#293f38; --muted:#677466; --line:#d7c8a8; --accent:#427363; --soft:#e9e4ce; --primary:#ffca4e; --primary_ink:#183b4b; --primary_edge:#c9952b; --map_ground:#d9e5cb; --map_border:#c3d2b5; font: 16px/1.4 system-ui, -apple-system, BlinkMacSystemFont, sans-serif; background:var(--paper); color:var(--ink); }
:root.dark, body.dark, html[data-theme="dark"] { color-scheme:dark; --paper:#132936; --panel:#203e48; --ink:#f6eed8; --muted:#b5c9c3; --line:#41616a; --accent:#9bd3b3; --soft:#2b4b53; --primary:#ffca4e; --primary_ink:#183b4b; --primary_edge:#c9952b; }
* { box-sizing:border-box; }
/* NOTE: The storybook paper is a background texture; every game target and label stays a separate component. */
body { margin:0; overscroll-behavior:none; background-color:var(--paper);background-image:image-set(url('../assets/artwork/storybook-paper.avif') type('image/avif'),url('../assets/artwork/storybook-paper.webp') type('image/webp'));background-size:420px;background-blend-mode:soft-light; }
body.dark {background-image:image-set(url('../assets/artwork/storybook-paper-dark.avif') type('image/avif'),url('../assets/artwork/storybook-paper-dark.webp') type('image/webp'));}
button, select { font:inherit; color:inherit; }
button { cursor:pointer; }
.hidden, [hidden] { display:none !important; }
.page { display:none; }
.page.active { display:flex; }
#app { height:100dvh; min-height:320px; width:100%; display:flex;flex-direction:column;gap:6px;padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); }
#yard,#rescue,#activity { flex:1;min-height:0;width:100%;flex-direction:column;gap:7px; }
#yard { flex-direction:column; padding:8px 10px 6px; gap:7px; }
.app_header { display:flex; align-items:center; gap:8px; min-height:44px; }
.brand { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-weight:700; font-size:16px; }
.app_header #profile_button {margin-left:auto;}
.app_header select, .app_header .btn { border:1px solid var(--line); border-radius:14px; padding:9px 12px; background:var(--panel); font-size:13px; min-height:44px; min-width:44px; flex-shrink:0; }
.mission_progress { display:block; width:100%; height:5px; border:0; border-radius:8px; accent-color:var(--accent); }
.play_area { flex:1; min-height:0; display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:12px; }
.map_root { position:relative; min-width:0; min-height:0; overflow:hidden; border-radius:24px; background:var(--map_ground); border:1px solid var(--map_border); }
#recovery_map { width:100%; height:100%; display:block; touch-action:none; }
.action_panel { background:var(--panel); border:1px solid var(--line); border-radius:24px; padding:20px; display:flex; flex-direction:column; gap:12px; min-height:0; overflow:auto; }
.phase_label { margin:0; color:var(--muted); letter-spacing:0.13em; font-size:10px; font-weight:700; }
h1 { margin:0; font-size:25px; line-height:1.15; }
#feedback { min-height:60px; font-size:15px; margin:0; }
.action_grid, .tool_tray { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.btn { background:var(--panel); border:1px solid var(--line); box-shadow:0 2px 0 var(--line); border-radius:15px; min-height:52px; padding:8px 10px; display:flex; align-items:center; justify-content:center; gap:7px; font-size:14px; line-height:1.2; }
@media (hover:hover) {
 .btn:hover {border-color:var(--accent);}
}
/* NOTE: Pieces and slots keep their transforms because they hold measured board positions. */
.btn:active:not(:disabled):not(.game_piece):not(.game_slot) {transform:translateY(2px);box-shadow:none;}
.btn:disabled { opacity:0.45; cursor:default; }
.btn[aria-pressed="true"] { border-color:var(--accent); box-shadow:inset 0 0 0 2px var(--accent); }
.btn[data-state="stowed"]::after { content:"✓"; color:var(--accent); }
.btn[data-state="placed"]::after { content:"↗"; color:var(--accent); }
.action_icon { font-size:24px; min-width:25px; }
.equipment_picture { width:36px; height:36px; object-fit:contain; vertical-align:middle; }
.game_camera_controls { position:absolute; left:10px; bottom:10px; z-index:20; display:flex; align-items:center; gap:6px; padding:5px; border-radius:12px; background:var(--panel); box-shadow:0 2px 8px var(--art_colour_9); }
.game_camera_controls[hidden] { display:none; }
.game_camera_controls button { min-width:44px; min-height:44px; padding:6px; }
.game_camera_controls span { min-width:42px; text-align:center; font-size:13px; }
#game_board { transform:translate(calc(-50% + var(--board_pan_x,0px)),calc(-50% + var(--board_pan_y,0px))) scale(var(--board_zoom,1)); }
.tool_tray .btn { font-size:12px; min-height:47px; }
.tool_tray { padding-bottom:10px; border-bottom:1px solid var(--line); }
.help_row { display:flex; gap:8px; margin-top:auto; }
.help_row .btn { flex:1; font-size:12px; min-height:44px; background:transparent; border:1px solid var(--line); }
.condition { font-size:12px; color:var(--muted); margin:0; }
.save_bar { display:flex; align-items:center; justify-content:flex-end; gap:8px; min-height:20px; color:var(--muted); font-size:10px; }
/* NOTE: A failed startup has no game scene; its error must read as the main message, not tiny save metadata. */
.save_bar.startup_error {justify-content:flex-start;font-size:16px;color:var(--ink);}
.save_bar .btn { min-height:28px; padding:3px 8px; font-size:11px; }
.area_grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:14px;flex:1;min-height:0;}
.area_card {position:relative;overflow:hidden;padding:0;border-radius:22px;border:0;box-shadow:0 4px 12px var(--art_colour_0);min-height:0;background:var(--art_colour_1);}
.area_card img {width:100%;height:100%;object-fit:cover;}
.area_card span {position:absolute;bottom:0;left:0;right:0;padding:14px;background:var(--art_colour_2);color:var(--art_colour_3);font-size:20px;}
.library_selection {display:flex;flex-direction:column;gap:10px;flex:1;min-height:0;}
.collection_controls {display:flex;gap:10px;align-items:center;}
.collection_controls select {min-height:44px;max-width:40%;font:inherit;border:1px solid var(--line);border-radius:13px;padding:8px;background:var(--panel);}
.game_preview {position:relative;flex:1;min-height:0;overflow:hidden;border:0;padding:0;display:block;}
.game_preview img {width:100%;height:100%;object-fit:contain;background:var(--art_colour_4);}
.preview_title,.preview_description {position:absolute;bottom:45px;left:14px;padding:8px 14px;border-radius:12px;background:var(--art_colour_5);color:var(--art_colour_6);font-size:24px;}
.preview_description {bottom:10px;font-size:14px;}
#library_progress {margin:0;font-size:13px;}
.game_play_area {display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:12px;flex:1;min-height:0;}
.game_stage {position:relative;overflow:hidden;min-width:0;min-height:0;border-radius:22px;touch-action:none;container-type:size;}
.game_board {position:absolute;left:50%;top:50%;width:min(100cqw,calc(100cqh * 4 / 3));height:min(100cqh,calc(100cqw * 3 / 4));transform:translate(-50%,-50%);}
.scene_picture {position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none;}
.game_projection_frame {position:absolute;left:0;top:0;transform-origin:0 0;overflow:visible;}
.game_ground_plane {position:absolute;left:0;top:0;transform-origin:0 0;transform-style:preserve-3d;overflow:visible;}
.game_ground_art {position:absolute;left:0;top:0;overflow:visible;pointer-events:none;}
.game_board:not(.has_projection) .game_projection_frame {display:none;}
.game_board.has_projection .game_piece,.game_board.has_projection .game_slot {font-size:1px;border-width:.08px;border-radius:.25px;padding:.08px;box-shadow:0 .15px .3px var(--art_colour_9);}
.game_board.has_projection > .parking_sign {font-size:clamp(10px,2.2cqh,22px);border-width:2px;border-radius:5px;padding:3px;}
.game_piece,.game_slot {position:absolute;left:var(--x);top:var(--y);width:var(--w);height:var(--h);transform:translate(-50%,-50%);margin:0;padding:3px;min-height:0;background:var(--art_colour_7);color:var(--art_colour_3);border:2px solid var(--art_colour_8);box-shadow:0 4px 8px var(--art_colour_9);font-size:clamp(16px,3vw,40px);white-space:pre-line;line-height:1.2;z-index:2;}
.game_piece {z-index:3;cursor:grab;user-select:none;touch-action:none;}
.game_piece.is_dragging {z-index:8;cursor:grabbing;box-shadow:0 8px 18px var(--art_colour_9);}
.game_slot.drop_target {border:3px dashed var(--accent);background:var(--soft);}
.tool_tray .btn {touch-action:none;user-select:none;}
.game_piece img,.game_slot img {width:100%;height:100%;object-fit:contain;pointer-events:none;}
/* NOTE: Measured artwork fills its parent frame; flex sizing must not move the pixels away from attachment targets. */
.game_framed_picture {position:absolute;inset:0;width:100%;height:100%;pointer-events:none;}
.game_slot {border-style:dashed;background:var(--art_colour_10);}
.game_slot:disabled,.game_piece:disabled {opacity:1;}
.game_panel {display:flex;flex-direction:column;gap:12px;padding:15px;background:var(--panel);border-radius:22px;min-height:0;box-shadow:inset 0 0 0 1px var(--line);}
#game_title {font-size:18px;}
#game_prompt {font-size:15px;line-height:1.2;margin:0;}
#game_feedback {margin:0;font-size:14px;min-height:52px;}
.game_controls {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;}
.game_control {font-size:13px;min-height:46px;}
.game_caption {margin:auto 0 0;font-size:11px;color:var(--muted);}
.plain_picture {border:0;box-shadow:none;background:transparent;pointer-events:none;}
.chassis_picture img {object-fit:fill;}
.game_piece {transform:translate(-50%,-50%) rotate(var(--turn));}
.game_board .letter_tile {font-size:clamp(24px,4vw,52px);}
.game_board .word_picture {font-size:min(9cqh,70px);}
.game_board .result_label,.game_board .radio_phrase {font-size:clamp(12px,2vw,22px);}
.game_board .message_tile {font-size:clamp(12px,2vw,22px);}
.letter_tile {background:var(--art_colour_11);border:1px solid var(--art_colour_12);box-shadow:0 6px 0 var(--art_colour_13),0 8px 12px var(--art_colour_14);font-weight:700;font-size:clamp(20px,4vw,52px);}
.word_picture {background:var(--art_colour_15);font-size:clamp(40px,8vw,100px);}
.sign_ink {background:transparent;border:0;box-shadow:none;font-size:clamp(16px,2.4vw,30px);font-weight:700;}
.grid_square {border-radius:3px;background:var(--art_colour_16);border:1px solid var(--art_colour_17);box-shadow:none;z-index:1;}
.selected_car {background:var(--art_colour_18);border:3px solid var(--art_colour_19);}
.parked_car {background:var(--art_colour_20);border:1px solid var(--art_colour_21);}
.road_segment {border:0;box-shadow:none;background:var(--art_colour_22);font-size:14px;z-index:1;}
.rope_length {font-size:24px;border:0;box-shadow:none;background:transparent;letter-spacing:-7px;}
.ramp_picture {transform:translate(-50%,-50%) rotate(-12deg);background:var(--art_colour_23);}
#vehicle_select {font:inherit;min-height:42px;padding:6px;background:var(--panel);color:var(--ink);border-radius:12px;border:1px solid var(--line);}
@media (max-width:1000px) and (orientation:portrait) {
  .area_grid {grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:9px;}
  .area_card span {font-size:16px;padding:10px;}
  .game_play_area {grid-template-columns:1fr;grid-template-rows:minmax(220px,1fr) auto;gap:7px;}
  .game_panel {padding:10px;gap:7px;}
  #game_prompt {font-size:14px;} #game_feedback {font-size:13px;min-height:28px;}
  .game_controls {grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;}
  .game_control {min-height:44px;font-size:12px;padding:5px;}
  .game_caption {font-size:10px;}
  .collection_controls {flex-wrap:wrap;gap:5px;}
  .collection_controls select {max-width:100%;flex:1;font-size:12px;}
  .preview_title {font-size:20px;bottom:60px;}
  .preview_description {font-size:12px;right:10px;}
}
@media (max-height:520px) and (orientation:landscape) {
  .game_play_area {grid-template-columns:minmax(0,1fr) 300px;gap:6px;}
  .game_panel {padding:8px;gap:5px;}
  #game_title {font-size:14px;} #game_prompt {font-size:15px;} #game_feedback {font-size:11px;min-height:20px;}
  .game_controls {grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;}
  .game_control {min-height:36px;font-size:10px;padding:4px;}
  .game_caption {font-size:9px;}
  .area_card span {font-size:14px;padding:7px;}
    .game_controls .fire_priority:disabled {
      grid-column: auto;
      min-height: 30px;
      padding: 4px;
      font-size: 12px;
    }
    .game_controls:has(.fire_priority) {
      grid-template-columns: repeat(3,minmax(0,1fr));
    }
}
@media (max-width:1000px) and (orientation:portrait) {
  .play_area { grid-template-columns:1fr; grid-template-rows:minmax(180px,1fr) auto; gap:7px; }
  .action_panel { padding:12px; gap:7px; border-radius:18px; max-height:53dvh; }
  h1 { font-size:21px; }
  #feedback { font-size:13px; min-height:36px; }
  .tool_tray { grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; padding-bottom:6px; }
  .tool_tray .btn { flex-direction:column; gap:2px; padding:4px 2px; font-size:10px; min-height:56px; }
  .action_grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; }
  .action_grid .btn { min-height:43px; padding:5px; font-size:12px; }
  .action_icon { font-size:20px; }
  .help_row { margin-top:0; }
}
@media (max-height:520px) and (orientation:landscape) {
  #yard { gap:3px; padding-top:4px; }
  .app_header { min-height:32px; }
  .app_header .btn, .app_header select { min-height:30px; padding:5px 9px; }
  .play_area { grid-template-columns:minmax(0,1fr) 330px; gap:7px; }
  .action_panel { padding:10px; gap:5px; border-radius:16px; }
  h1 { font-size:20px; }
  #feedback { font-size:12px; min-height:32px; }
  .tool_tray { grid-template-columns:repeat(5,minmax(0,1fr)); gap:3px; padding-bottom:4px; }
  .tool_tray .btn { min-height:38px; font-size:9px; padding:4px 2px; flex-direction:column; gap:1px; }
  .action_icon { font-size:16px; }
  .btn { min-height:34px; padding:4px 6px; font-size:11px; }
  .action_grid { gap:4px; }
  .help_row .btn { min-height:30px; }
  .condition { font-size:10px; }
  .save_bar { min-height:12px; }
}
/* Retained picture choices share the same one-tap contract on every screen. */
.library_nav_slot {
 display:flex;
 align-items:center;
 flex:0 0 auto;
 margin-left:auto;
 padding-inline:12px;
}
.library_nav {display:flex;align-items:center;flex-wrap:nowrap;flex-shrink:0;gap:4px;width:max-content;}
/* NOTE: Shared nav measures this slot with the hamburger hidden and 12px sibling clearance. */
.library_nav_slot.nav-responsive-desktop>.hamburger {display:none;}
.library_nav_slot>.hamburger {
 display:flex;
 flex-direction:column;
 justify-content:center;
 gap:5px;
 width:44px;
 height:44px;
 padding:10px;
 border:1px solid var(--line);
 border-radius:14px;
 background:var(--panel);
}
.hamburger>span {display:block;width:22px;height:2px;background:var(--ink);}
.slideout-sidebar {display:none;position:fixed;inset:0;z-index:80;}
.slideout-sidebar.show {display:flex;justify-content:flex-end;}
.sidebar-backdrop {position:absolute;inset:0;border:0;background:var(--overlay_shade);}
.slideout-sidebar-panel {
 position:relative;
 display:flex;
 flex-direction:column;
 width:min(320px,90vw);
 padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
 background:var(--panel);
 border-left:1px solid var(--line);
}
.sidebar-close {align-self:flex-end;min-width:44px;min-height:44px;border:1px solid var(--line);border-radius:12px;background:var(--soft);font:inherit;}
.sidebar-body {min-height:0;overflow:auto;}
.sidebar-body .library_nav {width:100%;flex-direction:column;align-items:stretch;padding-block:12px;gap:8px;}
.sidebar-body .nav_label_long {display:inline;}
.sidebar-body .nav_label_short {display:none;}
.library_title {font-size:20px;font-weight:700;margin:0;}
.nav_label_short {display:none;}
@media (max-width:699px) {
 .nav_label_long {display:none;}
 .nav_label_short {display:inline;}
}
.stages {display:flex;flex:1;min-height:0;width:100%;}
.stages .stage {display:none;flex:1;min-height:0;flex-direction:column;gap:8px;}
.stages .stage.show {display:flex;overflow:auto;}
.picture_grid {display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:10px;flex:1;min-height:0;width:100%;}
.picture_grid.area_grid {grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:none;}
.picture_button {position:relative;display:flex;flex-direction:column;overflow:hidden;container-type:size;background:var(--panel);border:1px solid var(--line);padding:9px;min-height:44px;gap:5px;}
.picture_button img {width:100%;flex:1;min-height:0;object-fit:contain;pointer-events:none;}
.picture_emoji {font-size:min(64px,42cqh);line-height:1.1;min-height:0;flex:1;display:flex;align-items:center;justify-content:center;}
#yard [data-stage=games] .picture_grid,#yard [data-stage=missions] .picture_grid {flex:none;grid-auto-rows:112px;}
.picture_label {font-size:clamp(11px,1.3vw,17px);line-height:1.15;text-align:center;flex-shrink:0;}
.picture_button[data-badge=next] {border:3px solid var(--accent);}
.picture_button[data-badge=done]::after {content:'⭐';position:absolute;top:4px;right:5px;font-size:19px;}
.picture_button[data-badge=saved]::after {content:'↶';position:absolute;top:4px;right:5px;font-size:19px;}
.mission_stops {grid-template-columns:repeat(5,minmax(0,1fr));}
.mission_stops .picture_emoji {font-variant-numeric:tabular-nums;color:var(--accent);font-weight:700;}
.guidance_text {margin:5px 0;font-size:14px;}
.guide {display:flex;gap:8px;align-items:center;}
.guide_picture {font-size:28px;}
.guide_line {flex:1;margin:0;font-size:14px;}
.guide .btn {flex:0 0 44px;min-height:44px;padding:4px;background:transparent;}
.game_panel {gap:9px;}
#game_title {font-size:14px;font-weight:500;color:var(--muted);}
#game_prompt {font-size:15px;}
#game_feedback {min-height:0;}
.game_grown_up {display:flex;justify-content:flex-end;}
.grown_up_button {position:relative;min-height:44px;font-size:12px;background:linear-gradient(90deg,var(--soft) calc(var(--hold_progress,0)*100%),transparent 0);border:1px solid var(--line);user-select:none;touch-action:none;}
.primary_action,.modal .btn-primary {background:var(--primary);color:var(--primary_ink);border-color:var(--primary_edge);box-shadow:0 3px 0 var(--primary_edge);font-weight:700;}
.celebration_overlay {position:absolute;inset:0;display:none;align-items:center;justify-content:center;gap:20px;pointer-events:none;z-index:30;font-size:clamp(44px,8vw,90px);}
.celebration_overlay.show {display:flex;animation:celebrate 1600ms ease-out both;}
.celebration_overlay span:nth-child(2) {font-size:1.3em;}
@keyframes celebrate {0%{opacity:0;transform:scale(.4) translateY(40px);}25%{opacity:1;transform:scale(1.1);}70%{opacity:1;transform:scale(1);}100%{opacity:0;transform:scale(1) translateY(-20px);}}
.hint_hand {position:absolute;z-index:40;font-size:44px;pointer-events:none;animation:hint_move 1400ms ease-in-out both;}
@keyframes hint_move {0%,15%{transform:translate(-50%,-50%);opacity:1;}85%{transform:translate(calc(-50% + var(--hint_dx)),calc(-50% + var(--hint_dy)));opacity:1;}100%{transform:translate(calc(-50% + var(--hint_dx)),calc(-50% + var(--hint_dy)));opacity:0;}}
.returning {animation:return_piece 280ms ease-out;}
@keyframes return_piece {0%{scale:1.12;}100%{scale:1;}}
.drive_off {animation:drive_off 1200ms ease-in forwards;}
@keyframes drive_off {to{translate:120% 0;}}
.trail {display:flex;justify-content:center;gap:10px;list-style:none;padding:0;margin:0;min-height:28px;}
.trail li {opacity:.35;font-size:21px;}
.trail li[aria-current=step],.trail .trail_done {opacity:1;}
.trail li[aria-current=step] {border-bottom:3px solid var(--accent);}
.profile_overlay,.ui-overlay.show {position:fixed;inset:0;z-index:100;background:var(--overlay_shade);display:flex;align-items:center;justify-content:center;padding:max(14px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));}
.profile_dialog {display:flex;flex-direction:column;gap:10px;padding:16px;background:var(--panel);border-radius:22px;width:min(690px,100%);max-height:100%;min-height:280px;overflow:hidden;}
.profile_dialog > :not(.picture_grid):not(.profile_settings) {flex-shrink:0;}
.profile_dialog .btn {min-height:44px;}
.profile_nav {display:flex;align-items:center;justify-content:space-between;}
.profile_nav h2 {margin:0;font-size:18px;}
.profile_dialog .picture_grid {grid-template-columns:repeat(3,minmax(0,1fr));min-height:90px;}
/* NOTE: Settings scroll inside the dialog; Close and saved-age guidance must stay outside the scroll area. */
.profile_settings {display:flex;flex-direction:column;gap:8px;min-height:0;overflow:auto;align-content:start;padding-bottom:4px;}
.profile_settings > * {flex-shrink:0;}
.profile_settings .picture_grid {min-height:80px;height:max-content;align-self:start;grid-auto-rows:minmax(92px,max-content);flex:none;}
.profile_settings .picture_emoji {font-size:30px;}
.profile_settings select {min-height:44px;font:inherit;background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:10px;}
.modal.ui-surface.ui-panel {display:none;position:fixed;inset:0;z-index:150;align-items:center;justify-content:center;padding:16px;}
.modal.ui-surface.ui-panel.show {display:flex;}
.modal-content {background:var(--panel);color:var(--ink);border-radius:20px;padding:16px;width:min(480px,100%);max-height:100%;}
.modal-header {display:flex;justify-content:space-between;gap:10px;align-items:center;}
.modal-header h2,.modal-header h3,.modal-header h4,.modal-header h5 {margin:0;}
.modal-body {padding-top:12px;}
.modal-buttons {display:flex;gap:10px;margin-top:14px;justify-content:flex-end;}
.modal input {width:100%;min-height:44px;font:inherit;color:var(--ink);background:var(--paper);border:1px solid var(--line);border-radius:10px;padding:8px;}
.counter_unit {font-size:clamp(12px,2vw,24px);border:0;box-shadow:none;background:transparent;pointer-events:none;z-index:5;}
.counter_unit:not(.plain_picture):not(:disabled) {pointer-events:auto;}
.truck_lights {font-size:clamp(9px,1.2vw,16px);line-height:1;color:var(--art_colour_3);background:var(--art_colour_1);border-radius:50%;}
.truck_numeral {font-size:clamp(14px,2vw,24px);background:var(--panel);color:var(--ink);border-radius:4px;}
.hub_outline {border-radius:50%;border:3px dashed var(--hub_edge);background:var(--hub_fill);}
.fitted_wheel {pointer-events:none;}
.shape_outline {font-size:clamp(30px,5vw,64px);}
.rope_line {background:var(--rope_colour);border:0;border-radius:0;box-shadow:none;}
.tipping_deck {background:var(--deck_colour);transform:translate(-50%,-50%) rotate(var(--turn));border:0;}
.road_bar {height:3%;background:var(--road_colour);transform:translate(-50%,-50%) rotate(var(--turn));border:0;box-shadow:none;z-index:0;}
.yard_tile,.road_square,.garage_bay {background:var(--soft);color:var(--ink);border:2px dashed var(--line);box-shadow:none;}
.garage_bay {font-size:28px;}
.letter_road {border:0;background:transparent;box-shadow:none;touch-action:none;z-index:1;}
.trace_picture {position:absolute;inset:0;width:100%;height:100%;pointer-events:none;}
.trace_picture polyline {fill:none;stroke:var(--trace_colour);stroke-width:9;stroke-linecap:round;stroke-linejoin:round;}
.trace_picture .traced {stroke:var(--accent);}
.start_flag {z-index:4;background:var(--flag_colour);border-radius:50%;color:white;}
.position_zone {border:1px dashed var(--zone_edge);background:transparent;box-shadow:none;z-index:2;}
.order_card {background:var(--panel);color:var(--ink);border-radius:12px;font-size:26px;}
.snowball_hole {min-height:0;padding:0;background:transparent;color:var(--ink);border:1px dashed var(--line);border-radius:50%;}
.convoy_roof {z-index:5;background:var(--panel);color:var(--ink);border:0;border-radius:4px;pointer-events:none;}
/* NOTE: A roof mark scales with its pictured truck; it must not hide a small truck on Whole map. */
.convoy_vehicle {container-type:inline-size;}
.convoy_vehicle>.convoy_roof {min-height:0;padding:0;font-size:min(36cqw,18px);line-height:1;}
.surface_band {background:var(--soft);}
@media (max-width:1000px) and (orientation:portrait) {
 .picture_grid {grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;}
 .picture_grid.area_grid {grid-template-columns:repeat(2,minmax(0,1fr));}
 .mission_stops {grid-template-columns:repeat(4,minmax(0,1fr));}
 .picture_button {padding:5px;}
 .guide_picture {display:none;}
 .game_panel {gap:6px;padding:8px;}
 .game_grown_up {position:absolute;right:12px;bottom:2px;}
 .game_caption {padding-right:85px;min-height:44px;display:flex;align-items:center;}
 #activity {position:relative;}
 #game_prompt {font-size:14px;}
 .profile_dialog {padding:10px;}
}
@media (max-height:520px) and (orientation:landscape) {
 .picture_grid {grid-template-columns:repeat(7,minmax(0,1fr));gap:5px;}
 .picture_emoji {font-size:34px;}
 .picture_label {font-size:11px;}
 .mission_stops {grid-template-columns:repeat(10,minmax(0,1fr));}
 .game_control {min-height:44px;}
 .game_panel {gap:4px;padding:6px;}
 #game_prompt {font-size:15px;}
 .guide_picture {display:none;}
 .game_caption {font-size:9px;}
 .profile_settings {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:max-content;align-items:start;}
 .profile_dialog {gap:5px;padding:8px;}
 .profile_settings .picture_grid {min-height:70px;}
 .profile_settings .picture_emoji {font-size:23px;}
 .trail {gap:8px;min-height:22px;}
 .trail li {font-size:17px;}
}

:root {--overlay_shade:#142c2680; --hub_edge:#765127; --hub_fill:#fff2d880; --rope_colour:#ac7835; --deck_colour:#94602f; --road_colour:#b9c5be; --trace_colour:#a8b9b3; --flag_colour:#3aa865; --zone_edge:#758a7d50;}
/* Keep pictures large after the compact navigation rules, including short landscape. */
.game_board:not(.has_projection) .picture_choice:not(.counter_unit):not(.message_tile):not(.route_node) {font-size:clamp(26px,5cqw,56px);}
/* NOTE: Printed labels follow the wooden face: sign-setting.png's edge runs (707,274) to (1228,354), with upright sides. */
.game_board .sign_ink {font-size:clamp(16px,2.4vw,30px);transform:translate(-50%,-50%) skewY(8.75deg);}
@media (max-width:1000px) and (orientation:portrait) {
 .game_play_area {grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto auto auto auto;grid-template-areas:'identity' 'prompt' 'board' 'guide' 'controls' 'meta';align-content:start;gap:7px;}
 .game_panel {display:contents;}
 #game_title {grid-area:identity;}
 #game_prompt {grid-area:prompt;}
 .game_stage {grid-area:board;height:min(60dvh,75vw);}
 .game_play_area .guide {grid-area:guide;}
 .game_controls {grid-area:controls;}
 .game_caption {grid-area:meta;margin:0;}
 .game_grown_up {grid-area:meta;position:static;justify-self:end;align-self:center;}
}

/* One affine map surface owns every work-game pointer; chrome stays outside its camera. */
.world_board {overflow:visible;touch-action:none;}
#world_map {position:absolute;inset:0;width:100%;height:100%;transform-origin:50% 50%;touch-action:none;}
.world_chrome {position:absolute;inset:6px 6px auto;z-index:12;display:flex;flex-direction:column;gap:4px;pointer-events:none;}
.world_chrome .btn,.world_chrome .picture_grid {pointer-events:auto;}
.world_mission_strip {display:flex;justify-content:center;gap:12px;margin:0;padding:0;list-style:none;font-size:18px;}
.fleet_grid {display:flex;flex:0;gap:4px;overflow:auto;max-width:100%;align-self:flex-start;background:var(--panel);border-radius:12px;padding:3px;}
.fleet_grid .picture_button {flex:0 0 70px;min-height:54px;padding:3px;}
.fleet_grid .picture_emoji {font-size:22px;}
.fleet_grid .picture_label {font-size:10px;}
.world_calendar {align-self:flex-end;display:flex;gap:6px;align-items:center;background:var(--panel);border-radius:10px;padding:4px;font-size:12px;pointer-events:auto;}
.world_calendar .btn {min-height:36px;font-size:11px;}
.world_view_controls {position:absolute;left:8px;bottom:8px;z-index:13;display:flex;gap:3px;padding:3px;background:var(--panel);border-radius:12px;}
.world_view_controls .btn {min-width:44px;min-height:44px;padding:3px 8px;}
/* NOTE: Recovery scenes keep their existing map controls; the larger controls belong to activities. */
#rescue .world_view_controls .btn {min-width:40px;min-height:40px;}
@media (max-width:1000px) and (orientation:portrait) {
 .game_stage:has(.world_board) {height:min(55dvh,95vw);}
 .fleet_grid .picture_button {flex-basis:70px;min-height:48px;}
 .world_calendar {font-size:10px;}
 .picture_grid.area_grid {grid-auto-rows:minmax(0,1fr);}
}
.world_options {display:flex;gap:4px;align-self:flex-end;pointer-events:auto;}
.world_options .btn {min-height:36px;padding:4px 8px;font-size:12px;}
.world_tool_menu {pointer-events:auto;background:var(--panel);padding:0;border-radius:14px;}
/* NOTE: Shared world dialogs use the available width; pictures and complete labels need separate space. */
.world_tool_menu .picture_grid {grid-template-columns:repeat(auto-fit,minmax(80px,1fr));grid-auto-rows:minmax(92px,max-content);gap:6px;}
.world_tool_menu .picture_button {min-height:92px;padding:5px;gap:4px;overflow:visible;}
.world_tool_menu .picture_button>.artwork_picture {height:44px;flex:0 0 44px;}
.world_tool_menu .picture_label {font-size:12px;line-height:1.15;overflow-wrap:anywhere;}
.world_tool_menu .picture_emoji {font-size:24px;}
.world_tools_dialog.modal,.world_details_dialog.modal {padding:8px;}
.world_tools_dialog .modal-content,.world_details_dialog .modal-content {position:relative;padding:12px;}
.world_tools_dialog .modal-content {width:min(960px,100%);}
.world_tools_dialog .modal-header,.world_details_dialog .modal-header {min-height:44px;padding-right:48px;}
.world_tools_dialog .modal-title,.world_details_dialog .modal-title {font-size:18px;}
.world_tools_dialog .modal-body,.world_details_dialog .modal-body {padding-top:6px;}
.world_tools_dialog .close,.world_details_dialog .close {position:absolute;top:8px;right:8px;min-width:44px;min-height:44px;padding:6px;}
.world_details_content {display:grid;gap:8px;}
.world_details_content .world_mission_strip {justify-content:flex-start;}
.world_details_content .world_calendar {align-self:stretch;flex-wrap:wrap;}
.world_details_content .world_calendar .btn,.world_details_content .world_calendar select {min-height:44px;}
@media (max-width:699px), (max-height:520px) {
 .world_tools_dialog .modal-content {padding:6px;}
 .world_tool_menu .picture_grid {grid-auto-rows:minmax(78px,max-content);gap:4px;}
 .world_tool_menu .picture_button {min-height:78px;padding:4px;gap:3px;}
 .world_tool_menu .picture_button>.artwork_picture {height:34px;flex-basis:34px;}
}
@media (max-height:520px) and (orientation:landscape) {
 .world_tool_menu .picture_grid {grid-template-columns:repeat(auto-fit,minmax(60px,1fr));}
}
.world_driver {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin-top:6px;}
.world_calendar select {max-width:125px;min-height:36px;font:inherit;background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:8px;}

/* The whole scene remains visible; supplies and controls never sit on top of its work area. */
.game_scene_layout {display:grid;grid-template-columns:minmax(0,1fr);min-width:0;min-height:0;position:relative;}
.game_scene_layout:has(.game_items:not([hidden])) {grid-template-columns:minmax(0,1fr) 112px;gap:10px;}
.game_items {display:flex;flex-direction:column;gap:10px;align-items:center;padding:12px 6px;border-radius:18px;background:var(--panel);overflow:auto;min-height:0;touch-action:none;}
.game_items[hidden] {display:none;}
.game_items:has(.inventory_piece:nth-child(n+4):not([hidden])) {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;gap:6px;}
.game_items:has(.inventory_piece:nth-child(n+4):not([hidden])) .inventory_piece {width:100%;height:64px;min-height:52px;}
.game_items .inventory_piece {position:relative;left:auto;top:auto;transform:none;width:90px;height:90px;min-height:72px;flex:0 0 auto;padding:7px;background:var(--soft);border:2px solid var(--line);}
.inventory_piece.is_dragging {transform:translate(-50%,-50%);}
.activity_backdrop {position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:0;}
.game_panel .world_chrome {position:static;inset:auto;pointer-events:auto;gap:8px;flex:none;min-height:max-content;}
.game_panel .world_chrome>* {flex-shrink:0;}
.world_chrome .world_view_controls {position:static;align-self:flex-start;}
.game_panel .world_mission_strip {justify-content:flex-start;}
/* NOTE: A large fleet scrolls in its retained row so its choices cannot cover the current game actions. */
.game_panel .fleet_grid {flex:none;min-height:64px;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;}
.game_panel .world_calendar {align-self:stretch;flex-wrap:wrap;}
.game_panel .world_options {align-self:stretch;}
.game_piece[role=img] {pointer-events:none;}
/* NOTE: Attachment targets receive input; the decorative parent must not cover the empty space between them. */
.game_piece>.game_slot:not(.plain_picture) {pointer-events:auto;}
:root {--attachment_edge:#ffe9a2;--attachment_fill:#fff3b830;--attachment_shadow:#5c452750;--fuel_edge:#ffbb64;--fuel_fill:#ffdc7b40;--deck_edge:#fff2bc;--deck_fill:#fff5bc30;}
.game_slot.attachment_target {padding:0;min-height:0;border:2px dashed var(--attachment_edge);border-radius:50%;background:var(--attachment_fill);box-shadow:0 0 0 2px var(--attachment_shadow);z-index:6;}
.game_slot.fuel_cap_target {border-color:var(--fuel_edge);background:var(--fuel_fill);}
.game_slot.jar_target {background:transparent;border-radius:10px;}
.game_slot.deck_target {transform:translate(-50%,-50%) rotate(-16deg);border:2px dashed var(--deck_edge);background:var(--deck_fill);}
.game_piece>.counter_unit {position:absolute;font-size:14px;}
.game_slot.route_node {font-size:clamp(15px,3vw,30px);width:36px;height:36px;padding:2px;border-radius:50%;background:var(--panel);color:var(--ink);border:2px solid var(--line);}
.game_piece.chassis_picture {padding:0;border:0;background:transparent;box-shadow:none;}
.game_piece.chassis_picture>.game_framed_picture {display:block;}
.game_piece.fitted_wheel {padding:0;border:0;background:transparent;box-shadow:none;}
@media (max-width:1000px) and (orientation:portrait) {
 .game_scene_layout {grid-area:board;height:min(60dvh,calc((100vw - 16px) * 3 / 4));}
 .game_scene_layout .game_stage {height:100%;grid-area:auto;}
 .game_scene_layout:has(.game_items:not([hidden])) {grid-template-columns:minmax(0,1fr) 76px;gap:6px;}
 .game_scene_layout:has(.inventory_piece:nth-child(n+4):not([hidden])) {grid-template-columns:minmax(0,1fr) 104px;}
 .game_items {padding:8px 3px;gap:8px;}
 .game_items .inventory_piece {width:66px;height:72px;min-height:66px;padding:4px;}
 .game_panel .world_chrome {grid-area:guide;}
 .game_play_area:has(.world_board) {grid-template-areas:'identity' 'prompt' 'board' 'fleet' 'guide' 'controls' 'meta';grid-template-rows:auto auto auto auto auto auto auto;}
 .game_play_area:has(.world_board) .world_chrome {grid-area:fleet;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:6px;}
 .game_play_area:has(.world_board) .world_mission_strip {grid-column:2;grid-row:1;gap:5px;font-size:15px;}
 .game_play_area:has(.world_board) .fleet_grid {grid-column:1/-1;grid-row:2;min-height:60px;}
 .game_play_area:has(.world_board) .world_calendar {grid-column:1;grid-row:3;align-self:center;}
 .game_play_area:has(.world_board) .world_options {grid-column:2;grid-row:3;align-self:center;}
 .game_play_area:has(.world_board) .world_tool_menu {grid-column:1/-1;}
 .game_play_area:has(.world_board) .game_scene_layout {height:min(37dvh,74vw);}
 #activity {overflow:auto;}
 .game_play_area {flex-shrink:0;}
}

/* Named quick play and a retained, grouped catalogue share the same direct launch buttons. */
.place_card {display:flex;flex-direction:column;gap:4px;min-width:0;}
.place_card .picture_button {flex:1;min-height:125px;padding:0 0 7px;gap:5px;border-radius:17px;box-shadow:0 2px 0 var(--line),0 5px 14px var(--art_colour_9);}
.place_card .picture_button img {max-height:78px;}
.place_card .picture_emoji {font-size:38px;max-height:60px;}
.picture_detail {font-size:13px;line-height:1.2;text-align:center;font-weight:600;}
.choose_game {min-height:44px;padding:5px;background:var(--soft);font-size:12px;}
.picture_grid.area_grid {flex:none;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:minmax(172px,auto);gap:12px;}
.catalogue_groups {display:flex;flex-direction:column;gap:18px;}
.catalogue_group h2 {font-size:17px;margin:0 0 8px;}
.catalogue_shortcuts {display:flex;gap:6px;flex-wrap:wrap;}
.catalogue_shortcuts .btn {min-height:44px;padding:6px 10px;font-size:12px;}
.catalogue_shortcuts [aria-current=page] {background:var(--accent);color:var(--panel);}
#crew_notice {font-size:13px;color:var(--muted);margin:0;}
.game_instruction {font-size:20px;line-height:1.35;margin:0;}
/* NOTE: This activity UI change keeps the recovery screen's original instruction size. */
#rescue_instruction {font-size:15px;}
.game_program {display:flex;flex-wrap:wrap;flex-shrink:0;gap:4px;list-style:none;margin:0;padding:6px;background:var(--soft);border-radius:10px;min-height:max-content;}
/* NOTE: Undo keeps list nodes mounted; hidden commands must still show the empty-program direction. */
.game_program:not(:has(li:not([hidden])))::before {content:attr(data-empty-label);font-size:12px;color:var(--muted);}
.game_program:not(:has(li:not([hidden]))) {min-height:36px;}
.game_program li {padding:4px 7px;background:var(--panel);border-radius:5px;font-size:17px;}
.world_drag_feedback {position:absolute;left:12px;right:12px;bottom:8px;margin:0;padding:8px 12px;border-radius:12px;background:var(--panel);color:var(--ink);font-size:14px;text-align:center;pointer-events:none;z-index:15;}
.world_view_controls {flex-wrap:wrap;align-items:center;}
.world_view_controls .focus_vehicle {background:var(--soft);color:var(--ink);font-size:12px;padding:7px 10px;}
#rescue .world_view_controls .focus_vehicle {background:var(--accent);color:var(--panel);}
.world_details {font-size:12px;}
.world_details summary {cursor:pointer;padding:6px;min-height:32px;}
.world_details .world_mission_strip {margin:5px 0;}
.world_details .world_calendar {margin:4px 0;}
.place_card[hidden],.catalogue_group[hidden],.game_program[hidden],.world_drag_feedback[hidden] {display:none;}
@media (max-width:1000px) and (orientation:portrait) {
 .picture_grid.area_grid {grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(164px,auto);gap:9px;}
 .place_card .picture_button {min-height:125px;}
 .place_card .picture_label {font-size:12px;}
 .picture_detail {font-size:12px;}
 .game_play_area {grid-template-areas:'identity' 'prompt' 'instruction' 'board' 'guide' 'controls' 'meta';grid-template-rows:auto auto auto auto auto auto auto;}
 .game_instruction {grid-area:instruction;font-size:18px;}
 #rescue_instruction {font-size:14px;}
 .game_play_area:has(.world_board) {grid-template-areas:'identity' 'prompt' 'instruction' 'board' 'fleet' 'guide' 'controls' 'meta';grid-template-rows:auto auto auto auto auto auto auto auto;}
 .game_play_area:has(.world_board) .game_scene_layout {height:min(40dvh,80vw);}
 .game_play_area:has(.world_board) .world_view_controls {grid-column:1/-1;grid-row:1;}
 .game_panel .world_view_controls {padding:2px;gap:2px;}
 .game_play_area:has(.world_board) .world_details {grid-column:1;grid-row:3;}
 .game_play_area:has(.world_board) .world_details .world_mission_strip {display:flex;}
 .game_play_area:has(.world_board) .world_details .world_calendar {display:flex;}
 .game_program {grid-area:program;}
 .game_play_area:has(.game_program:not([hidden])) {grid-template-areas:'identity' 'prompt' 'instruction' 'board' 'program' 'guide' 'controls' 'meta';grid-template-rows:auto auto auto auto auto auto auto auto;}
 .game_play_area:has(.world_board) .fleet_grid {min-height:52px;}
 /* NOTE: Taller touch controls must size their own grid row rather than overlap the guide below. */
 .game_play_area:has(.world_board) {grid-template-rows:repeat(8,max-content);}
 .game_panel .fleet_grid .picture_button {min-height:70px;}
 .world_view_controls .btn {min-height:44px;}
 .world_view_controls .focus_vehicle {min-height:44px;}
 #rescue .world_view_controls .btn {min-height:36px;}
 #rescue .world_view_controls .focus_vehicle {min-height:40px;}
}

.game_piece.tap_piece {cursor:pointer;border-style:solid;border-radius:14px;}
/* NOTE: The tap cue is a language-independent gesture; instructions and semantic labels carry the translated words. */
.game_piece.tap_piece:not(.plain_picture)::after {content:'☝';position:absolute;bottom:2px;right:4px;font:14px system-ui;color:var(--muted);}
.game_slot.closed_road {width:22px;height:22px;font-size:17px;padding:0;border:0;pointer-events:none;}
.game_panel .fleet_grid .picture_emoji {flex:none;line-height:1.15;}

.guide[hidden] {display:none;}

.guide.repeated_prompt {justify-content:flex-end;}
.guide.repeated_prompt .guide_picture {display:none;}

@media (max-height:520px) and (orientation:landscape) {
 .picture_grid.area_grid {grid-template-columns:repeat(6,minmax(0,1fr));}
 /* NOTE: The first phone-landscape row keeps each full game name above its chooser. */
 .place_card .picture_button {min-height:155px;}
 .place_card .picture_detail {width:100%;flex-shrink:0;}
 .library_title {font-size:17px;}
 .game_panel {overflow-y:auto;overscroll-behavior:contain;}
 .game_panel>* {flex-shrink:0;}
 .game_instruction {font-size:17px;}
 /* NOTE: Keep existing phone actions above the same scroll boundary after enlarging camera targets. */
 .game_panel {gap:2px;}
 .game_panel .world_chrome {gap:6px;}
}

@media (max-width:699px) and (orientation:portrait) {
 /* NOTE: Keep the larger camera and fleet targets on screen without reducing the map. */
 .game_play_area:has(.world_board) {gap:5px;}
}

/* NOTE: Keep the 4:3 board and DOM order; only spare landscape width can narrow the piece-board panel. */
@media (min-height:521px) and (orientation:landscape) {
 #activity {container-type:size;}
 .game_play_area {grid-template-columns:minmax(0,1fr) clamp(240px,calc(100cqw - 100cqh * 4 / 3 - 12px),310px);}
 .game_play_area:has(.world_board),.game_play_area:has(.parking_board) {grid-template-columns:minmax(0,1fr) 310px;}
 /* NOTE: A full crane program and earned controls need the original column width and intrinsic rows. */
 .game_play_area:has(.game_program:not([hidden])) {grid-template-columns:minmax(0,1fr) 310px;}
 .game_panel {align-self:start;max-height:100%;}
 .game_panel:has(.game_program:not([hidden])) {display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:'identity guide' 'prompt prompt' 'instruction instruction' 'feedback feedback' 'program program' 'controls controls' 'meta meta';gap:4px;padding:8px;}
 .game_panel:has(.game_program:not([hidden])) #game_title {grid-area:identity;align-self:center;}
 .game_panel:has(.game_program:not([hidden])) #game_prompt {grid-area:prompt;}
 .game_panel:has(.game_program:not([hidden])) .game_instruction {grid-area:instruction;}
 .game_panel:has(.game_program:not([hidden])) .guide {grid-area:feedback;}
 .game_panel:has(.game_program:not([hidden])) .guide.repeated_prompt {grid-area:guide;}
 .game_panel:has(.game_program:not([hidden])) .game_program {grid-area:program;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));}
 .game_panel:has(.game_program:not([hidden])) .game_program li {font-size:15px;padding:4px;}
 .game_panel:has(.game_program:not([hidden])) .game_program::before {grid-column:1/-1;}
 .game_panel:has(.game_program:not([hidden])) .game_controls {grid-area:controls;grid-template-columns:repeat(3,minmax(0,1fr));}
 .game_panel:has(.game_program:not([hidden])) .game_caption {grid-area:meta;align-self:center;padding-right:76px;}
 .game_panel:has(.game_program:not([hidden])) .game_grown_up {grid-area:meta;justify-self:end;}
 .game_play_area:has(.world_board) .game_panel {padding:6px;gap:6px;}
 .game_panel .fleet_grid .picture_button {min-height:70px;}
 .game_caption {margin:0;}
 .game_grown_up {flex-shrink:0;}
}

/* NOTE: Home pictures fill the available cards; catalogue tiles and fleet pictures keep their own sizes. */
@media (min-height:521px) and (orientation:landscape), (min-width:700px) and (orientation:portrait) {
 .picture_grid.area_grid {flex:1;grid-auto-rows:minmax(196px,1fr);}
 .place_card .picture_button {min-height:0;}
 .place_card .picture_button>.artwork_picture {height:auto;min-height:96px;flex:1 1 0;}
 .place_card .picture_button img {max-height:none;}
}
@media (min-width:700px) and (orientation:portrait) {
 .picture_grid.area_grid {grid-template-columns:repeat(3,minmax(0,1fr));}
 .place_card .picture_button>.artwork_picture {min-height:110px;}
}

/* Responsive pictures retain transparent object silhouettes and use AVIF/WebP sources from shared UI. */
.artwork_picture {display:block;position:relative;overflow:hidden;pointer-events:none;}
.artwork_picture>picture,.artwork_picture>svg {display:block;width:100%;height:100%;}
.artwork_picture img {display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;}
/* NOTE: Painted place pictures fill their existing cards; names, saved games, order and choosers stay live. */
.place_card .picture_button>.artwork_picture {border-bottom:1px solid var(--line);}
.place_card .picture_button>.artwork_picture img {object-fit:cover;object-position:center 48%;}
.place_card .picture_label,.place_card .picture_detail {padding:0 5px;}
.place_card .picture_detail {font-weight:500;color:var(--muted);}
.place_card .choose_game {background:var(--panel);box-shadow:0 1px 0 var(--line);}
.picture_button>.artwork_picture {width:100%;height:76px;flex:0 0 76px;}
.picture_button>.artwork_picture img {max-height:none;}
.fleet_grid .picture_button>.artwork_picture {height:34px;flex-basis:34px;}
.game_piece>.artwork_picture,.game_slot>.artwork_picture {position:absolute;inset:0;width:100%;height:100%;}
.game_piece.illustrated_object,.game_slot.illustrated_object {background:transparent;border-color:transparent;box-shadow:none;}
:root {--art_drag_shadow:#243b4355;--art_drop_fill:#79cbb522;}
.game_piece.illustrated_object.is_dragging {filter:drop-shadow(0 8px 6px var(--art_drag_shadow));}
.game_slot.illustrated_object.drop_target {border-color:var(--accent);background:var(--art_drop_fill);border-radius:50%;}
/* NOTE: Keep the 44px tap area while smaller visible badges leave adjacent road numbers readable. */
.game_slot.road_stop {width:44px;height:44px;min-height:44px;border-radius:50%;background:transparent;font-size:22px;border:0;}
.game_slot.road_stop>span {padding:1px 2px;line-height:1;border:1px solid var(--accent);border-radius:50%;background:var(--panel);font-size:clamp(10px,3.2cqw,18px);}
.game_slot.garage_bay {border:0;background:transparent;box-shadow:none;font-size:30px;color:var(--ink);}
.game_slot.garage_bay>span {padding:1px 7px;background:var(--panel);border-radius:7px;}
.game_slot.rig_object {min-height:0;}
#game_board .game_slot.road_stop {font-size:22px;}
#game_board .game_slot.garage_bay {font-size:25px;}
.illustrated_object.has_art_caption>.artwork_picture {height:62%;}
.illustrated_object.has_art_caption>span {position:absolute;bottom:0;left:0;right:0;padding:3px;background:var(--panel);color:var(--ink);border-radius:7px;font-size:13px;line-height:1.2;white-space:pre-line;}
/* NOTE: This caption is painted on honey-coloured timber in both themes, rather than on an interface panel. */
.sign_ink.has_art_caption>span {background:transparent;color:var(--art_colour_3);}
.equipment_picture.artwork_picture {width:36px;height:36px;}
.game_framed_picture {pointer-events:none;}
.task_material {position:absolute;inset:0;width:100%;height:100%;pointer-events:none;}
.game_slot.textured_task {background:transparent;border:0;box-shadow:none;}
#game_board .generated_sign_ink {font-size:clamp(10px,1.2vw,16px);color:var(--art_colour_3);}
.board_view_controls {position:static;grid-column:1/-1;justify-self:start;}
.number_truck {container-type:inline-size;}
/* NOTE: These are measured, non-interactive count marks; button padding and minimum height cover the truck. */
.number_truck>.counter_unit {min-height:0;padding:0;}
#game_board .number_truck>.truck_lights {font-size:13cqw;}
#game_board .number_truck>.truck_numeral {font-size:35cqw;}
@media (max-width:1000px) and (orientation:portrait) {
 .picture_button>.artwork_picture {height:62px;flex-basis:62px;}
 .fleet_grid .picture_button>.artwork_picture {height:30px;flex-basis:30px;}
 .game_slot.road_stop {font-size:17px;}
 .game_slot.garage_bay {font-size:22px;}
 #game_board .game_slot.road_stop {font-size:17px;}
 #game_board .game_slot.garage_bay {font-size:19px;}
 .game_play_area:has(.game_program:not([hidden])) .game_scene_layout {height:min(34dvh,65vw);}
}
@media (max-width:699px) and (orientation:portrait) {
 /* NOTE: Reserve the full program height before the crane controls; fit the whole yard into the remaining phone space. */
 .game_play_area:has(.game_program:not([hidden])) .game_scene_layout {height:min(26dvh,55vw);}
}
/* NOTE: Keep phone header sizing separate from the readable iPad portrait header. */
@media (max-width:699px) and (orientation:portrait) {
 .brand {display:none;font-size:12px;}
 .app_header {gap:4px;}
 .app_header select,.app_header .btn {padding:7px;font-size:11px;}
 .app_header #profile_button {max-width:45%;}
 .library_title {font-size:18px;}
 /* NOTE: Phone places retain their launch order and readable names; the catalogue can scroll. */
 .picture_grid.area_grid {flex:1;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);}
 .place_card .picture_button {min-height:0;}
 .place_card .picture_button>.artwork_picture {height:auto;min-height:40px;flex:1 1 0;}
 .place_card .picture_button img {max-height:none;}
 .place_card .picture_detail {width:100%;flex-shrink:0;}
}
@media (min-width:700px) and (max-width:1000px) and (orientation:portrait) {
 .place_card .picture_label {font-size:16px;}
 .picture_detail {font-size:14px;}
}

/* NOTE: Phone-landscape physical boards without supplies take only the stage width that its height-limited 4:3 board leaves free; #game_controls stays a direct child of .game_panel. */
@media (max-height:520px) and (min-width:600px) and (orientation:landscape) {
 #activity {container-type:size;}
 /* NOTE: Short-landscape supplies need a wider shared panel to show every opening part beside the instructions and keep Restart visible. */
 .game_play_area:has(.board_view_controls:not([hidden])):not(:has(.game_items:not([hidden]))) {grid-template-columns:minmax(0,1fr) clamp(350px,calc(100cqw - 100cqh * 4 / 3 - 6px),450px);}
 .game_play_area:has(.board_view_controls:not([hidden])):has(.game_items:not([hidden])) {grid-template-columns:minmax(0,1fr) 400px;}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_panel {display:grid;grid-template-columns:minmax(0,2fr) minmax(0,3fr);grid-template-areas:'identity controls' 'prompt controls' 'instruction controls' 'guide controls' 'program program' 'supplies supplies' 'meta meta';grid-template-rows:repeat(7,max-content);align-content:start;gap:2px;padding:2px;overflow:auto;}
 .game_play_area:has(.board_view_controls:not([hidden])):has(.game_items:not([hidden])) .game_panel {grid-template-columns:repeat(2,minmax(0,1fr));}
 /* NOTE: Supplies now belong to this retained panel; implicit grid placement can put them below the viewport. */
 .game_play_area:has(.board_view_controls:not([hidden])) .game_items:not([hidden]) {grid-area:supplies;grid-template-columns:repeat(4,minmax(0,1fr));min-height:0;}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_instruction {line-height:1.2;}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_program:not(:has(li:not([hidden]))) {min-height:0;padding:3px;}
 .game_play_area:has(.board_view_controls:not([hidden])) #game_title {grid-area:identity;padding-right:52px;min-height:44px;}
 .game_play_area:has(.board_view_controls:not([hidden])) #game_prompt {grid-area:prompt;}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_instruction {grid-area:instruction;}
 .game_play_area:has(.board_view_controls:not([hidden])) .guide {grid-area:guide;}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_program {grid-area:program;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:3px;padding:3px;max-height:72px;overflow:auto;}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_program::before {grid-column:1/-1;}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_program li {padding:2px 4px;}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_controls {grid-area:controls;grid-template-columns:repeat(4,minmax(0,1fr));align-content:start;}
 .game_play_area:has(.board_view_controls:not([hidden])):has(.game_items:not([hidden])) .game_controls {grid-template-columns:repeat(3,minmax(0,1fr));}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_caption {grid-area:meta;margin:0;}
 .game_play_area:has(.board_view_controls:not([hidden])) .game_grown_up {grid-area:identity;align-self:start;justify-self:end;}
}

/* NOTE: Phone pages reserve intrinsic control rows first; the scene takes the remaining height. */
@media (max-width:699px) and (orientation:portrait) {
 #activity {overflow:visible;}
 .game_play_area,
 .game_play_area:has(.world_board) {
  flex:1 1 0;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:max-content max-content max-content minmax(0,1fr) max-content max-content max-content max-content;
  grid-template-areas:'identity' 'prompt' 'instruction' 'board' 'fleet' 'guide' 'controls' 'meta';
  gap:4px;
  align-content:stretch;
 }
 .game_play_area:has(.game_program:not([hidden])) {
  grid-template-rows:max-content max-content max-content minmax(0,1fr) max-content max-content max-content max-content;
  grid-template-areas:'identity' 'prompt' 'instruction' 'board' 'program' 'guide' 'controls' 'meta';
 }
 .game_scene_layout,
 .game_play_area:has(.world_board) .game_scene_layout,
 .game_play_area:has(.game_program:not([hidden])) .game_scene_layout {height:auto;min-height:0;}
 .game_stage,
 .game_stage:has(.world_board),
 .game_scene_layout .game_stage {height:100%;min-height:0;}
 .game_play_area .world_chrome {gap:2px;}
 .game_play_area:has(.world_board) .world_chrome {gap:2px;}
 .game_play_area:has(.world_board) .fleet_grid {grid-row:2;min-height:0;padding:0;}
 /* NOTE: Reuse the spare camera-row width for More and Tools before taking height from the map. */
 .game_play_area:has(.world_board) .world_chrome {grid-template-columns:44px 44px 44px minmax(0,1fr) max-content max-content;grid-template-rows:44px 44px max-content;}
 .game_play_area:has(.world_board) .world_view_controls {display:contents;}
 .game_play_area:has(.world_board) .world_view_controls>:nth-child(1) {grid-column:1;grid-row:1;}
 .game_play_area:has(.world_board) .world_view_controls>:nth-child(2) {grid-column:2;grid-row:1;}
 .game_play_area:has(.world_board) .world_view_controls>:nth-child(3) {grid-column:3;grid-row:1;}
 .game_play_area:has(.world_board) .world_view_controls>:nth-child(4) {grid-column:4/-1;grid-row:1;}
 .game_play_area:has(.world_board) .world_view_controls .focus_vehicle {grid-column:1/5;grid-row:2;}
 .game_play_area:has(.world_board) .world_details {grid-column:5;grid-row:2;align-self:center;}
 .game_play_area:has(.world_board) .world_options {grid-column:6;grid-row:2;align-self:center;}
 .game_play_area:has(.world_board) .fleet_grid {grid-column:1/-1;grid-row:3;}
 .game_play_area:has(.world_board):has(.game_grown_up:not([hidden])) .guide {margin-right:72px;}
 .game_play_area:has(.world_board) .game_grown_up {grid-area:guide;justify-self:end;align-self:start;}
 .game_play_area:has(.world_board) .game_controls {grid-template-columns:repeat(auto-fit,minmax(80px,1fr));}
 .game_panel .world_view_controls {padding:0;}
 .game_controls {gap:4px;}
 .game_instruction {font-size:18px;}
 .game_program {padding:3px;gap:3px;}
 .game_program li {padding:2px 5px;}
 .play_area {grid-template-rows:minmax(0,1fr) max-content;}
 .action_panel {max-height:none;padding:6px;gap:4px;overflow:visible;}
 .action_panel .guide.repeated_prompt {min-height:0;}
 .action_panel .condition:empty {display:none;}
 .action_grid:has(#inspect_wheels:not([hidden])) {grid-template-columns:repeat(4,minmax(0,1fr));}
 .action_grid:has(#inspect_wheels:not([hidden])) .btn {flex-direction:column;gap:2px;min-height:52px;}
 .action_grid:has(#test_pull:not([hidden])) {grid-template-columns:repeat(3,minmax(0,1fr));}
 /* NOTE: Equipment status marks use the corner so rigging keeps map space without smaller touch targets. */
 .tool_tray .btn {position:relative;}
 .tool_tray .btn::after {position:absolute;top:3px;right:3px;}
}
@media (max-height:520px) and (orientation:landscape) {
 .action_panel {padding:4px;gap:0;}
 .action_grid:has(#inspect_wheels:not([hidden])) {grid-template-columns:repeat(4,minmax(0,1fr));}
 .action_grid:has(#inspect_wheels:not([hidden])) .btn {flex-direction:column;gap:2px;min-height:52px;}
 .action_grid:has(#test_pull:not([hidden])) {grid-template-columns:repeat(3,minmax(0,1fr));}
 .tool_tray .btn {position:relative;}
 .tool_tray .btn::after {position:absolute;top:3px;right:3px;}
 .tool_tray {padding-bottom:1px;}
 .game_play_area:has(.world_board) {
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  grid-template-rows:max-content max-content max-content minmax(0,1fr) max-content max-content;
  grid-template-areas:'identity fleet' 'prompt fleet' 'instruction fleet' 'board fleet' 'controls controls' 'guide meta';
  gap:3px 6px;
 }
 .game_play_area:has(.world_board) .game_panel {display:contents;}
 .game_play_area:has(.world_board) #game_title {grid-area:identity;}
 .game_play_area:has(.world_board) #game_prompt {grid-area:prompt;}
 .game_play_area:has(.world_board) .game_instruction {grid-area:instruction;}
 .game_play_area:has(.world_board) .game_scene_layout {grid-area:board;min-height:0;}
 .game_play_area:has(.world_board) .world_chrome {grid-area:fleet;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px;align-self:start;}
 .game_play_area:has(.world_board) .world_view_controls {grid-column:1/-1;grid-row:1;}
 .game_play_area:has(.world_board) .fleet_grid {grid-column:1/-1;grid-row:2;}
 .game_play_area:has(.world_board) .world_details {grid-column:1;grid-row:3;}
 .game_play_area:has(.world_board) .world_options {grid-column:2;grid-row:3;}
 /* NOTE: Fit the actual current actions in one row when possible, including the winter farm choices. */
 .game_play_area:has(.world_board) .game_controls {grid-area:controls;grid-template-columns:repeat(auto-fit,minmax(76px,1fr));}
 .game_play_area:has(.world_board) .guide {grid-area:guide;}
 .game_play_area:has(.world_board) .game_caption {grid-area:meta;margin:0;}
 .game_play_area:has(.world_board) .game_grown_up {grid-area:meta;}
 .game_panel .world_chrome .fleet_grid {min-height:0;padding:0;}
 .game_panel .world_chrome .fleet_grid .picture_button {min-height:72px;}
 .game_panel .world_chrome .world_view_controls {padding:0;}
 .game_panel .world_chrome .world_details {min-height:0;}
 .game_panel .world_chrome .world_options {align-self:flex-start;}
}
@media (max-width:699px) and (max-height:740px) and (orientation:portrait) {
 .picture_grid.area_grid {flex:none;grid-auto-rows:minmax(174px,max-content);}
}

/* NOTE: Match storybook-light-dark-v1: a painted world, one raised card rim and an integrated chooser; keep every installed game. */
:root {--storybook_rim:#fff8df;--storybook_edge:#cfb98b;--storybook_shadow:#51391c36;--storybook_footer:#fbf1d8;--storybook_text:#193b34;--storybook_night_rim:#3b718a;--storybook_night_paper:#112d3d;--storybook_shine:#fff5;--storybook_sign_low:#ead7ae;--storybook_sign_mid:#fff5da;--storybook_sign_high:#efe2c1;--storybook_sign_edge:#ac8b55;--storybook_sign_shadow:#8b693e66;--storybook_sign_ambient:#263b4533;--storybook_rim_shine:#fff9;--storybook_detail:#5e6653;--storybook_night_edge:#55839b;--storybook_night_shine:#93bfcc55;--storybook_night_shadow:#0005;--storybook_panel_shine:#fff4;--storybook_panel_night_edge:#345667;}
body:has(#yard.active) {background-image:linear-gradient(to bottom,transparent 8%,var(--paper) 78%),image-set(url('../assets/artwork/storybook-village-v2.avif') type('image/avif'),url('../assets/artwork/storybook-village-v2.webp') type('image/webp'));background-size:cover;background-position:center top;background-repeat:no-repeat;background-blend-mode:normal;}
body.dark:has(#yard.active) {background-image:linear-gradient(to bottom,transparent 8%,var(--storybook_night_paper) 85%),image-set(url('../assets/artwork/storybook-village-v2-dark.avif') type('image/avif'),url('../assets/artwork/storybook-village-v2-dark.webp') type('image/webp'));}
/* NOTE: Painted frames keep the iPhone safe-area insets in both orientations. */
#app {position:relative;padding:max(16px,env(safe-area-inset-top)) max(22px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(22px,env(safe-area-inset-left));gap:10px;}
.app_header {align-self:flex-start;min-height:48px;padding:2px 8px;background:var(--panel);border:1px solid var(--line);border-radius:11px;box-shadow:0 2px 5px var(--storybook_shadow);}
.app_header .btn {background:transparent;border:0;border-radius:6px;box-shadow:none;padding:8px 12px;}
.app_header .brand {font-size:13px;}
.app_header .library_nav_slot {padding-inline:4px;}
.app_header .quiet_nav {font-size:13px;}
.app_header #home {font-size:15px;font-weight:600;}
.btn {border-radius:8px;box-shadow:inset 0 1px 0 var(--storybook_shine),0 2px 2px var(--storybook_shadow);}
#yard {padding:8px 0 0;}
body:has(#yard.active [data-stage=areas].show) .app_header {margin-left:230px;}
#yard:has([data-stage=areas].show) .library_title {position:absolute;top:15px;left:30px;z-index:1;padding:10px 20px 13px;font-size:32px;line-height:1.05;color:var(--storybook_text);background:linear-gradient(6deg,var(--storybook_sign_low),var(--storybook_sign_mid) 68%,var(--storybook_sign_high));border:1px solid var(--storybook_sign_edge);border-radius:7px 10px 6px 9px;box-shadow:0 3px 0 var(--storybook_sign_shadow),0 6px 10px var(--storybook_sign_ambient);transform:rotate(-3deg);}
#yard:has([data-stage=areas].show) {padding-top:22px;}
.picture_grid.area_grid {grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:minmax(190px,1fr);gap:12px;}
.place_card {position:relative;display:flex;gap:0;padding:3px;border:1px solid var(--storybook_edge);border-radius:11px;background:var(--storybook_rim);box-shadow:inset 0 0 0 1px var(--storybook_rim_shine),0 3px 6px var(--storybook_shadow);overflow:hidden;}
.place_card .picture_button {flex:1;min-height:0;padding:0;gap:0;border:0;border-radius:7px;background:var(--storybook_footer);color:var(--storybook_text);box-shadow:none;container-type:normal;}
.place_card .picture_button>.artwork_picture {width:100%;height:auto;min-height:85px;flex:1 1 0;border:0;border-radius:5px 5px 0 0;}
.place_card .picture_button>.artwork_picture img {max-height:none;object-fit:cover;object-position:center 53%;}
.place_footer {display:flex;align-items:center;background:var(--storybook_footer);color:var(--storybook_text);gap:4px;}
.place_card .picture_label {flex:1;min-width:0;align-self:stretch;display:flex;align-items:center;min-height:44px;padding:5px 0 2px 9px;font-size:17px;font-weight:700;text-align:left;line-height:1.1;}
.place_card .picture_detail {flex:none;margin:0;background:var(--storybook_footer);width:100%;min-height:25px;padding:1px 10px 6px;font-size:11px;font-weight:400;text-align:left;line-height:1.15;color:var(--storybook_detail);}
.place_card .choose_game {position:static;flex:0 0 44%;width:44%;min-height:44px;padding:3px 3px 3px 7px;border:0;border-radius:0;background:transparent;box-shadow:none;color:var(--storybook_text);font-size:11px;justify-content:flex-end;text-align:right;line-height:1.1;}
.place_card .choose_game::after {content:'›';margin-left:3px;font-size:23px;line-height:1;}
.place_card:last-child .picture_label {padding-right:12px;}
body.dark .place_card {background:var(--storybook_night_rim);border-color:var(--storybook_night_edge);box-shadow:inset 0 0 0 1px var(--storybook_night_shine),0 3px 6px var(--storybook_night_shadow);}
.game_panel,.action_panel {border:3px solid var(--line);border-radius:13px;box-shadow:inset 0 0 0 1px var(--storybook_panel_shine),0 3px 9px var(--storybook_shadow);}
#activity {position:relative;}
/* NOTE: The floor belongs to the registered board with its truck and attachment targets; screen decoration must not provide another floor. */
.storybook_workshop .scene_picture {visibility:visible;}
.storybook_mechanic {display:none;position:absolute;left:0;bottom:5%;width:24%;height:39%;z-index:4;pointer-events:none;}
.storybook_wheels .storybook_mechanic {display:block;}
.storybook_workshop .game_stage {border-radius:0;}
.storybook_workshop .game_play_area {grid-template-columns:minmax(0,1fr) clamp(190px,20vw,260px);gap:14px;}
.storybook_workshop .game_panel {align-self:center;max-height:100%;padding:14px 12px;gap:10px;background:var(--panel);border-color:var(--storybook_rim);}
body.dark .storybook_workshop .game_panel {border-color:var(--storybook_panel_night_edge);}
.storybook_workshop #game_title {text-align:center;font-size:14px;}
.storybook_workshop #game_prompt {font-size:14px;}
.storybook_workshop .game_instruction {text-align:center;font-size:20px;}
.game_items {width:100%;flex:0 1 auto;max-height:45dvh;min-height:0;padding:8px;border:1px solid var(--line);border-radius:10px;background:var(--soft);gap:10px;overflow:auto;}
.game_items .inventory_piece {width:min(100%,130px);height:112px;min-height:72px;padding:7px;border:0;border-radius:8px;background:transparent;box-shadow:none;}
.game_items:has(.inventory_piece:nth-child(n+4):not([hidden])) {grid-template-columns:repeat(2,minmax(0,1fr));}
.storybook_workshop .guide {flex-direction:column;align-items:stretch;justify-content:stretch;}
.storybook_workshop .guide_picture {display:none;}
.storybook_workshop .guide_line {font-size:12px;}
.storybook_workshop .guide .btn {flex:auto;min-height:44px;background:var(--panel);border:1px solid var(--line);}
.storybook_workshop .guide .btn::after {content:attr(aria-label);font-size:13px;margin-left:6px;}
.storybook_workshop .game_caption {margin-top:0;}
.storybook_workshop .game_grown_up {position:static;}
@media (min-height:521px) and (orientation:landscape), (min-width:700px) and (orientation:portrait) {
 .picture_grid.area_grid {flex:1;grid-auto-rows:minmax(190px,1fr);}
}
@media (max-width:1000px) and (orientation:portrait) {
 #app {padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));gap:8px;}
 .picture_grid.area_grid {grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;}
 .place_card .picture_label {font-size:14px;padding-left:6px;}
 .storybook_workshop .game_play_area {grid-template-columns:minmax(0,1fr);}
 .storybook_workshop .game_panel {display:contents;}
 /* NOTE: A dragged part becomes fixed-position; reserve the tray height so ResizeObserver cannot cancel the last drag. */
 .game_items {grid-area:supplies;display:flex;flex-direction:row;justify-content:center;height:96px;max-height:110px;min-height:96px;padding:4px;}
 .game_items .inventory_piece {width:80px;height:80px;min-height:66px;}
 .game_play_area {grid-template-areas:'identity' 'prompt' 'instruction' 'board' 'supplies' 'guide' 'controls' 'meta';grid-template-rows:max-content max-content max-content minmax(0,1fr) max-content max-content max-content max-content;}
 .game_play_area:has(.game_program:not([hidden])) {grid-template-areas:'identity' 'prompt' 'instruction' 'board' 'program' 'supplies' 'guide' 'controls' 'meta';grid-template-rows:max-content max-content max-content minmax(0,1fr) max-content max-content max-content max-content max-content;}
 .storybook_workshop #game_title,.storybook_workshop #game_prompt,.storybook_workshop .game_instruction,.storybook_workshop .guide,.storybook_workshop .game_caption {width:fit-content;max-width:100%;justify-self:center;background:var(--panel);border-radius:7px;padding:3px 9px;}
 .storybook_workshop .game_caption {min-height:28px;}
 .storybook_workshop .game_grown_up {align-self:end;}
}
@media (max-width:699px) and (orientation:portrait) {
 body:has(#yard.active [data-stage=areas].show) .app_header {margin-left:0;align-self:stretch;}
 #yard:has([data-stage=areas].show) .library_title {position:static;align-self:flex-start;font-size:23px;padding:7px 14px;}
 #yard:has([data-stage=areas].show) {padding-top:0;}
 .app_header {gap:2px;padding:2px 3px;}
 .app_header .btn {padding:7px;font-size:11px;}
 .picture_grid.area_grid {flex:1;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:minmax(139px,1fr);gap:7px;}
 .place_card {padding:2px;border-radius:8px;}
 .place_card .picture_button>.artwork_picture {min-height:59px;}
 .place_footer {flex-direction:column;gap:0;}
 .place_card .picture_label {width:100%;min-height:28px;font-size:12px;padding:3px 5px;overflow-wrap:anywhere;}
 .place_card .picture_detail {min-height:26px;font-size:10px;padding:1px 4px 4px;}
 .place_card .choose_game {position:static;flex:auto;align-self:stretch;width:100%;min-height:44px;padding:3px 5px;background:var(--storybook_footer);border-radius:0 0 5px 5px;font-size:10px;justify-content:space-between;}
 .storybook_workshop .game_play_area {gap:4px;}
 .storybook_workshop .game_scene_layout {height:auto;min-height:0;}
 .storybook_workshop .game_instruction {font-size:18px;}
 .game_items {height:90px;min-height:90px;max-height:90px;}
}
@media (max-height:520px) and (orientation:landscape) {
 #app {padding:max(6px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));gap:5px;}
 body:has(#yard.active [data-stage=areas].show) .app_header {margin-left:150px;}
 #yard:has([data-stage=areas].show) .library_title {font-size:23px;top:8px;left:14px;padding:7px 13px;}
 #yard:has([data-stage=areas].show) {padding-top:4px;}
 .picture_grid.area_grid {flex:1;grid-template-columns:repeat(6,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:6px;}
 .place_card .picture_button>.artwork_picture {min-height:40px;}
 .place_footer {flex-direction:column;gap:0;}
 .place_card .picture_label {width:100%;font-size:11px;padding:3px 5px;min-height:26px;overflow-wrap:anywhere;}
 .place_card .picture_detail {font-size:10px;padding:1px 4px 4px;}
 .place_card .choose_game {position:static;flex:auto;align-self:stretch;width:100%;min-height:44px;background:var(--storybook_footer);font-size:10px;padding:3px 5px;justify-content:space-between;}
 .storybook_workshop .game_play_area {grid-template-columns:minmax(0,1fr) clamp(380px,calc(100cqw - 100cqh * 4 / 3 - 8px),440px);gap:8px;}
 /* NOTE: Keep one side panel and its retained supplies; short landscape puts actions beside text so Restart stays visible. */
 #activity.storybook_workshop .game_panel {display:grid;grid-template-columns:minmax(0,2fr) minmax(0,3fr);grid-template-areas:'identity controls' 'prompt controls' 'instruction controls' 'guide controls' 'supplies supplies' 'meta grownup';grid-template-rows:repeat(5,max-content) minmax(44px,1fr);align-self:stretch;align-content:start;padding:2px;gap:2px;overflow:visible;}
 .storybook_workshop #game_title {grid-area:identity;}
 .storybook_workshop #game_prompt {grid-area:prompt;}
 .storybook_workshop .game_instruction {grid-area:instruction;}
 .storybook_workshop .game_items {grid-area:supplies;min-height:0;max-height:82px;}
 .storybook_workshop .guide {grid-area:guide;min-width:0;}
 .storybook_workshop #game_controls {grid-area:controls;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;}
 .storybook_workshop .game_caption {grid-area:meta;}
 .storybook_workshop .game_grown_up {grid-area:grownup;align-self:start;}
 .storybook_workshop .game_instruction {font-size:16px;}
 .storybook_workshop .game_caption {font-size:9px;}
 .game_items {flex-direction:row;justify-content:center;max-height:94px;padding:3px;gap:4px;}
 .game_items .inventory_piece {height:74px;width:78px;min-height:66px;}
}
@media (max-width:1000px) and (orientation:portrait), (max-height:520px) and (orientation:landscape) {
 /* NOTE: Fit every installed part in the reserved phone tray row; a dragged part must not resize the scene. */
 .game_items:has(.inventory_piece:nth-child(n+4):not([hidden])) {grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(44px,1fr);gap:4px;}
}

/* NOTE: Animate reused fluid artwork at its measured contact; visual size must stay separate from the 44px fire target. */
:root {--fire_glow:#ff8c3270;--fire_ember:#ffd36d;--fire_ember_glow:#ff641c;--fire_water_glint:#e0ffff;--fire_water_ripple:#d3f8f4;}
.fire_effect {position:absolute;inset:0;pointer-events:none;overflow:visible;}
.fire_flame,.fire_smoke {position:absolute;pointer-events:none;}
.fire_flame {animation:fire_flame_flicker .9s ease-in-out infinite;filter:drop-shadow(0 0 3px var(--fire_glow));}
.fire_smoke {animation:fire_smoke_rise 4.8s linear infinite;}
.fire_ember {position:absolute;width:2px;height:3px;border-radius:50%;background:var(--fire_ember);box-shadow:0 0 3px var(--fire_ember_glow);animation:fire_ember_rise 2.3s linear infinite;}
.fire_target .fire_badge {z-index:2;}
.fire_water_motion {position:absolute;inset:0;width:100%;height:100%;z-index:1;pointer-events:none;overflow:hidden;}
.fire_water_glint {fill:none;stroke:var(--fire_water_glint);stroke-width:1.3;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:3 29 8 41;opacity:.29;animation:fire_water_flow 7s linear infinite;}
.fire_water_ripple {fill:none;stroke:var(--fire_water_ripple);stroke-width:1;stroke-linecap:round;stroke-dasharray:12 8 23 12;animation:fire_water_ring 5.4s ease-out infinite;}
.fire_effects_paused :is(.fire_flame,.fire_smoke,.fire_ember,.fire_water_glint,.fire_water_ripple),
#activity:not(.active) :is(.fire_flame,.fire_smoke,.fire_ember,.fire_water_glint,.fire_water_ripple) {animation-play-state:paused;}
@keyframes fire_flame_flicker {
 0%,100% {transform:scale(.96,1) skewX(-2deg);opacity:.95;}
 24% {transform:scale(1.06,.88) skewX(2deg);opacity:.83;}
 48% {transform:scale(.92,1.12) skewX(-3deg);opacity:1;}
 76% {transform:scale(1.03,.96) skewX(3deg);opacity:.91;}
}
@keyframes fire_smoke_rise {
 0% {transform:translate(0,0) scale(.7);opacity:0;}
 20% {opacity:.34;}
 65% {opacity:.24;}
 100% {transform:translate(var(--smoke_drift),var(--smoke_rise)) scale(1.2);opacity:0;}
}
@keyframes fire_ember_rise {
 0% {transform:translate(0,0);opacity:0;}
 12%,35% {opacity:.9;}
 100% {transform:translate(7px,var(--ember_rise));opacity:0;}
}
@keyframes fire_water_flow {to {stroke-dashoffset:-162;}}
@keyframes fire_water_ring {
 0% {transform:scale(.65);opacity:0;}
 25% {opacity:.32;}
 100% {transform:scale(1.45);opacity:0;}
}

/* NOTE: Fire Crew matches the full landscape mock: generated scenery fills the viewport, with one right-hand panel. */
body:has(#activity.fire_scene.active) #app {
 padding:0;
 gap:0;
}
body:has(#activity.fire_scene.active) .app_header {
 position:absolute;
 left:max(12px,env(safe-area-inset-left));
 top:max(12px,env(safe-area-inset-top));
 z-index:120;
}
body:has(#activity.fire_scene.active) .save_bar {
 position:absolute;
 left:12px;
 bottom:max(6px,env(safe-area-inset-bottom));
 z-index:110;
 padding:2px 6px;
 border-radius:4px;
 background:var(--panel);
}
#activity.fire_scene {
 gap:0;
 overflow:hidden;
}
#activity.fire_scene .game_play_area {
 display:grid;
 grid-template-columns:minmax(0,1fr) 288px;
 grid-template-rows:minmax(0,1fr);
 grid-template-areas:'board panel';
 gap:0;
 align-content:stretch;
}
#activity.fire_scene .game_scene_layout {
 grid-area:board;
 height:100%;
 min-height:0;
}
#activity.fire_scene .game_stage {
 height:100%;
 border-radius:0;
}
#activity.fire_scene .game_board {
 width:100%;
 height:100%;
}
#activity.fire_scene .game_panel {
 grid-area:panel;
 display:flex;
 flex-direction:column;
 align-self:stretch;
 height:100%;
 max-height:100%;
 gap:14px;
 padding:24px 20px max(20px,env(safe-area-inset-bottom));
 border:0;
 border-left:1px solid var(--line);
 border-radius:0;
 box-shadow:none;
 overflow:auto;
}
#activity.fire_scene #game_title {
 font-size:16px;
 font-weight:500;
}
#activity.fire_scene #game_prompt {
 font-size:28px;
 font-weight:700;
 line-height:1.15;
 margin:8px 0;
}
#activity.fire_scene .game_instruction {
 font-size:18px;
 margin:0;
}
#activity.fire_scene .guide_picture {
 display:none;
}
#activity.fire_scene .guide {
 gap:8px;
}
#activity.fire_scene #game_feedback {
 min-height:0;
 font-size:13px;
}
#activity.fire_scene .board_view_controls {
 grid-area:auto;
 grid-column:1/-1;
 grid-row:1;
 display:flex;
 flex-wrap:wrap;
 gap:4px;
}
#activity.fire_scene #game_controls {
 grid-area:controls;
 grid-template-columns:1fr;
 gap:8px;
}
#activity.fire_scene .fire_priority {
 grid-column:auto;
 min-height:55px;
 padding:10px 14px;
 font-size:18px;
 border-bottom:1px solid var(--line);
}
#activity.fire_scene .fire_weather {
 text-align:left;
 justify-content:flex-start;
 min-height:48px;
 font-size:14px;
}
#activity.fire_scene .game_caption {
 grid-area:meta;
 margin-top:auto;
}
#activity.fire_scene .game_grown_up {
 grid-area:grownup;
 align-self:flex-end;
}
@media (orientation:portrait) {
 #activity.fire_scene .game_play_area {
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:minmax(0,1fr) max-content;
  grid-template-areas:'board' 'panel';
 }
 #activity.fire_scene .game_panel {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  grid-template-rows:repeat(7,max-content);
  grid-template-areas:'identity identity' 'prompt prompt' 'instruction instruction' 'guide guide' 'camera camera' 'controls controls' 'meta grownup';
  height:auto;
  gap:4px;
  padding:10px 12px max(18px,env(safe-area-inset-bottom));
  border-left:0;
  border-top:1px solid var(--line);
  overflow:visible;
 }
 #activity.fire_scene #game_title {grid-area:identity;font-size:12px;}
 #activity.fire_scene #game_prompt {grid-area:prompt;font-size:19px;margin:0;}
 #activity.fire_scene .game_instruction {grid-area:instruction;font-size:15px;}
 #activity.fire_scene .guide {grid-area:guide;}
 #activity.fire_scene .board_view_controls {flex-wrap:nowrap;}
 #activity.fire_scene #game_controls {grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;}
 #activity.fire_scene .fire_priority {min-height:36px;font-size:13px;padding:5px;}
 #activity.fire_scene .fire_weather {grid-column:1/-1;min-height:24px;font-size:12px;}
 #activity.fire_scene .game_caption {margin:0;align-self:center;}
 body:has(#activity.fire_scene.active) .save_bar {bottom:1px;font-size:9px;}
}
@media (max-height:520px) and (orientation:landscape) {
 #activity.fire_scene .game_play_area {grid-template-columns:minmax(0,1fr) 260px;}
 #activity.fire_scene .game_panel {gap:5px;padding:10px;}
 #activity.fire_scene #game_title {font-size:12px;}
 #activity.fire_scene #game_prompt {font-size:21px;margin:0;}
 #activity.fire_scene .game_instruction {font-size:14px;}
 #activity.fire_scene #game_controls {grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;}
 #activity.fire_scene .fire_priority {min-height:34px;font-size:12px;padding:4px;}
 #activity.fire_scene .fire_weather {min-height:26px;font-size:11px;}
 #activity.fire_scene .board_view_controls button {min-height:34px;font-size:11px;}
}
