/* Phone presentation shares the existing window instances and saved geometry. */
.phone-workspace-nav,.phone-window-more,.phone-window-switcher { display:none; }
.phone-workspace-picker { position:fixed;margin:0;top:var(--phone-dialog-top,12px);left:var(--phone-dialog-left,12px);box-sizing:border-box;width:var(--phone-dialog-width,min(520px,calc(100% - 24px)));max-width:none;max-height:var(--phone-dialog-height,80dvh);padding:0;border:1px solid var(--border-color,#59636f);border-radius:16px;background:var(--surface-2,#070b12);color:var(--text-main);box-shadow:0 20px 70px #0008; }
.phone-workspace-picker::backdrop { background:#0009; }
.phone-workspace-picker > header { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-bottom:1px solid var(--border-color,#59636f); }
.phone-workspace-picker h2 { font:700 max(18px,1.125rem)/1.3 Inter,sans-serif;margin:0;overflow-wrap:anywhere; }
.phone-workspace-picker h3 { font:700 max(14px,.875rem)/1.4 Inter,sans-serif;margin:16px 4px 8px;color:var(--text-muted); }
.phone-picker-body { padding:8px 12px 16px;overflow:auto;min-height:0;overscroll-behavior:contain; }
.phone-workspace-picker[open] { display:flex;flex-direction:column; }
.phone-workspace-picker button,.phone-workspace-nav button,.phone-window-more,.phone-window-switcher button { min-width:44px;min-height:44px;padding:10px 12px;border:1px solid var(--border-color,#59636f);border-radius:10px;color:var(--text-main);background:var(--surface-raise,#1b2938);font:600 max(14px,.875rem)/1.3 Inter,sans-serif;cursor:pointer;touch-action:manipulation; }
.phone-workspace-picker button:disabled { opacity:.55;cursor:default; }
.phone-workspace-picker button:focus-visible,.phone-workspace-nav button:focus-visible,.phone-window-more:focus-visible,.phone-window-switcher button:focus-visible { outline:3px solid var(--accent-cyan);outline-offset:2px; }
.phone-picker-choice { display:flex;flex-direction:column;align-items:flex-start;gap:5px;width:100%;margin:6px 0;text-align:left; }
.phone-picker-choice strong { font-size:max(15px,.9375rem);overflow-wrap:anywhere; }
.phone-picker-choice span { color:var(--text-muted);font-weight:400;font-size:max(13px,.8125rem);line-height:1.5; }
.phone-picker-choice[aria-current="true"] { border-color:var(--accent-cyan); }
body.phone-device .phone-workspace-nav:not([hidden]) { display:flex;position:fixed;top:var(--phone-nav-top);left:var(--phone-nav-left,0px);right:var(--phone-nav-right,0px);min-height:calc(56px + var(--phone-safe-bottom,0px));height:auto;box-sizing:border-box;gap:6px;padding:5px calc(8px + var(--sar,0px)) calc(5px + var(--phone-safe-bottom,0px)) calc(8px + var(--sal,0px));background:var(--surface-2,#070b12);border-top:1px solid var(--border-color,#59636f);z-index:22010; }
.phone-workspace-nav button { flex:1;min-width:0;white-space:nowrap;padding:8px 0;display:flex;align-items:center;justify-content:center;gap:4px; }
body.phone-workspace #desktop-canvas > .win-module { display:none !important; }
body.phone-workspace #desktop-canvas > .win-module.phone-window-active:not(.minimized):not(.layer-hidden) { display:flex !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:var(--phone-content-height,100%) !important;min-width:0 !important;min-height:0 !important;max-width:none !important;max-height:none !important;transform:none !important;border-radius:0 !important;overflow:hidden !important;box-shadow:none !important; }
body.phone-workspace #desktop-canvas > .win-module.phone-window-active > .win-header { flex:0 0 auto;min-height:48px;box-sizing:border-box;gap:4px;padding:2px 8px;border-radius:0 !important;cursor:default;touch-action:pan-y; }
body.phone-workspace .win-header > .win-title { display:block;flex:1;min-width:0;font-size:max(15px,.9375rem);white-space:normal;overflow-wrap:anywhere; }
body.phone-workspace .win-header > .win-controls,body.phone-workspace .resize-handle { display:none !important; }
body.phone-workspace .phone-window-more { display:block;flex:0 0 auto; }
body.phone-workspace #desktop-canvas > .win-module.phone-window-active > .win-body { min-height:0;flex:1 1 auto;max-height:none;overflow:auto;padding:var(--phone-module-padding,8px) !important;border-radius:0 !important; }
body.phone-workspace #desktop-canvas > .win-module.phone-window-active.collapsed { height:auto !important; }
body.phone-workspace #desktop-canvas > .win-module.phone-window-active.collapsed > .win-body { display:none !important; }
body.phone-workspace #desktop-canvas .spatial-ui,body.phone-workspace .workspace-layer-bundles { display:none !important; }
body.phone-workspace #desktop-empty-hint { bottom:56px !important; }

/* The ticker and attached search remain on the header; secondary controls use
   their original Tools container so events, clock timers and focus survive. */
body.phone-device.compact-workspace-chrome #chrome-panel-header { --compact-row-size:44px;--compact-control-size:44px; }
body.phone-device.compact-workspace-chrome #workspace-tools-toggle { min-width:52px;min-height:44px;height:44px;font-size:max(14px,.875rem); }
body.phone-device.compact-workspace-chrome #chrome-panel-header > .compact-header-row { padding:4px 8px 8px; }
body.phone-device.compact-workspace-chrome .compact-header-row .compact-search-home { width:100%; }
body.phone-device.compact-workspace-chrome .compact-header-row #scan-omnibox { max-width:none!important;height:44px!important;min-height:44px;font-size:max(16px,1rem)!important;padding:10px 12px!important; }
body.phone-device.compact-workspace-chrome .compact-header-row .omnibox-wrap button:not(.search-placement-controls button) { min-height:44px!important;min-width:44px!important;height:44px!important;font-size:max(14px,.875rem)!important; }
body.phone-device #workspace-tools-panel { font-size:max(14px,.875rem); }
body.phone-device #workspace-tools-panel .top-actions { display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr)); }
body.phone-device #workspace-tools-panel .top-actions > .top-action { min-width:44px!important;min-height:44px!important;font-size:max(14px,.875rem)!important;justify-content:flex-start; }
body.phone-device #workspace-tools-panel .top-action span { display:inline!important; }
body.phone-device #workspace-tools-panel .compact-clocks { display:flex;flex-direction:column;gap:10px; }
body.phone-device #workspace-tools-panel .compact-clocks > div { font-size:max(14px,.875rem)!important;min-height:44px;display:flex;align-items:center;gap:12px; }
body.phone-device #workspace-tools-panel .compact-clocks span { font-size:inherit!important; }
body.phone-device #workspace-tools-panel #wc-market { display:flex;gap:6px;align-items:center; }
body.phone-device #workspace-tools-panel #wc-market .wc-name { display:inline;font-size:inherit; }
body.phone-device #workspace-tools-panel #scan-guest-banner { position:static!important;transform:none!important;max-width:100%!important;margin:0;border-radius:12px!important;flex-wrap:wrap; }
body.phone-device #workspace-tools-panel #scan-guest-banner button { min-width:44px;min-height:44px;font-size:max(14px,.875rem); }
body.phone-device > #scan-music-player { display:none!important; }
body.phone-device .phone-workspace-picker #scan-music-player { display:block!important;position:relative!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;transform:none!important;max-width:100%!important;width:100%!important; }
body.phone-device .phone-workspace-picker #scan-music-player .mp-orb { width:100%;max-width:100%!important; }
body.phone-device .phone-workspace-picker #scan-music-player .mp-browser { position:relative!important;top:auto!important;bottom:auto!important;left:auto!important;right:auto!important;max-width:100%!important;width:100%!important;max-height:none!important; }
body.phone-device .phone-workspace-picker #scan-music-player :is(button,input) { min-height:44px; }

.phone-workspace-picker[data-phone-picker="music"] { z-index:22011; }
body.phone-device #scan-yt-panel { z-index:22012!important; }

body.phone-device:not(.phone-workspace):not(.viewport-segmented).spatial-workspace #desktop-canvas > .win-module.maximized { top:0!important;height:var(--phone-content-height,100%)!important;min-height:0!important; }

.phone-workspace-nav .phone-open-count { font-size:max(11px,.625rem);font-weight:500; }

.phone-workspace-nav button:first-child { flex:1.15; }

/* Safe areas protect controls, not the painted page: landscape modules and the
   bottom navigation surface reach the physical edges without losing content. */
body.phone-workspace.spatial-workspace { padding-left:0!important;padding-right:0!important; }
body.phone-workspace.compact-workspace-chrome #chrome-panel-header { padding-left:calc(4px + var(--sal,0px));padding-right:calc(4px + var(--sar,0px)); }
body.phone-workspace #desktop-canvas > .win-module.phone-window-active > .win-header { padding-left:calc(8px + var(--sal,0px));padding-right:calc(8px + var(--sar,0px)); }
body.phone-workspace #desktop-canvas > .win-module.phone-window-active > .win-body { padding-left:calc(var(--phone-module-padding,8px) + var(--sal,0px))!important;padding-right:calc(var(--phone-module-padding,8px) + var(--sar,0px))!important; }

/* The phone sheet gives the original player controls room without moving audio. */
body.phone-device .phone-workspace-picker #scan-music-player .mp-orb { display:grid;grid-template-columns:54px minmax(0,1fr) 44px;gap:8px;padding:8px;border-radius:12px; }
body.phone-device .phone-workspace-picker #scan-music-player .mp-orb-main { grid-column:1;grid-row:1; }
body.phone-device .phone-workspace-picker #scan-music-player .mp-tuck { grid-column:3;grid-row:1;align-self:start; }
body.phone-device .phone-workspace-picker #scan-music-player .mp-panel { grid-column:1/-1;grid-row:2;padding:0;white-space:normal; }
body.phone-device .phone-workspace-picker #scan-music-player .mp-row { flex-wrap:wrap; }
body.phone-device .phone-workspace-picker #scan-music-player .mp-title { max-width:none;white-space:normal;font-size:max(14px,.875rem); }
body.phone-device .phone-workspace-picker #scan-music-player .mp-hint { max-width:none;white-space:normal;font-size:max(13px,.8125rem);color:var(--text-muted); }

body.phone-device .edge-rail-tab { min-width:44px!important;min-height:44px!important; }
body.phone-device .phone-workspace-picker #scan-music-player .mp-orb-sym { color:var(--text-main);text-shadow:none; }
body.phone-workspace .scan-dock-plane { display:none; }
body.phone-workspace .workspace-layer-controls:has(#workspace-layer-panel[hidden]) { visibility:hidden;pointer-events:none; }
body.phone-device.compact-workspace-chrome #chrome-panel-header > .top-os-bar { border-bottom:0; }

/* Optional focused navigation stays within the existing title row. */
.phone-window-position { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap; }
body.phone-workspace .phone-window-switcher:has(button:not(:disabled)) { display:flex;flex:0 0 auto;gap:2px; }
body.phone-workspace .phone-window-switcher button { padding:2px;font-size:24px;line-height:1; }
body.phone-workspace .phone-window-switcher button:disabled { opacity:.5;cursor:default; }
body.phone-workspace .win-header:has(.phone-window-switcher button:not(:disabled)) > .win-title::after { content:attr(data-phone-position);display:block;font:500 max(11px,.6875rem)/1.2 Inter,sans-serif;color:var(--text-muted); }

/* Floating is the main phone workspace; actions use the same accessible menu. */
body.phone-device .win-module > .win-header { min-height:48px;box-sizing:border-box;gap:4px;padding:2px 8px; }
body.phone-device .win-module > .win-header > .win-title { flex:1;min-width:0;font-size:max(14px,.875rem); }
body.phone-device .win-header > .win-controls { display:none!important; }
body.phone-device .phone-window-more { display:block;flex:0 0 auto; }

/* Overlapping phone windows must not mix their contents through desktop glass. */
body.phone-device #desktop-canvas .win-module,
body.phone-device #desktop-canvas .win-module > .win-body { background-color:var(--surface-2,#070b12); }

/* Phone chrome follows the selected theme; opaque backing protects live labels. */
body.phone-device #chrome-panel-header > .top-os-bar,
body.phone-device #chrome-panel-header > .compact-header-row,
body.phone-device #chrome-panel-ticker,
body.phone-device #scan-omnibox { background-color:var(--surface-2,#070b12); }
body.phone-device #chrome-panel-header :is(#workspace-tools-toggle,#scan-mech-toggle,#scan-copy-link),
body.phone-device #scan-omnibox { color:var(--text-main); }
body.phone-device #chrome-panel-ticker .marquee-item > span { color:var(--text-main)!important; }

/* Placeholder is visible help text, including Safari's separate opacity. */
body.phone-device #scan-omnibox::placeholder { color:var(--text-muted);opacity:1; }
/* Floating headers keep the north resize grip clear of the real More button. */
body.phone-device:not(.phone-workspace) .win-module > .win-header { height:auto;min-height:54px;padding-top:5px;padding-bottom:5px; }
