/* Compact phone controls and inline decisions, shared by the art and sheet layout. */
@media (max-width:700px), (pointer:coarse) and (max-height:500px) {
 body.phone-layout {--phone-bg:var(--canvas);--phone-panel:var(--surface);--phone-line:var(--border-subtle);--phone-muted:var(--fg-muted);background:var(--canvas);color:var(--fg);}
 body.phone-layout #simulation {height:100dvh;min-height:0;overflow:hidden;}
 .phone-game.sidebar-phone {display:flex;flex-direction:column;width:100%;height:100%;max-height:100dvh;overflow:hidden;}
 .sidebar-phone .phone-header {height:50px;min-height:50px;padding:0 16px;gap:8px;border:0;}
 .sidebar-phone .phone-brand {font-size:var(--text-meta);gap:6px;min-width:0;padding:0;min-height:44px;}
 .sidebar-phone .phone-brand img {width:18px;height:18px;}
 .sidebar-phone .phone-turn {font-size:var(--text-meta);}
 .sidebar-phone>.phone-resources {position:relative;display:grid;grid-template-columns:1.2fr 1fr .7fr;padding:5px 16px 13px;gap:14px;border-bottom:1px solid var(--border-subtle);}
 .phone-stat {min-width:0;}
 .phone-stat summary {display:grid;grid-template-columns:22px 1fr;grid-template-rows:auto auto;column-gap:5px;align-items:center;list-style:none;cursor:pointer;min-height:48px;}
 .phone-stat summary .resource-icon {width:21px;height:21px;grid-row:1;}
 .sidebar-phone .phone-stat strong {font-size:22px;line-height:1.3;font-weight:600;}
 .sidebar-phone .phone-stat small {grid-column:2;white-space:normal;font-size:var(--text-meta);color:var(--fg-muted);}
 .stat-explanation {position:absolute;z-index:30;left:12px;right:12px;top:100%;background:var(--surface-raised);border:1px solid var(--border-strong);border-radius:10px;padding:14px;font-size:var(--text-meta);line-height:1.5;box-shadow:0 12px 30px #0009;}
 .sidebar-phone .phone-workspace {display:block!important;position:relative;flex:1;min-height:0;overflow:hidden;grid-template-columns:none!important;}
 .sidebar-phone .phone-workspace #board {display:block!important;position:relative!important;inset:auto!important;width:100%;height:100%;min-height:0;padding:18px 16px 24px!important;margin:0;overflow:auto!important;overscroll-behavior:contain;mask-image:none;scroll-padding:14px;}
 .sidebar-phone .section-heading h1,.sidebar-phone .decision-heading h1 {font-size:23px;}
 .sidebar-phone .section-heading {margin:0 0 14px;}
 .sidebar-phone .section-heading .text-link {font-size:var(--text-meta);min-height:36px;padding:4px 0;text-align:right;}
 .sidebar-phone .opposition-strip {display:flex;flex-direction:column;gap:10px;position:static;width:100%;}
 .sidebar-phone .op-card {position:static!important;display:block;margin:0;padding:13px;border:1px solid var(--border-subtle);border-radius:11px;background:var(--surface);box-shadow:none;}
 .sidebar-phone .op-head {font-size:var(--text-meta);margin:0 0 9px;gap:10px;}
 .sidebar-phone .op-label {font-size:var(--text-meta);min-width:0;}
 .sidebar-phone .op-value {font-size:var(--text-meta);white-space:nowrap;}
 .sidebar-phone .human-relationship {padding:9px 0;margin:0;border-top:1px solid var(--border-subtle);}
 .sidebar-phone .human-relationship:last-child {padding-bottom:0;}
 .sidebar-phone .human-relationship-head {font-size:var(--text-meta);}
 .sidebar-phone .human-relationship[data-human-faction="0"] .human-relationship-head>span {color:var(--accent);}
 .sidebar-phone .human-relationship[data-human-faction="1"] .human-relationship-head>span {color:var(--busy-fg);}
 .sidebar-phone .human-response,.sidebar-phone .op-sub,.sidebar-phone .human-safeguards {font-size:var(--text-meta);line-height:1.5;margin:4px 0 0;color:var(--fg-muted);}
 .sidebar-phone .op-bar {font-size:var(--text-meta);}
 .sidebar-phone .op-race {margin:17px 0 0;}
 .sidebar-phone .rival-beat {font-size:var(--text-meta);line-height:1.5;margin:9px 0 0;}
 .sidebar-phone .next-work-card {display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;text-align:left;padding:13px;margin:12px 0;border-radius:11px;background:var(--accent-soft);border:1px solid var(--accent-border);color:var(--fg);}
 .next-work-card>span:first-child {display:flex;flex-direction:column;gap:5px;min-width:0;}
 .next-work-card small {font-size:var(--text-meta);letter-spacing:.08em;color:var(--fg-muted);}
 .next-work-card strong {font-size:var(--text-meta);}
 .next-work-card>span:last-child {font-size:var(--text-meta);color:var(--accent);white-space:nowrap;}
 .sidebar-phone .phone-controls {padding:9px 16px;margin:0;min-height:68px;background:var(--canvas);}
 .sidebar-phone .phone-controls .phone-research-status {flex:1;background:none;border:0;min-height:44px;}
 .sidebar-phone .phone-control-label {font-size:var(--text-meta);color:var(--fg-muted);}
 .sidebar-phone .phone-run {background:var(--accent);border-radius:9px;color:var(--accent-on);min-width:94px;}
 .sidebar-phone .phone-views {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:0 10px max(4px,env(safe-area-inset-bottom));gap:0;min-height:49px;border-top:1px solid var(--border-subtle);border-bottom:0;}
 .sidebar-phone .phone-views button,.sidebar-phone .phone-views button:first-child,.sidebar-phone .phone-views button:last-child {margin:0;text-align:center;font-size:var(--text-meta);min-height:44px;padding:10px 2px;flex:auto;}
 .sidebar-phone .phone-views button[aria-pressed=true] {color:var(--accent);background:none;border-bottom:0;box-shadow:inset 0 2px var(--accent);}
 .sidebar-phone .decision-heading {margin-bottom:16px;}
 .sidebar-phone .decision-heading p {font-size:var(--text-meta);line-height:1.5;}
 .sidebar-phone .decision-row>summary {padding:12px;gap:11px;min-height:74px;}
 .sidebar-phone .decision-label strong {font-size:var(--text-meta);}
 .sidebar-phone .decision-label small {font-size:var(--text-meta);}
 .sidebar-phone .decision-body {padding:0 12px 13px;}
 .sidebar-phone .decision-body p {font-size:var(--text-meta);}
 .sidebar-phone .decision-action {flex-wrap:wrap;}
 .sidebar-phone .decision-action>button {font-size:var(--text-meta);}
 .sidebar-phone .decision-art {width:38px;height:38px;flex-basis:38px;}
 .sidebar-phone .ending-art {width:55px;flex-basis:55px;}
 .sidebar-phone .city-bottom-stats {position:static!important;inset:auto!important;display:block!important;width:100%;padding:13px!important;margin:0 0 16px!important;border:1px solid var(--border-subtle);border-radius:11px;background:var(--surface);}
 .sidebar-phone .city-resource-strip {display:flex;justify-content:space-between;gap:16px;margin-bottom:12px;}
 .sidebar-phone .city-resource-strip .resource-stat {font-size:var(--text-meta);}
 .sidebar-phone .city-share-row {font-size:var(--text-meta);}
 .sidebar-phone .city-capacity-note {font-size:var(--text-meta);line-height:1.5;margin:8px 0 0;}
 .sidebar-phone .resource-tooltip {max-width:calc(100vw - 50px);}
 .sidebar-phone .city-done {font-size:var(--text-meta);margin-top:12px;}
 .sidebar-phone .city-slots {margin-bottom:16px!important;}
 .sidebar-phone .inline-work {margin-top:18px;}
 .sidebar-phone .city-list {display:flex;flex-direction:column;gap:8px;}
 .sidebar-phone .city-list-row {display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:14px;border-radius:11px;border:1px solid var(--border-subtle);background:var(--surface);color:var(--fg);text-align:left;}
 .city-list-row>span:first-child {display:flex;flex-direction:column;gap:5px;min-width:0;}
 .city-list-row strong {font-size:var(--text-meta);}
 .city-list-row small {font-size:var(--text-meta);color:var(--fg-muted);}
 .city-list-facts {display:flex;flex-direction:column;gap:4px;align-items:flex-end;flex:none;font-size:var(--text-meta);}
 .sidebar-phone .notification-zone {display:block;position:static;max-height:none;overflow:visible;margin-top:12px;}
 .sidebar-phone .notification-card {width:100%;max-width:100%;padding:13px;border-radius:11px;font-size:var(--text-meta);overflow-wrap:anywhere;}
 .sidebar-phone .notification-card :is(h3,strong) {font-size:var(--text-meta);white-space:normal;}
 .sidebar-phone .notification-card p {font-size:var(--text-meta);line-height:1.5;}
 .sidebar-phone .phone-checklist {padding:0;}
 .sidebar-phone .phone-checklist li {font-size:var(--text-meta);padding:9px 0;}
 .running-list {margin-top:24px;}
 .running-list .phone-running-row {padding:12px 0;font-size:var(--text-meta);}
 .running-list .phone-running-row small {font-size:var(--text-meta);}
 body.phone-layout #sim-dialog,body.phone-layout #sim-dialog.phone-full-sheet {background:var(--surface);color:var(--fg);border-color:var(--border-strong);padding:22px 18px;height:auto;max-height:calc(100dvh - 20px);margin:auto 10px;width:calc(100% - 20px);overflow:auto;}
 .phone-layout #sim-dialog .dialog-navigation {position:absolute;top:8px;right:8px;width:44px;height:44px;min-height:0;margin:0;padding:0;}
 .phone-layout #sim-dialog .dialog-navigation .nav-close {margin:0;padding:10px;transform:none;width:44px;height:44px;}
 .phone-layout #sim-dialog .phone-sheet>header {padding-right:44px;}
 .phone-layout #sim-dialog .phone-sheet {height:auto;max-height:none;gap:16px;}
 .phone-layout #sim-dialog .phone-sheet-body {overflow:visible;flex:0 1 auto;}
 .phone-layout #sim-dialog h2 {font-size:23px;line-height:1.25;}
 .phone-layout #sim-dialog .phone-sheet-footer {margin:8px 0 0;}
 .phone-layout #sim-dialog .response-options {display:grid;grid-template-columns:1fr;gap:12px;}
 .phone-layout #sim-dialog .response-options>button {padding:14px;text-align:left;}
 .phone-layout #sim-dialog .response-options strong {display:block;font-size:var(--text-body);}
 .phone-layout #sim-dialog .phone-choice {padding:14px 0;}
 .phone-layout #sim-dialog .phone-primary {background:var(--accent);color:var(--accent-on);}
 .phone-layout #sim-dialog .sound-settings label {font-size:var(--text-meta);}
 .phone-layout .cinema-audio .audio-controls input {display:none;}
 .phone-layout #cinema .nav-close {transform:none;margin:0;}
}
@media(max-width:350px) {
 .sidebar-phone .phone-brand {font-size:var(--text-meta);}
 .sidebar-phone .phone-header {padding:0 12px;gap:5px;}
 .sidebar-phone .phone-workspace #board {padding:14px 12px 20px!important;}
 .sidebar-phone .op-value {font-size:var(--text-meta);}
 .sidebar-phone .next-work-card {align-items:flex-start;}
 .next-work-card>span:last-child {font-size:var(--text-meta);}
}
@media(max-width:700px),(pointer:coarse) and (max-height:500px) {
 .sidebar-phone .phone-stat strong {grid-column:2;grid-row:1;}
 .sidebar-phone .phone-stat summary::after {content:none!important;}
 .sidebar-phone .phone-stat summary {color:var(--fg);}
 .sidebar-phone .phone-stat small {grid-row:2;}
 .sidebar-phone button,.sidebar-phone summary { -webkit-tap-highlight-color:transparent; }
 .sidebar-phone .running-list .phone-running-row {display:flex;align-items:center;gap:12px;}
 .sidebar-phone .running-list .phone-running-row>.work-art {position:static;inset:auto;width:32px;height:36px;flex:none;}
 .sidebar-phone .running-list .phone-running-row>span {display:flex;flex-direction:column;gap:4px;}
}
@media(max-width:700px),(pointer:coarse) and (max-height:500px) {
 body.phone-layout #sim-dialog,body.phone-layout #sim-dialog.phone-full-sheet {height:fit-content;overflow:hidden;}
 .phone-layout #sim-dialog .phone-sheet {display:flex;max-height:calc(100dvh - 68px);}
 .phone-layout #sim-dialog .phone-sheet-body {min-height:0;overflow:auto;flex:1 1 auto;}
}
@media(max-width:700px),(pointer:coarse) and (max-height:500px) {
 .sidebar-phone .notification-stream {display:flex;flex-direction:column;gap:10px;margin-top:12px;max-height:none;overflow:visible;}
 .sidebar-phone .notification-stream .notification-card {padding:13px;background:var(--surface);border:1px solid var(--border-subtle);}
 .sidebar-phone .notification-action[data-city-work] {width:100%;min-height:44px;margin-top:10px;border:0;border-radius:8px;background:var(--accent);color:var(--accent-on);font-size:var(--text-meta);}
 .sidebar-phone .notification-project .nowrap {white-space:normal;}
 .sidebar-phone .notification-card-head {min-width:0;}
 .sidebar-phone .notification-headline {overflow-wrap:anywhere;}
 .sidebar-phone .decision-art .tech-glyph {color:var(--accent-strong);}
 .sidebar-phone .decision-art .tech-glyph :is(path,polygon,ellipse,circle) {stroke-width:2;}
 .sidebar-phone .agreement-choice {width:100%;white-space:normal;padding:12px;text-align:left;}
}
@media(max-width:700px),(pointer:coarse) and (max-height:500px) {
 /* Touch browsers can retain :hover after a tap or rerender. Explanations
    open deliberately and take their own space instead of covering choices. */
 .sidebar-phone [data-resource-help] .resource-tooltip {display:none!important;pointer-events:none;}
 .sidebar-phone [data-resource-help].help-pinned>.resource-tooltip {display:block!important;position:static!important;inset:auto!important;transform:none!important;opacity:1;visibility:visible;width:100%;min-width:0;max-width:100%;margin:10px 0 0;padding:10px 0 0;box-shadow:none;border:0;border-top:1px solid var(--border-subtle);background:none;white-space:normal;}
 .sidebar-phone .city-resource-strip {flex-wrap:wrap;align-items:flex-start;}
 .sidebar-phone .city-resource-strip .help-pinned {flex:0 0 100%;display:block;}
 .sidebar-phone .city-share-row.help-pinned {flex-wrap:wrap;}
 .sidebar-phone .city-share-row.help-pinned>.resource-tooltip {flex-basis:100%;}
}
