/* Touch refinement uses the same interface tokens as desktop. */
html:root:is([data-app-layout=phone],[data-app-layout=tablet]) {
  --app-drawer-width:min(344px,calc(var(--app-viewport-width,100vw) - 48px));
  --app-accent:var(--ui-link);
  #mapSearch #errorMessage:not(:empty) {margin:12px 16px 8px!important;font:400 13px/1.5 var(--ui-map-font)!important;white-space:normal;}
  #mapSearch #errorMessage.text-primary {color:var(--ui-muted)!important;}
  #mapSearch #loadingProgressContainer {height:4px!important;min-height:4px!important;margin:0 16px 16px!important;border:0!important;border-radius:2px;background:var(--ui-border)!important;overflow:hidden;}
  #mapSearch #loadingProgressBar {font-size:0!important;background:var(--ui-link)!important;animation:none!important;transition:width .2s ease;}
  #mobileAppShell {font-family:var(--ui-map-font);}
  #mobileAppShell .app-bottom-dock {
    position:fixed;z-index:2100;left:50%;bottom:calc(var(--app-safe-bottom,0px) + 12px);transform:translateX(-50%);
    display:flex;gap:4px;width:min(420px,calc(var(--app-viewport-width,100vw) - 24px));padding:6px;
    border:1px solid var(--ui-map-edge);border-radius:32px;background:var(--ui-map-glass);
    box-shadow:0 5px 22px #18212b2b,inset 0 1px 0 #ffffff70;
    backdrop-filter:blur(20px) saturate(115%);-webkit-backdrop-filter:blur(20px) saturate(115%);
  }
  #mobileAppShell .app-bottom-dock .app-primary-bank {
    position:static!important;display:flex!important;flex:1;flex-direction:row!important;gap:3px!important;
    width:auto!important;min-width:0;max-width:none!important;transform:none!important;pointer-events:auto;
  }
  #mobileAppShell .app-primary-bank>button {
    flex:1;order:0!important;width:auto!important;min-width:0!important;height:52px!important;min-height:52px!important;
    border:0!important;border-radius:24px!important;
    background:transparent!important;color:var(--ui-text)!important;text-shadow:none!important;
    box-shadow:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
    transition:background .16s ease,transform .16s ease;
  }
  #mobileAppShell .app-primary-bank>button svg {width:25px;height:25px;stroke-width:1.8;filter:none!important;}
  #mobileAppShell .app-primary-bank>button>span {display:block!important;max-width:100%;overflow:hidden;text-overflow:ellipsis;font:500 10px/12px var(--ui-map-font);white-space:nowrap;}
  #mobileAppShell .app-primary-bank>button:active {transform:scale(.95);}
  #mobileAppShell .app-primary-bank>button[aria-pressed=true] {background:var(--ui-selected)!important;color:var(--ui-link)!important;}
  #mobileAppShell .app-primary-bank>.app-location-control>.app-location-symbol {width:25px;height:25px;}
  #mobileAppShell .app-primary-bank>.app-record-control {color:var(--ui-text)!important;}
  #mobileAppShell .app-primary-bank>.app-record-control>span {font:500 10px/12px var(--ui-map-font);}
  body.app-route-recording-active:not(.app-route-recording-paused) #mobileAppShell .app-primary-bank>.app-record-control {background:#b93832!important;color:white!important;}
  .cursor-status-bar {bottom:calc(var(--app-safe-bottom,0px) + 74px)!important;gap:4px!important;align-items:stretch!important;flex-wrap:nowrap!important;max-width:calc(var(--app-viewport-width,100vw) - 24px)!important;}
  .cursor-status-bar .cursor-crs-picker {flex:0 0 auto;}
  .cursor-status-bar #cursorStatusReadout {flex:0 1 auto!important;min-width:0!important;white-space:nowrap!important;overflow:hidden;text-overflow:ellipsis;}
  .cursor-status-bar #mainScaleBar[hidden] {display:none!important;}
  #mobileAppShell .app-location-status {bottom:calc(var(--app-safe-bottom,0px) + 108px)!important;max-width:calc(100vw - 32px)!important;}
  body:is(.workspace-open,.mobile-search-open,.flight-sim-active,.is-street-view-open,.hud-hidden) #mobileAppShell .app-bottom-dock,
  body[data-app-route]:not([data-app-route=map]) #mobileAppShell .app-bottom-dock {visibility:hidden!important;pointer-events:none;}
  .cursor-status-bar :is(#cursorCrsButton,#cursorStatusReadout,#mainScaleBar) {
    box-sizing:border-box;height:26px!important;min-height:26px!important;line-height:24px!important;
    border:1px solid var(--ui-map-edge)!important;border-radius:7px!important;padding:0 6px!important;
    background:var(--ui-map-glass)!important;color:var(--ui-text)!important;font:400 10px/24px var(--ui-map-font)!important;
  }
  .cursor-status-bar #mainScaleBar {display:flex;align-items:center;flex:0 0 auto!important;gap:0!important;width:auto!important;}
  .cursor-status-bar #mainScaleBar :is(.cursor-scale-prefix,#mapScaleInput) {
    background:transparent!important;border:0!important;border-radius:0!important;padding:0!important;margin:0!important;
    font:inherit!important;line-height:24px!important;height:24px!important;min-height:0!important;box-shadow:none!important;
    color:inherit!important;align-self:center;flex-shrink:0!important;
  }
  .cursor-status-bar #mainScaleBar #mapScaleInput {box-sizing:content-box!important;min-width:4ch!important;max-width:none!important;}
  #mobileAppShell :is(.app-menu-drawer,#appCreate) {background:var(--ui-surface);border-radius:20px 0 0 20px!important;}
  #mobileAppShell .app-menu-drawer>header {min-height:58px;padding:8px 12px;}
  #mobileAppShell .app-menu-drawer>header h2 {font-size:18px;}
  #mobileAppShell .app-menu-content,#appTools .app-tools-content {padding:12px;}
  #mobileAppShell .app-menu-browser {--menu-ink:var(--ui-text);--menu-harbour:var(--ui-link);--menu-paper:var(--ui-selected);--menu-surface:var(--ui-surface);}
  #mobileAppShell .app-menu-quick {gap:8px;padding-bottom:12px;}
  #mobileAppShell .app-menu-quick>button {flex-direction:row;justify-content:center;gap:8px;min-height:44px;padding:8px;border:1px solid var(--ui-border);background:var(--ui-raised);font-size:14px;}
  #mobileAppShell .app-menu-quick>button svg {width:20px;height:20px;}
  #mobileAppShell .app-menu-tile-grid {grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
  #mobileAppShell .app-menu-tile {min-height:76px;align-items:center;justify-content:center;padding:10px 5px;gap:6px;border:1px solid var(--ui-border);background:var(--ui-raised);border-radius:14px;}
  #mobileAppShell .app-menu-art {display:grid;place-items:center;aspect-ratio:auto;width:26px;height:26px;background:transparent;border-radius:0;overflow:visible;color:var(--ui-link);}
  #mobileAppShell .app-menu-art>svg {position:static;width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;filter:none;}
  #mobileAppShell .app-menu-tile-label {font:400 13px/1.35 var(--ui-map-font);margin:0;}
  #mobileAppShell .app-menu-tile[aria-pressed=true] {background:var(--ui-selected)!important;border-color:var(--ui-link);}
  #mobileAppShell .app-menu-tile[aria-pressed=true] .app-menu-art {outline:none;}
  #mobileAppShell .app-menu-tile[aria-pressed=true] .app-menu-art::after {content:none;}
  #mobileAppShell .app-preferences {gap:12px;}
  #mobileAppShell .app-preferences-row {min-height:52px;padding:8px 12px;gap:10px;}
  #mobileAppShell .app-preferences-account {min-height:76px;padding:12px;border-radius:16px;}
  #mobileAppShell .app-preferences-account .app-preferences-text strong {font-size:16px;}
  #mobileAppShell .app-preferences-icon {width:32px;height:32px;flex-basis:32px;border-radius:10px;color:var(--ui-link);}
  #mobileAppShell .app-preferences-icon svg {width:20px;height:20px;}
  #mobileAppShell .app-preferences-heading {padding:12px 12px 8px;font-size:12px;}
  #mobileAppShell .app-preferences-modes button {min-height:44px;border:0;color:var(--ui-text);}
  #mobileAppShell .app-preferences-modes button[aria-pressed=true] {background:var(--ui-accent)!important;color:var(--ui-accent-ink)!important;box-shadow:none;}
  #mobileAppShell .app-preferences-about>summary {min-height:52px;padding:10px 12px;}
  #mobilePreferencesPanel .ws-setting-row {min-height:52px;padding:8px 12px;}
  #mobilePreferencesPanel .ws-settings-group-title {padding:10px 12px;font-size:12px;}
  #optionPanel .feature-panel-tabs {display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr));gap:2px;padding:5px 8px;overflow:visible;}
  #optionPanel .feature-panel-tab {min-width:0!important;min-height:44px!important;padding:5px 1px!important;font:400 12px/1.25 var(--ui-map-font)!important;white-space:normal;}
  #mapSearch {font-family:var(--ui-map-font);}
  #mapSearch :is(.app-search-controls,.app-search-panel,.app-search-list,.app-search-recents) {background:var(--ui-surface);color:var(--ui-text);}
  #mapSearch .app-search-result {min-height:64px;padding:12px 14px;border-bottom:1px solid var(--ui-border);gap:12px;}
  #mapSearch .app-search-result strong {font-size:15px;font-weight:700;line-height:1.35;}
  #mapSearch .app-search-result-description {font-size:13px;line-height:1.4;color:var(--ui-muted);}
  #mapSearch .app-search-source {font-size:11px;line-height:1.4;color:var(--ui-muted);}
  #mapSearch .app-search-result>svg {width:21px;height:21px;color:var(--ui-link);flex-shrink:0;}
  #mapSearch .app-search-scopes button {min-height:44px;font:400 13px/1.3 var(--ui-map-font);}
  #mapSearch .app-search-scopes button[aria-pressed=true] {color:var(--ui-link);border-color:var(--ui-link);}
  #workspacePanel .ws-mobile-simple-settings {display:grid;gap:10px;}
  #workspacePanel .ws-mobile-simple-settings .ws-tool-section {margin:0;padding:12px;border:1px solid var(--ui-border);border-radius:14px;background:var(--ui-surface);}
  #workspacePanel .ws-mobile-simple-settings .ws-tool-section h4 {font-size:14px;margin:0 0 12px;}
  #workspacePanel .ws-mobile-simple-settings .ws-tool-input {display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;margin:0;}
  #workspacePanel .ws-mobile-simple-settings .ws-tool-input>span {color:var(--ui-text);font-size:14px;}
  #workspacePanel .ws-mobile-layer .ws-primary {background:var(--ui-accent)!important;color:var(--ui-accent-ink)!important;border-color:var(--ui-accent)!important;}
  #workspacePanel .ws-mobile-simple-settings input[type=number] {width:88px;min-height:44px;font-size:16px;}
  #workspacePanel .ws-mobile-simple-settings input[type=color] {width:52px;min-height:44px;padding:5px;}
  #workspacePanel .ws-mobile-record-card .ws-record-coordinates {margin:10px 0 0;border-top:1px solid var(--ui-border);padding-top:10px;}
  #workspacePanel .ws-mobile-record-card .ws-record-coordinates h4 {margin:0 0 8px;font-size:12px;color:var(--ui-muted);}
  #workspacePanel .ws-mobile-record-card .ws-record-map-actions {margin-top:8px;}
  #workspacePanel .ws-mobile-media-upload {display:grid;gap:8px;margin-bottom:12px;}
  #workspacePanel .ws-mobile-media-upload select {width:100%;min-height:44px;font-size:16px;}
  #workspacePanel .ws-mobile-media-upload input[type=file] {max-width:100%;min-height:44px;font-size:14px;color:var(--ui-text);}
  #workspacePanel .ws-mobile-media-upload input::file-selector-button {min-height:44px;padding:8px 12px;border:1px solid var(--ui-border);border-radius:10px;background:var(--ui-selected);color:var(--ui-link);}
}
/* Compact fixed settings: labels and controls share a row. */
html:root:is([data-app-layout=phone],[data-app-layout=tablet]) {
  #mobileAppShell .app-preferences {gap:6px;}
  #appTools .app-tools-content {padding:6px 10px;}
  #mobileAppShell .app-preferences-mode {grid-template-columns:minmax(64px,.7fr) minmax(0,1.6fr);align-items:center;gap:6px;padding:4px 8px;}
  #mobileAppShell .app-preferences-mode .app-preferences-text strong {font-size:12px;font-weight:500;}
  #mobileAppShell .app-preferences-modes {padding:2px;gap:2px;border-radius:9px;}
  #mobileAppShell .app-preferences-modes button {min-width:0;min-height:32px;height:32px;padding:3px;font-size:12px;border-radius:7px;}
  #mobileAppShell .app-preferences-row,#mobileAppShell .app-preferences-about>summary {min-height:44px;padding:5px 10px;gap:8px;}
  #mobileAppShell .app-preferences-account {min-height:60px;padding:8px 10px;}
  #mobileAppShell .app-preferences-account .app-preferences-text {grid-template-columns:minmax(0,1fr) auto;gap:2px 6px;}
  #mobileAppShell .app-preferences-account small {grid-column:1/-1;grid-row:2;}
  #mobileAppShell .app-preferences-badge {grid-column:2;grid-row:1;margin:0;padding:2px 5px;font-size:10px;}
  #mobileAppShell .app-preferences-text strong {font-size:14px;}
  #mobileAppShell .app-preferences-icon {width:26px;height:26px;flex-basis:26px;border-radius:8px;}
  #mobileAppShell .app-preferences-usage {padding:0 10px 8px;}
  #mobileAppShell .app-preferences-usage>header {min-height:44px;}
  #mobileAppShell .app-preferences-usage h3 {font-size:13px;}
  #mobileAppShell .app-storage-legend {gap:4px 10px;margin:6px 0 0;}
  #mobileAppShell .app-storage-legend>div {display:grid;gap:2px;}
  #mobileAppShell .app-storage-legend dt {font-size:11px;white-space:nowrap;}
  #mobileAppShell .app-storage-legend dd {margin:0;font-size:11px;}
  #mobileAppShell .app-usage-transfer {margin-top:8px;padding-top:8px;}
  #mobileAppShell :is(.app-usage-available,.app-usage-reset) {margin:4px 0 0;font-size:11px;}
  #mobileAppShell .app-usage-metric-heading {margin-bottom:5px;}
  #mobileAppShell .app-storage-capacity {height:8px;}
  #mobileAppShell .app-preferences-account .app-preferences-text strong {white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px;}
  #mobileAppShell .app-usage-message:empty {display:none;}
  #mobileAppShell .app-preferences-about-links {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));}
  #mobileAppShell .app-preferences-about-links>.app-preferences-row {min-height:44px;padding:5px 10px;}
  #mobileAppShell .app-preferences-about-links .app-preferences-text strong {font-size:12px;font-weight:500;}
  #mobileAppShell .app-preferences-support {min-height:44px;font-size:12px;padding:5px 10px;}
  #mobileAppShell .app-create-options {gap:6px;}
  #mobileAppShell .app-create-options button {min-height:48px;padding:8px 10px;}
  #mobileAppShell .app-create .app-tool-grid button {min-height:48px;padding:8px;}
  #mobileAppShell .app-create .app-tools-content>p,
  .app-search-labels-copy p,
  #workspacePanel .ws-media-editor>p:not([role]),
  #workspacePanel .ws-drax-style-preview>small {display:none;}
}
/* One glass material for touch surfaces; nested content stays unblurred. */
html:root:is([data-app-layout=phone],[data-app-layout=tablet]) #workspacePanel {
  .ws-collections-actions {position:relative;align-items:center;overflow:visible;}
  .ws-collections-actions>.ws-explorer-new {
    display:grid;place-items:center;flex:none;width:48px;min-width:48px!important;height:48px;min-height:48px!important;padding:10px;
    border:1px solid var(--ui-map-edge)!important;border-radius:50%;background:var(--ui-selected)!important;color:var(--ui-link)!important;box-shadow:0 2px 7px #18212b16;
  }
  .ws-explorer-new>svg {width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;}
  .ws-collections-actions>.ws-explorer-new-menu {
    position:absolute;inset:auto 16px calc(100% + 8px) auto;z-index:30;box-sizing:border-box;width:248px;max-width:calc(100vw - 32px);min-width:0;
    padding:6px;border:1px solid var(--ui-map-edge);border-radius:18px;background:var(--ui-surface);color:var(--ui-text);box-shadow:0 8px 28px #18212b29;
  }
  .ws-explorer-new-menu>.ws-explorer-menu-item {box-sizing:border-box;min-height:50px;width:100%;padding:10px 14px;border:0;border-radius:12px;background:transparent;color:inherit;font:500 15px/1.3 var(--ui-map-font);text-align:start;}
  .ws-explorer-new-menu>.ws-explorer-menu-item:is(:hover,:focus-visible) {background:var(--ui-selected);outline:0;}
  .ws-explorer-new-menu>.ws-explorer-menu-item:active {background:var(--ui-selected);}
  .ws-explorer-new:disabled {opacity:.4;box-shadow:none;}
}
html:root:is([data-app-layout=phone],[data-app-layout=tablet]) {
  --touch-glass-card:color-mix(in srgb,var(--ui-surface) 62%,transparent);
  --touch-glass-shine:rgba(255,255,255,.5);
  &[data-theme=dark] {--touch-glass-shine:rgba(255,255,255,.12);}
  body :is(#mapSearch,#optionPanel,#workspacePanel,#mobilePreferencesPanel,#locatePanel,#sharePanel,#layerInfoPanel,#elevationProfilePanel,#savedViewsPanel,#timePeriodPanel,#toolbarContainer),
  #mobileAppShell :is(.app-sheet,.app-menu-drawer,#appCreate,.app-operation,.app-location-status,.app-hud-resume),
  body dialog {
    background:var(--ui-map-glass)!important;color:var(--ui-text);
    border-color:var(--ui-map-edge)!important;
    box-shadow:0 5px 22px #18212b2b,inset 0 1px 0 var(--touch-glass-shine)!important;
    backdrop-filter:blur(20px) saturate(115%)!important;-webkit-backdrop-filter:blur(20px) saturate(115%)!important;
  }
  #mapSearch :is(.map-search-bar,.app-search-controls,.app-search-panel,.app-search-list,.app-search-recents),
  #mobileAppShell :is(.app-menu-content,.app-tools-content,.app-menu-browser,.app-preferences),
  #workspacePanel :is(.ws-body,.ws-content,.ws-mobile-layer,.ws-mobile-record-card),
  #optionPanel :is(#panelScrollContent,.feature-panel-tabs) {background:transparent!important;}
  #mobileAppShell :is(.app-menu-tile,.app-menu-quick>button,.app-preferences-row,.app-preferences-account,.app-preferences-about,.app-menu-dismiss),
  #workspacePanel :is(.ws-tool-section,.ws-setting-row,.ws-record-field),
  #savedViewsPanel .saved-view-card {
    background:var(--touch-glass-card)!important;border-color:var(--ui-map-edge)!important;
    box-shadow:inset 0 1px 0 var(--touch-glass-shine);
  }
  .cursor-status-bar :is(#cursorCrsButton,#cursorStatusReadout,#mainScaleBar) {
    backdrop-filter:blur(20px) saturate(115%)!important;-webkit-backdrop-filter:blur(20px) saturate(115%)!important;
    box-shadow:inset 0 1px 0 var(--touch-glass-shine);
  }
  #mobileAppShell :is(.app-menu-art,.app-menu-quick>button) {color:var(--ui-text)!important;}
  #mobileAppShell .app-menu-tile[aria-pressed=true] {background:var(--ui-selected)!important;}
  #mobileAppShell .app-menu-tile[aria-pressed=true] :is(.app-menu-art,.app-menu-tile-label) {color:var(--ui-link)!important;}
}
@media(prefers-reduced-transparency:reduce) {
  html:root:is([data-app-layout=phone],[data-app-layout=tablet]) {--touch-glass-card:var(--ui-surface);}
}
@media(prefers-reduced-motion:reduce) {
  html:root:is([data-app-layout=phone],[data-app-layout=tablet]) #mobileAppShell .app-primary-bank>button {transition:none;}
}

html:root:is([data-app-layout=phone],[data-app-layout=tablet]) #mobileAppShell .app-bottom-dock{bottom:calc(var(--app-safe-bottom,0px) + 4px);padding:4px;}
