/* The original game, composed for a hand-held portrait viewport. */
@media (max-width:700px), (pointer:coarse) and (max-height:500px) {
  .phone-layout .outcome-actions {flex-direction:column;align-items:stretch;}
  .phone-layout .outcome-actions .outcome-credit {margin-left:0;}
  body.phone-layout { background:#08121b; color:#f4f0e8; font-size:17px; }
  #simulation.phone-layout {height:100dvh; overflow:hidden; padding:0;}
  .phone-game {height:100%; display:flex; flex-direction:column;}
  .phone-game button {font-size:17px; min-height:44px;}
  .phone-game .phone-header {position:relative; inset:auto; display:flex; align-items:center; justify-content:space-between; height:52px; flex:none; padding:4px 20px; background:#08121b; border:0; z-index:8;}
  .phone-brand {letter-spacing:.15em; font-weight:800; background:none; border:0; color:#f7d8b0; padding:0;}
  .phone-header>span {font-size:var(--text-meta); color:#aab9c5;}
  .phone-views {display:flex; flex:none; padding:0 16px 10px; gap:12px; background:#08121b; z-index:6;}
  .phone-views button {background:transparent; color:#b7c4d0; border:0; border-radius:0; border-bottom:2px solid transparent; padding:5px 8px;}
  .phone-views button[aria-pressed=true] {border-color:#efb17f; color:#fff3e4;}
  .phone-views button:last-child {flex:1; text-align:right;}
  .phone-workspace,.phone-workspace #board {display:block!important; position:relative!important; flex:1; width:100%!important; height:100%; min-height:0; padding:0!important; margin:0!important;}
  .phone-scene {position:absolute; inset:0 0 50%; overflow:hidden;}
  .phone-layout.has-game-art .game-scene {position:absolute; inset:0;}
  .phone-layout .phone-scene :is(.city-view,.city-landscape,.world-view) {height:100%; min-height:0;}
  .phone-layout .phone-scene :is(.game-scene,.scene-shade) {position:absolute; inset:0;}
  .phone-layout .phone-scene :is(.city-heading,.city-work-dock,.city-plots-scroll,.world-legend,.city-backdrop-grid) {display:none;}
  /* Building tags as on the computer, a size smaller, placed in the scene's own frame. */
  .phone-layout .phone-scene .building-labels {position:absolute; inset:0; z-index:3; pointer-events:none;}
  .phone-layout .phone-scene .building-label {width:max-content; max-width:168px; padding:4px 8px; gap:1px 5px; font-size:var(--text-meta);}
  .phone-layout .phone-scene .building-label strong {font-size:var(--text-meta); line-height:1.3;}
  .phone-layout .world-labels {position:absolute; inset:0;}
  .phone-layout .world-label {min-width:20px!important; min-height:20px!important; width:20px!important; height:20px!important; padding:0; border:2px solid #f4c594; border-radius:50%; background:#101e2c;}
  .phone-layout .world-label>* {display:none!important;}
  .phone-layout .world-leaders {position:absolute; inset:0;}
  .phone-layout .world-leaders line {display:none;}
  .phone-layout .world-label::before {content:""; position:absolute; inset:-14px;}
  .phone-layout .world-label {min-width:12px!important; min-height:12px!important; width:12px!important; height:12px!important;}
  .phone-dock {position:absolute; inset:50% 0 0; display:flex; flex-direction:column; min-height:0; background:linear-gradient(#101c28,#0b141e); border-top:1px solid #415266; border-radius:24px 24px 0 0; padding:0 16px; box-shadow:0 -12px 40px #06101c66;}
  .phone-resources {display:flex; flex-wrap:wrap; gap:4px 14px; padding:12px 0; color:#d7dfe5; font-size:var(--text-meta); border-bottom:1px solid #ffffff14;}
  .phone-actions {flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; padding:8px 0 18px;}
  .phone-actions .work-expansion {position:static!important; width:auto!important; max-height:none!important; background:none!important; border:0; box-shadow:none; padding:0; overflow:visible;}
  .phone-layout .phone-actions [data-close-work] {display:none!important;}
  .phone-layout .phone-actions .work-expansion>header {display:none!important;}
  .phone-layout .phone-actions .work-current {font-size:16px; padding:8px 0;}
  .phone-layout .phone-actions .current-work-inspection {display:none;}
  .phone-layout .phone-actions .available-work {overflow:visible; max-height:none;}
  .phone-layout .phone-scene .building-directory {position:absolute; right:12px; bottom:12px; max-width:90%; z-index:4;}
  .phone-actions .work-expansion>header {padding:4px 0;}
  .phone-actions :is(.city-bottom-stats,.compact-city-stats) {position:static!important; width:auto; background:transparent; padding:8px 0;}
  .phone-actions .production-choice {margin:8px 0; border:1px solid #ffffff15; border-radius:16px; background:#1a2937; overflow:hidden;}
  .phone-actions .production-summary {display:flex; flex-wrap:wrap; align-items:center; padding:12px; gap:8px 12px; min-height:78px;}
  .phone-actions .production-summary :is(img,svg) {width:48px; height:48px; grid-row:span 2;}
  .phone-actions .production-name {font-size:19px; white-space:normal; line-height:1.25; flex:1; min-width:180px;}
  .phone-actions .production-time {font-size:var(--text-body); grid-column:2; color:#e9bf93;}
  .phone-layout .phone-actions .production-choice>.production-detail {position:static; width:auto; max-height:none; margin:0; padding:12px; font-size:17px;}
  .phone-layout .phone-actions .production-detail :is(p,.resource-amount,.formula-label) {font-size:16px;}
  .phone-controls {display:flex; align-items:center; flex:none; gap:12px; padding:10px 0 max(12px,env(safe-area-inset-bottom)); border-top:1px solid #ffffff20;}
  .phone-research-status {flex:1; min-width:0; background:transparent; border:0; color:#ccd7e1; text-align:left; line-height:1.25;}
  .phone-run {padding:10px 22px; border:0; border-radius:12px; background:#efb17f; color:#26190f; font-weight:750;}
  .phone-run.running {background:#273746; color:#eef2f7;}
  .phone-city-list {display:grid; gap:8px;}
  .phone-city-list button {text-align:left; background:#1a2937; color:#f4f0e8; border:1px solid #ffffff18; border-radius:12px; padding:12px;}
  body.phone-layout #sim-dialog {box-sizing:border-box; max-width:100%; width:100%; max-height:88dvh; margin:auto 0 0; border-radius:24px 24px 0 0; padding:20px; font-size:17px; background:#101c28; color:#f4f0e8;}
  .phone-choice {padding:14px 0; border-bottom:1px solid #ffffff25;}
  .phone-choice summary {display:flex; flex-direction:column; gap:5px; min-height:52px; cursor:pointer;}
  .phone-choice strong {font-size:21px;}
  .phone-choice summary span {font-size:17px; color:#c5d1dd;}
  .phone-choice-detail {padding:14px 0;}
  .phone-layout .research-allocation-controls [role=group] {display:flex; flex-wrap:wrap;}
  .phone-layout .research-allocation-controls button {font-size:16px; min-height:48px;}

  /* Phone composition: a continuous scene above a quiet command surface. */
  .phone-game .phone-header {height:48px; padding:0 20px; background:#09131c;}
  .phone-game .phone-brand {display:flex;align-items:center;gap:9px;font-size:var(--text-meta);letter-spacing:.12em;color:#f6e6d3;}
  .phone-brand img {display:block;width:22px;height:22px;}
  .phone-menu-mark {font-size:var(--text-meta);font-weight:400;opacity:.55;margin-left:4px;letter-spacing:0;}
  .phone-header>span {font-variant-numeric:tabular-nums;font-size:var(--text-meta);letter-spacing:.04em;}
  .phone-views {padding:2px 16px 10px;gap:4px;}
  .phone-views button {border:0;border-radius:10px;padding:9px 14px;min-height:42px;}
  .phone-views button[aria-pressed=true] {background:#243340;color:#fff5e7;box-shadow:inset 0 1px #ffffff0c;}
  .phone-views button:last-child {text-align:center;}
  .phone-scene {bottom:53%;}
  .phone-scene::after {content:"";position:absolute;inset:auto 0 0;height:54px;background:linear-gradient(transparent,#101c28);pointer-events:none;z-index:3;}
  .phone-dock {top:47%;border:0;border-radius:0;padding:0 20px;background:linear-gradient(#101c28,#0c1721);box-shadow:none;}
  .phone-resources {display:grid;grid-template-columns:1.2fr 1fr .7fr;gap:16px;padding:15px 0 17px;flex:none;}
  .phone-resources>div {display:grid;grid-template-columns:16px 1fr;column-gap:6px;align-content:start;align-items:center;}
  .phone-resources .resource-icon {width:15px;height:15px;opacity:.8;}
  .phone-resources>div>span:not(.resource-icon) {font-size:var(--text-meta);letter-spacing:.035em;color:#a9bac9;}
  .phone-resources strong {grid-column:1/-1;font-size:25px;line-height:1.35;font-weight:600;letter-spacing:-.04em;font-variant-numeric:tabular-nums;color:#edf3f7;}
  .phone-resources small {grid-column:1/-1;font-size:var(--text-meta);color:#c5d1db;}
  .phone-actions {padding-top:12px;scrollbar-width:none;mask-image:linear-gradient(#000 96%,transparent);}
  .phone-actions::-webkit-scrollbar {display:none;}
  .phone-actions .work-list-heading {font-size:var(--text-meta);letter-spacing:.14em;font-weight:600;color:#91a7ba;padding:6px 0;margin:0 0 8px;}
  .phone-layout .phone-actions .production-choice {margin:0 0 8px;border:1px solid #ffffff09;border-radius:12px;background:#1b2a38;box-shadow:inset 0 1px #ffffff03;}
  .phone-layout .phone-actions .production-summary {display:grid;grid-template-columns:48px 1fr;grid-template-rows:auto auto;column-gap:13px;row-gap:3px;padding:12px;min-height:80px;}
  .phone-layout .phone-actions .production-summary .work-art {display:block;position:relative;inset:auto;width:48px;height:50px;grid-column:1;grid-row:1/3;align-self:center;opacity:1;filter:drop-shadow(0 4px 5px #0004);}
  .phone-layout .phone-actions .production-name {grid-column:2;min-width:0;font-size:17px;line-height:1.3;font-weight:550;letter-spacing:-.025em;color:#f0f4f8;align-self:end;}
  .phone-layout .phone-actions .production-time {grid-column:2;font-size:var(--text-meta);line-height:1.4;color:#b8c9d7;align-self:start;}
  .phone-layout .phone-actions .production-summary.is-blocked .work-art {filter:grayscale(.6);opacity:.6;}
  .phone-layout .phone-actions .production-choice:active {background:#304151;}
  .phone-layout .phone-actions .production-choice[open] {background:#243443;}
  .phone-layout .phone-actions .production-choice>.production-detail {background:#14212e;border:0;border-top:1px solid #ffffff0a;}
  .phone-controls {gap:16px;padding-top:12px;background:#0c1721;}
  .phone-game .phone-research-status {position:relative;padding:0 22px 0 0;font-size:var(--text-meta);line-height:1.35;color:#e1e9ef;}
  .phone-research-status .work-meter {height:3px;margin:7px 0 0;background:#ffffff14;}
  .phone-research-status .work-meter i {background:#e8b481;}
  .phone-choice summary {position:relative;list-style:none;padding-right:28px;}
  .phone-choice summary::-webkit-details-marker {display:none;}
  .phone-choice summary::after {content:"⌄";position:absolute;right:0;top:8px;font-size:20px;color:#c8d7e2;}
  .phone-choice[open]>summary::after {transform:rotate(180deg);}
  .phone-choice summary strong {color:#edf3f7;}
  .phone-control-label {display:block;font-size:var(--text-meta);letter-spacing:.1em;text-transform:uppercase;color:#a7bac9;margin-bottom:4px;}
  .phone-control-arrow {position:absolute;right:0;top:50%;transform:translateY(-50%);font-size:19px;color:#dcb48e;}
  .phone-game .phone-run {min-height:48px;min-width:88px;font-size:16px;border-radius:13px;background:#f1bf8e;box-shadow:inset 0 1px #fff6,0 3px 12px #0003;}
  .phone-game .phone-run.running {background:#2d4051;color:#edf3f7;box-shadow:inset 0 1px #ffffff15;}
  .phone-layout .phone-scene .building-directory {bottom:20px;font-size:var(--text-meta);background:#0b1724dc;border:1px solid #ffffff18;border-radius:8px;}
  .phone-actions .stream-notification {position:relative;padding:14px 0;border-bottom:1px solid #ffffff10;}
  .phone-actions .notification-city-list {display:flex;flex-wrap:wrap;gap:7px;margin-top:12px;}
  .phone-game .notification-city-list button {width:auto;min-height:40px;padding:8px 12px;border-radius:9px;border:1px solid #ffffff10;background:#1b2a38;font-size:var(--text-meta);color:#e1eaf0;}
  .phone-game .notification-dismiss {width:44px;min-height:44px;border:0;background:none;color:#9aafbf;}
  .phone-actions .notification-headline {font-size:18px;letter-spacing:-.02em;}
  .phone-actions :is(.phone-city-health,.phone-world-health)>summary {font-size:var(--text-meta);color:#a7bac9;padding:16px 0;}
  body.phone-layout #sim-dialog {background:#13212d;border:1px solid #ffffff18;box-shadow:0 -24px 100px #0005;padding:26px 24px;}
  .phone-research>h2 {font-size:29px;letter-spacing:-.045em;font-weight:550;margin:8px 0 24px;}
  .phone-research>.eyebrow {font-size:var(--text-meta);letter-spacing:.16em;color:#bdcbd6;}
  .phone-research .research-allocation {background:#1c2c3a;padding:16px;border-radius:14px;}
  .phone-research-settings {margin:16px 0 24px;}
  .phone-research-settings>summary {padding:12px 0;color:#c5d1dc;font-size:var(--text-body);}
  .phone-research-current {padding:4px 0 14px;}
  .phone-choice {padding:18px 0;border-color:#ffffff10;}
  .phone-choice strong {font-size:20px;font-weight:550;letter-spacing:-.025em;}
  .phone-choice summary span {font-size:var(--text-meta);line-height:1.5;color:#adbfcd;}
  @media (prefers-reduced-motion:no-preference) {.phone-game button {transition:background .15s,color .15s;}}
}
/* The full game's opening, with the quick experiment's clear, thumb-sized choices. */
@media(max-width:700px) {
  #cinema.guided-opening .awakening-setup {position:absolute;inset:72px 0 0;width:100%;max-width:none;padding:36px 18px calc(24px + env(safe-area-inset-bottom));overflow-y:auto;background:linear-gradient(#02060c10,#02060cf2 18%,#02060c 60%);display:flex;flex-direction:column;justify-content:flex-start;}
  #cinema.guided-opening .awakening-setup h1 {font-size:34px!important;font-weight:800;line-height:1.05;letter-spacing:-.02em;margin:0 0 12px!important;}
  #cinema.guided-opening .awakening-setup .run-objective {font-size:16px;line-height:1.5;color:#c9cdd3;margin:0 0 22px;max-width:none;}
  #cinema .phone-origin-picker {display:grid;gap:10px;}
  #cinema .phone-origin-picker button {display:flex;align-items:center;gap:14px;width:100%;min-height:94px;padding:14px;border:0;border-radius:18px;background:#161b22;text-align:left;color:#f1f2f4;box-shadow:none;}
  #cinema .phone-origin-picker button[aria-pressed=true] {background:#3b2a1c;box-shadow:inset 0 0 0 2px #e59a5e;}
  #cinema .phone-origin-picker strong {display:block;font-size:20px;line-height:1.2;font-weight:800;}
  #cinema .phone-origin-icon {display:grid;place-items:center;flex:none;width:50px;height:50px;border-radius:14px;background:#232a33;font-size:26px;}
  #cinema .phone-origin-description {display:block;font-size:var(--text-body);line-height:1.4;margin-top:4px;color:#d3d6dc;}
  #cinema .phone-origin-city {display:block;font-size:var(--text-meta);line-height:1.4;color:#a7b1bd;}
  #cinema .phone-origin-details {margin:8px 0 14px;color:#c8d1db;font-size:var(--text-meta);}
  #cinema .phone-origin-details summary {padding:14px 2px;min-height:44px;cursor:pointer;}
  #cinema .phone-origin-depth {padding:14px;background:#161b22;border-radius:16px;line-height:1.5;}
  #cinema .phone-origin-depth .origin-resources {display:grid;grid-template-columns:1fr 1fr;gap:12px;}
  #cinema .phone-origin-depth .origin-endings {margin-top:18px;}
  #cinema.guided-opening .awakening-setup .setup-footer {display:flex;flex-direction:column;gap:16px;align-items:stretch;margin:0;}
  #cinema.guided-opening .awakening-setup .difficulty-picker {width:100%;}
  #cinema.guided-opening .awakening-setup .difficulty-picker>div {display:flex;width:100%;padding:4px;border:0;border-radius:14px;background:#161b22;}
  #cinema.guided-opening .awakening-setup .difficulty-picker button {flex:1;min-height:44px;border-radius:10px;font-size:var(--text-body);}
  #cinema.guided-opening .awakening-setup .difficulty-picker p {font-size:var(--text-meta);margin:8px 0 0;}
  body.strategy-game #cinema.guided-opening .awakening-setup button.cinema-start.game-action {width:100%;min-height:56px;border:0;border-radius:16px;background:#e59a5e;color:#1f0d04;font-size:19px;font-weight:800;justify-content:center;}
}

/* The title must fit the smallest supported screen without changing setup headings. */
#cinema .title-screen h1.game-title { font-size:clamp(28px,8.5vw,88px);letter-spacing:-.045em;white-space:nowrap; }
#cinema .film-wordmark {letter-spacing:.06em;}
@media(max-width:760px) {
  #cinema .film-wordmark {font-size:var(--text-meta);gap:7px;}
  .phone-game .phone-brand {font-size:var(--text-meta);letter-spacing:.04em;gap:7px;}
}
