/* Phone content, shared by focused and floating phone workspaces. Desktop rules
   remain authoritative outside phone-device. Values use rem plus a readable
   minimum so the member's larger accessibility scale continues to work. */
body.phone-device .win-body {
  --phone-module-padding: 8px;
  --phone-body: max(14px, .875rem);
  --phone-support: max(13px, .8125rem);
  --phone-target: max(44px, 2.75rem);
  font-size: var(--phone-body);
  line-height: 1.3;
  padding: var(--phone-module-padding) !important;
  padding-bottom: calc(var(--phone-module-padding) + var(--overlay-bottom, 0px)) !important;
  gap: 6px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
body.phone-device .win-body [data-phone-copy="body"],
body.phone-device .win-body [data-phone-legible] { font-size: var(--phone-body) !important; line-height: 1.3 !important; }
body.phone-device .win-body [data-phone-copy="support"] { font-size: var(--phone-support) !important; line-height: 1.3 !important; }
body.phone-device .win-body :is(button, [role="button"], summary) {
  min-height: var(--phone-target) !important;
  font-size: var(--phone-body) !important;
  line-height: 1.3;
  white-space: normal;
  touch-action: manipulation;
}
body.phone-device .win-body :is(button, [role="button"]) { min-width: var(--phone-target); }
body.phone-device .win-body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
  font-size: max(16px, 1rem) !important;
  min-height: var(--phone-target) !important;
  min-width: 0 !important;
  max-width: 100%;
  box-sizing: border-box;
}
/* The label supplies the finger target; keep the native check/radio compact. */
body.phone-device .win-body label:has(input:is([type="checkbox"], [type="radio"])) {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--phone-target);
  min-width: var(--phone-target);
  padding: 4px 0;
  box-sizing: border-box;
  cursor: pointer;
}
body.phone-device .win-body input:is([type="checkbox"], [type="radio"]) {
  flex: 0 0 16px;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  margin: 0;
  padding: 0;
}
body.phone-device .win-body input[type="range"] {
  height: var(--phone-target);
  min-height: var(--phone-target) !important;
  min-width: 0;
  max-width: 100%;
}
body.phone-device .win-body :is(p, small, label, .oc-address, .mini-token-address, .token-address-line) { overflow-wrap: anywhere; }
body.phone-device .win-body :is(.pf-card,.shop-card,.cm-card,.cp-card,.gd-card,.wh-card,.mh-card,.rd-card) { padding: 6px 8px !important; min-width: 0; gap: 4px; }

/* Native tables become labelled records. No column or its actions are removed. */
.phone-table-sort { display: none; }
body.phone-device .win-body .phone-table-sort { display: flex; flex-wrap: nowrap; gap: 4px; margin-bottom: 4px; overflow-x: auto; }
body.phone-device .win-body .phone-table-sort button { flex: 0 0 auto; padding: 4px 6px; background: var(--surface-2); color: var(--text-main); border: 1px solid var(--card-border); border-radius: 5px; }
body.phone-device .win-body table[data-phone-table],
body.phone-device .win-body table[data-phone-table] tbody { display: block; width: 100%; min-width: 0; white-space: normal; overflow: visible; }
body.phone-device .win-body table[data-phone-table] thead,
body.phone-device .win-body .wh-head {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
body.phone-device .win-body [data-phone-row] {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  width: 100%; min-width: 0 !important; box-sizing: border-box;
  gap: 4px 8px !important; padding: 6px !important; margin: 0;
  border: 0; border-bottom: 1px solid var(--card-border); border-radius: 0;
  background: transparent; white-space: normal;
}
body.phone-device .win-body [data-phone-row] > * {
  display: block; min-width: 0; width: auto !important;
  padding: 0 !important; text-align: left !important;
  white-space: normal !important; overflow-wrap: anywhere;
}
body.phone-device .win-body [data-phone-label]::before {
  content: attr(data-phone-label) ': '; display: inline; margin-right: 3px;
  font: 500 var(--phone-support)/1.3 Inter, sans-serif;
  color: var(--text-muted); white-space: normal;
}
body.phone-device [data-type="top200"] [data-phone-row] > :nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
body.phone-device [data-type="top200"] [data-phone-row] > :nth-child(3) { grid-column: 1; grid-row: 2; font-size: max(18px, 1.125rem) !important; font-weight: 750; }
body.phone-device [data-type="top200"] [data-phone-row] > :nth-child(4) { grid-column: 2; grid-row: 2; }
body.phone-device [data-type="top200"] [data-phone-row] > :first-child { grid-row: 3; }
body.phone-device [data-type="top200"] [data-phone-row] > :is(:nth-child(2),:nth-child(3),:nth-child(4))::before { display: none; }
body.phone-device [data-type="top200"] [data-phone-row] > :nth-child(4) { text-align: right !important; }
body.phone-device [data-type="top200"] [data-phone-row] > :last-child { text-align: right !important; }
body.phone-device .win-body :is(.token-identity-line,.mini-token-address,.token-address-line,.pf-mint) { flex-wrap: wrap; gap: 6px; max-width: 100%; }
body.phone-device .win-body [data-phone-row] :is(.oc-icon-btn,.oc-text-btn) { display: inline-flex; align-items: center; justify-content: center; margin: 4px 4px 0 0; }
body.phone-device .win-body :is(.wh-table.wh-holders,.oc-table-wrap,.market-table-scroll,.radar-pool-list) { min-width: 0; width: 100%; overflow-x: visible; }
body.phone-device .win-body .pair-pool > :first-child,
body.phone-device [data-type="pumpfun"] .pf-row > :nth-child(2),
body.phone-device [data-type="pumpfun"] .pf-row > :nth-child(3) { grid-column: 1 / -1; }

/* Toolbars reflow into rows; tab lanes retain every option with visible scroll. */
body.phone-device .win-body :is(.enterprise-sort-bar,.oc-toolbar,.oc-search,.pair-toolbar,.pf-toolbar,.wh-controls,.wh-toolbar,.os-controls,.os-toolbar,.rd-toolbar,.bm-controls,.alerts-toolbar,.calc-tool-head,.pair-tape-head,.files-toolbar,.gd-toolbar,.cm-toolbar,.cp-toolbar,.chat-status) {
  display: flex; flex-wrap: wrap !important; gap: 4px !important;
  min-width: 0 !important; max-width: 100%; height: auto !important;
}
body.phone-device .win-body :is(.enterprise-sort-bar input,.oc-toolbar .oc-search,.pair-toolbar .pair-search,.wh-controls .token-picker,.wh-search,.os-search,.rd-search) { flex: 1 1 160px; width: auto !important; min-width: 0 !important; }
body.phone-device .win-body .enterprise-sort-bar input { flex-basis: 100%; }
body.phone-device .win-body :is(.gd-lanes,.gd-sub-toolbar,.cp-sub,.cm-lanes,.os-lanes,.wh-lanes,.bm-lanes,.oc-tabs,.chat-rooms,.rd-tabs,.mh-tabs,.ai-tier-selector) {
  display: flex; flex-wrap: nowrap !important; gap: 4px; min-width: 0; max-width: 100%;
  overflow-x: auto; scrollbar-width: thin !important; padding-bottom: 3px;
  scroll-padding: 8px; -webkit-overflow-scrolling: touch;
}
body.phone-device .win-body :is(.gd-lanes,.gd-sub-toolbar,.cp-sub,.cm-lanes,.os-lanes,.wh-lanes,.bm-lanes,.oc-tabs,.chat-rooms,.rd-tabs,.mh-tabs,.ai-tier-selector) > button { flex: 0 0 auto; padding: 4px 8px; white-space: nowrap; }
body.phone-device .win-body :is(.gd-lanes,.gd-sub-toolbar,.cp-sub,.cm-lanes,.chat-rooms)::-webkit-scrollbar { display: block; height: 5px; }

/* Cards and split panes use the available phone width, not scaled desktop grids. */
body.phone-device .win-body :is(.gd-grid,.pf-stages,.rd-cards,.mh-grid,.calc-planner,.oc-fact-grid,.oc-source-layout) { grid-template-columns: minmax(0,1fr) !important; }
body.phone-device .win-body .cp-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
body.phone-device .win-body :is(.oc-metrics,.oc-source-meta,.pf-stats,.pf-user-stats,.calc-results,.calc-fields-grid,.alerts-builder,.wh-summary) { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
body.phone-device .win-body :is(.oc-metric strong,.calc-result strong,.alert-desc) { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
body.phone-device .win-body :is(.oc-key-values,.oc-read-grid) > div { grid-template-columns: minmax(80px,.8fr) minmax(0,1.2fr); gap: 6px; padding: 6px; }
body.phone-device .win-body .oc-search input { width: 0; }
body.phone-device .win-body .oc-identity { flex-wrap: wrap; align-items: flex-start; gap: 6px; padding: 6px; }
body.phone-device .win-body .oc-identity > div { min-width: 0; max-width: 100%; }
body.phone-device .win-body .oc-address-row { flex-wrap: wrap; }
body.phone-device .win-body .oc-source-layout { flex: 0 0 auto; min-height: 240px; }
body.phone-device .win-body .oc-source-files { flex-direction: row; overflow-x: auto; }
body.phone-device .win-body .oc-source-files button { flex: 0 0 auto; }
body.phone-device .win-body .oc-code-pane pre { max-width: 100%; min-height: 220px; }
body.phone-device .win-body .oc-abi-row { grid-template-columns: minmax(0,1fr); }
body.phone-device .win-body .oc-abi-row b { overflow-wrap: anywhere; }
body.phone-device .win-body :is(.pf-stage-rows,.pair-tape,.pair-pools) { max-height: 260px; overflow-y: auto; }
body.phone-device .win-body .shop-grid { grid-template-columns: repeat(auto-fit,minmax(min(150px,100%),1fr)); }
body.phone-device .win-body :is(.chat-form,.chat-input-row) { flex-wrap: wrap; gap: 8px; }
body.phone-device .win-body .chat-input { flex: 1 1 180px; }
body.phone-device .win-body .chat-tool { width: var(--phone-target); height: var(--phone-target); }
body.phone-device .win-body .chat-emoji-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
body.phone-device .win-body .cl-review { min-width: var(--phone-target); min-height: var(--phone-target); }
body.phone-device .win-body .cl-row { gap: 6px; padding: 4px 0; }
body.phone-device .win-body .cl-why { padding-left: 0 !important; }
body.phone-device .win-body .alert-rule { grid-template-columns: 24px minmax(0,1fr) auto; gap: 8px; }
body.phone-device .win-body .alert-rule > button:last-child { grid-column: 3; }
body.phone-device .win-body .calc-shell { height: auto; min-height: 100%; }
body.phone-device .win-body .calc-planner { flex: 0 0 auto; overflow: visible; padding: 0; }
body.phone-device .win-body .calc-mode-tabs { display: flex; flex-wrap: nowrap; gap: 4px; padding: 4px 0; }
body.phone-device .win-body .calc-mode-tabs > [data-calc-mode] { display: none; }
body.phone-device .win-body .calc-mode-select { display: block; flex: 1 1 0; width: 0; background: var(--surface-2); color: var(--text-strong); border: 1px solid var(--card-border); border-radius: 5px; padding: 4px; }
body.phone-device .win-body .calc-mode-tabs > .calc-detail-toggle { flex: 0 0 auto; min-width: 0; padding: 4px 6px; }
body.phone-device .win-body .calc-keypad { grid-auto-rows: var(--phone-target); }
body.phone-device .win-body .calc-field em { flex-shrink: 0; white-space: nowrap; padding-left: 4px; }
body.phone-device [data-type="pumpfun"] .pf-name :is(b,small) { max-width: none; white-space: normal; text-overflow: clip; overflow: visible; }
body.phone-device .win-body .calc-basic { flex: 0 0 auto; padding: 0; }
body.phone-device .win-body .candle-stage { min-height: 240px; }
body.phone-device .win-body .pair-chart-stage { min-height: 160px; }
body.phone-device .win-body .candle-terminal { min-height: 360px; flex-shrink: 0; }
body.phone-device .win-body .bm-stage { min-height: 240px; flex: 0 0 auto; }
body.phone-device .win-body .bm-stage canvas { position: relative; inset: auto; width: 100%; height: 240px; }
body.phone-device .win-body .bm-overlay { bottom: auto; height: 240px; padding: 8px; }
body.phone-device .win-body .bm-legend { position: relative; left: auto; bottom: auto; z-index: 1; flex-direction: row; flex-wrap: wrap; gap: 4px 8px; padding: 6px; background: var(--surface-2); }
body.phone-device .win-body .bm-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
body.phone-device .win-body .bm-source { flex: 1 1 160px; min-width: 0; }
body.phone-device [data-type="files"] .win-body > div:last-child { grid-template-columns: minmax(0,1fr) !important; grid-template-rows: minmax(44px,120px) minmax(160px,1fr) !important; gap: 6px !important; }
body.phone-device .win-body :is(.cm-form,.gd-form,.cp-form) { min-width: 0; }
body.phone-device .win-body :is(.cm-form,.gd-form,.cp-form) label { min-width: 0; }
body.phone-device .win-body .options-pills-bar { display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; margin-top: 6px; }
body.phone-device .win-body .token-card { min-width: 0; }
@container workspace-window (max-width: 300px) {
  body.phone-device .win-body :is(.cp-grid,.calc-fields-grid,.alerts-builder,.pf-stats,.pf-user-stats) { grid-template-columns: minmax(0,1fr) !important; }
}

body.phone-device .win-body .candle-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px; padding: 4px; }
body.phone-device .win-body .candle-toolbar > * { flex-shrink: 0; }
body.phone-device .win-body :is(.candle-frames,.candle-sync) { flex-wrap: nowrap; min-width: max-content; max-width: none; }
body.phone-device .win-body .candle-legend { white-space: normal; text-overflow: clip; overflow-wrap: anywhere; }
body.phone-device .win-body .compare-toolbar { flex-wrap: wrap; gap: 8px; }
body.phone-device .win-body .compare-toolbar > div { flex: 1 0 100%; }
body.phone-device .win-body .compare-cards { grid-template-columns: minmax(0,1fr); }
body.phone-device .win-body :is(.compare-actions,.compare-series,.compare-address) { flex-wrap: wrap; }
body.phone-device .win-body .compare-summary { flex-direction: column; }

/* Narrow floating windows and the focused view share a compact content rhythm.
   Primary controls keep their touch area; adjacent secondary controls form one
   strip instead of consuming a separate padded row for each action. */
body.phone-device .win-body .phone-table-sort select { flex: 1 1 0; width: 0; background: var(--surface-2); color: var(--text-main); border: 1px solid var(--card-border); border-radius: 5px; padding: 4px 6px; }
body.phone-device .win-body :is(.cm-form,.gd-form,.cp-editor,.alerts-card) { padding: 6px 8px; gap: 6px; }
body.phone-device .win-body :is(.cm-panel,.gd-panel,.cp-panel,.cp-root,.rd-panel,.pf-card,.alerts-pane) { gap: 6px; }
body.phone-device .win-body :is(.cm-card p,.rd-note,.pf-card p) { margin: 3px 0; }
body.phone-device .win-body :is(.pf-stats,.pf-user-stats,.oc-metrics,.wh-summary,.bm-summary,.calc-results,.calc-fields-grid) { gap: 4px; }
body.phone-device .win-body :is(.oc-metric,.pf-stat,.calc-result) { padding: 5px 6px; }
body.phone-device .win-body .cp-actions :is(.cp-btn,.gd-btn) { flex: 1 1 100px; }
body.phone-device .win-body .cp-grid .cp-field:has(textarea) { grid-column: 1 / -1; }
body.phone-device .win-body .cm-form-row:has(.cm-check) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 8px; align-items: stretch; }
body.phone-device .win-body .cm-check { white-space: normal; }
body.phone-device .win-body .workspace-favorite-card { gap: 4px; }
body.phone-device .win-body .workspace-favorite-open { display: flex; align-items: center; flex: 1; }

/* Chart settings scroll independently; a small window still starts with a plot. */
body.phone-device .win-body .candle-toolbar { max-width: 100%; overflow: visible; }
body.phone-device .win-body .candle-toolbar > .token-picker { width: 100%; min-width: 0; }
body.phone-device .win-body .phone-chart-tools { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
body.phone-device .win-body .phone-chart-tools > * { flex-shrink: 0; white-space: nowrap; }
body.phone-device .win-body .candle-toolbar > :is(button,select) { white-space: nowrap; }
body.phone-device .win-body .candle-toolbar .candle-detail-toggle { margin-left: 0; }
body.phone-device .win-body .candle-identity { gap: 4px; padding: 4px 6px; }
body.phone-device .win-body .candle-legend { padding: 2px 6px; }
body.phone-device .win-body .compare-toolbar { gap: 4px; padding: 4px 0; }
body.phone-device .win-body .compare-card { padding: 6px; gap: 4px; }
body.phone-device .win-body .bm-key { color: var(--text-main); font-size: var(--phone-support); }
body.phone-device .win-body .bm-controls .token-picker { flex: 1 1 140px; min-width: 0; }

/* Research and news are lists, not padded dashboards within a dashboard. */
body.phone-device .win-body .rd-gauge { padding: 8px 4px; gap: 4px; }
body.phone-device .win-body .rd-gauge-val { font-size: max(30px,1.875rem); }
body.phone-device .win-body .rd-news-row { display: grid; grid-template-columns: minmax(0,1fr); gap: 2px; padding: 6px 0; }
body.phone-device .win-body .mh-head { gap: 4px; flex-wrap: wrap; }
body.phone-device .win-body .mh-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 3px 6px; }
body.phone-device .win-body .mh-card > :is(.mh-src,.mh-note,.mh-missing,.mh-mech) { grid-column: 1 / -1; }
body.phone-device .win-body .mh-value { font-size: max(18px,1.125rem); }
body.phone-device .win-body .os-row { grid-template-columns: minmax(0,1fr); gap: 3px; padding: 6px; }
body.phone-device .win-body .os-side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; }
body.phone-device .win-body .os-src { text-align: left; }
body.phone-device .win-body .os-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px !important; }
body.phone-device .win-body .os-controls .os-search { width: 100% !important; grid-column: 1 / -1; }
body.phone-device .win-body .radar-toolbar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
body.phone-device .win-body .radar-toolbar :is(input,button,label) { min-width: 0; width: 100%; }
body.phone-device .win-body .pf-stage-head { padding: 5px 6px; }
body.phone-device .win-body .pair-toolbar .pair-detail-toggle { margin-left: 0; }
body.phone-device .win-body .pair-toolbar .pair-search { flex-basis: 100%; }
body.phone-device .win-body .pair-toolbar .pair-minliq { flex: 1; width: 0; }

/* Checklist and chat already own inner panes; do not pad both outer and inner. */
body.phone-device .win-body.cl-body-wrap { --phone-module-padding: 0px; padding: 0 !important; gap: 0; }
body.phone-device .win-body :is(.cl-head,.cl-body,.cl-disclaimer) { padding: 6px 8px; }
body.phone-device .win-body .cl-item-row { padding: 2px 4px; gap: 4px; }
body.phone-device .win-body .cl-check { border-color: transparent; background: radial-gradient(circle at center, transparent 8px,var(--card-border) 8px,var(--card-border) 9px,transparent 10px); }
body.phone-device .win-body .cl-check.on { background: radial-gradient(circle at center, transparent 8px,var(--accent-green) 8px,var(--accent-green) 9px,transparent 10px); }
body.phone-device .win-body .cl-why { padding: 0 6px 6px !important; }
body.phone-device .win-body.chat-body { --phone-module-padding: 0px; padding: 0 !important; gap: 0; overflow: hidden; }
body.phone-device .win-body :is(.chat-rooms,.chat-status,.chat-scroll,.chat-form) { padding: 4px 6px; gap: 4px; }
body.phone-device .win-body .chat-form { flex-wrap: nowrap; }
body.phone-device .win-body .chat-input { flex: 1 1 0; width: 0; min-width: 0; }

/* Existing calculator mode selection replaces the wall of equivalent tabs. */
body.phone-device .win-body .calc-screen { padding: 6px; gap: 4px; }
body.phone-device .win-body .calc-input-column { padding: 6px; }
body.phone-device .win-body .calc-tool-head { gap: 4px !important; }
body.phone-device .win-body .calc-keypad { gap: 4px; }
body.phone-device .win-body .alerts-statusbar { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
body.phone-device .win-body .alerts-meta { flex: 0 0 auto; padding: 4px 6px; }
body.phone-device .win-body .alerts-desktop { align-self: flex-start; }
body.phone-device .win-body .alerts-tabs { flex-wrap: nowrap; gap: 4px; min-width: 0; }
body.phone-device .win-body .alerts-tab { flex: 0 0 auto; white-space: nowrap; padding: 4px 6px; }
body.phone-device .win-body .alerts-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
body.phone-device .win-body .alerts-form :is(.alerts-subj,.alerts-param,.alerts-evt-note) { grid-column: 1 / -1; width: 100%; }
body.phone-device .win-body .alerts-form :is(input,select) { width: 100%; }
body.phone-device .win-body .ai-tier-selector { margin-bottom: 4px; }
body.phone-device .win-body .ai-mech-row { gap: 4px; margin-bottom: 4px; }
body.phone-device .win-body .ai-mech-box { padding: 6px; }
body.phone-device .win-body .shop-head { padding: 6px; gap: 6px; flex-wrap: wrap; }
body.phone-device [data-type="files"] .options-pills-bar { margin-top: 0; flex-shrink: 0; }
body.phone-device [data-type="files"] .options-pills-bar > * { flex-shrink: 0; white-space: nowrap; }
body.phone-device [data-type="files"] [id^="files-preview-container-"] { padding: 6px !important; gap: 6px !important; }
/* Neutral empty/loading messages use the same opaque theme surface as content.
   Hardcoded translucent dark cards made their muted text unreadable in Light. */
body.phone-device .win-body :is(.cm-empty,.cm-cmt-empty,.rd-empty,.rd-loading,.oc-empty,.oc-loading,.os-empty,.wh-empty,.alerts-empty,.mh-empty,.pf-empty,.pf-loading,.shop-empty,.shop-loading,.chat-empty) {
  color: var(--text-muted);
  background: var(--surface-2);
}

/* Text inks are distinct from accent fills. The bright brand colors remain on
   buttons and plots; on a light card, the corresponding text needs darker ink.
   Negative values retain the product's muted-green convention, not red. */
body.phone-device {
  --phone-ink-link: var(--accent-cyan);
  --phone-ink-positive: var(--accent-green);
  --phone-ink-negative: var(--accent-red);
  --phone-ink-warning: var(--accent-gold);
  --phone-ink-caution: #ffab40;
}
:root[data-theme="light"] body.phone-device {
  --phone-ink-link: #00586c;
  --phone-ink-positive: #08613b;
  --phone-ink-negative: #365f4c;
  --phone-ink-warning: #735100;
  --phone-ink-caution: #735100;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body.phone-device {
    --phone-ink-link: #00586c;
    --phone-ink-positive: #08613b;
    --phone-ink-negative: #365f4c;
    --phone-ink-warning: #735100;
    --phone-ink-caution: #735100;
  }
}
/* These are DOM reading surfaces, including the legend below BubbleMap. Canvas
   renderers keep their own dark plot backgrounds and label palettes. */
body.phone-device .win-body :is(.os-status,.os-map,.os-scard,.alerts-meta,.alerts-card,.alerts-mygroup,.oc-identity,.oc-metric,.oc-tx-flow,.oc-bd-summary>div,.oc-bd-group,.ai-mech-box,.calc-screen,.calc-mode-tabs,.calc-input-column,.calc-field>div,.calc-result,.compare-card,.bm-legend) {
  background: var(--surface-2) !important;
}
body.phone-device [data-type="files"] .win-body > div:has(>[id^="files-tab-"]),
body.phone-device [data-type="files"] :is([id^="files-list-container-"],[id^="files-preview-container-"]) {
  background: var(--surface-2) !important;
}
body.phone-device .win-body :is(.ai-mech-box,.ai-mech-answer,.bm-key) { color: var(--text-main); }
body.phone-device .win-body :is(.os-status small,.os-scard small,.oc-bd-lead,.oc-bd-why,.oc-bd-line,.oc-bd-missing,.calc-drop-hint,.calc-field em) { color: var(--text-muted); }
body.phone-device .win-body :is(.token-price,.tm-v.tm-up,.oc-metric .positive,.oc-risk.low,.oc-source.live,.oc-direction.in,.oc-read-grid strong,.oc-bd-summary strong.good,.oc-fact.good>span,.ai-mech-badge,.calc-result.good strong,.calc-warning .ok,.os-status.os-ok b,.oc-toolbar-btn.active) { color: var(--phone-ink-positive) !important; }
body.phone-device .win-body .top200-row > td[style*="--accent-green"] { color: var(--phone-ink-positive) !important; }
body.phone-device .win-body :is(.tm-v.tm-down,.oc-metric .negative,.oc-risk.high,.oc-direction.out,.oc-bd-summary strong.bad,.calc-result.bad strong,.os-status.os-error b,.calc-keypad button.clear,.cm-error,.gd-error:not(.gd-auth)) { color: var(--phone-ink-negative) !important; }
body.phone-device .win-body .top200-row > td[style*="--accent-red"] { color: var(--phone-ink-negative) !important; }
body.phone-device .win-body :is(.cl-disclaimer,.oc-metric .warning,.oc-source.demo,.oc-risk.medium,.oc-risk.watch,.oc-risk.unknown,.oc-bd-summary strong.warn,.oc-fact.warn>span,.calc-result.warn strong,.calc-warning,.os-status.os-loading b,.alerts-mode.evt,.gd-error.gd-auth) { color: var(--phone-ink-warning) !important; }
body.phone-device .win-body :is(.cl-group-title,.cl-where,.pair-detail-toggle,.wh-detail-toggle,.alerts-desktop,.alerts-explain b,.alerts-mode.thr,.alerts-card-ico,.alert-ico,.os-schead a,.oc-eyebrow,.oc-source.lookup,.oc-metric .cyan,.oc-section-head,.oc-icon-btn,.oc-text-btn,.oc-section-head button,.oc-tabs button:not(.active),.oc-live-actions button,.oc-bd-summary strong:not(.good):not(.warn):not(.bad),.shop-balance-n,.shop-notice,.chat-room-name,.chat-room-tab.active,.calc-result:not(.good):not(.bad):not(.warn) strong,.calc-section-title,.calc-basic-guide,.calc-keypad button.operator,.calc-detail-toggle,.calc-token-identity button,.calc-token-select button,.compare-toolbar>div b,.rd-tabs button.active) { color: var(--phone-ink-link) !important; }
body.phone-device .win-body .chat-room-tab.active { background: var(--surface-2); }
body.phone-device .win-body .rd-error { background: var(--surface-2); color: var(--phone-ink-warning); border-color: var(--phone-ink-warning); }
body.phone-device .win-body .rd-locked { color: var(--text-muted); }
body.phone-device .win-body .os-declined b { color: var(--phone-ink-warning); }
body.phone-device .win-body .os-declined p { color: var(--text-muted); }
body.phone-device .win-body :is(.calc-token-select select,.compare-scale select) { background: var(--surface-2); color: var(--text-main); }
body.phone-device .win-body .ai-tier-btn.active,
body.phone-device [data-type="files"] .option-pill.active { color: #fff; }
/* iPhone WebKit's native select ignored min-height and painted a 23–28px
   control. Keep the native select/picker, set its actual box, and draw a visible
   chevron after removing only the undersized platform appearance. */
body.phone-device .win-body select {
  -webkit-appearance: none;
  appearance: none;
  height: var(--phone-target) !important;
  line-height: normal;
  padding-right: 28px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%2363748c' stroke-width='2'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 12px 8px !important;
}
body.phone-device .win-body :is(input,textarea)::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* Preserve the calculator renderer's live result states. These specific rules
   map its inline brand colors after the default text ink, including Safari
   and Chromium serialization of the medium-leverage orange warning. */
body.phone-device .win-body .calc-screen strong { color: var(--phone-ink-link) !important; }
body.phone-device .win-body .calc-screen strong[style*="--accent-green"] { color: var(--phone-ink-positive) !important; }
body.phone-device .win-body .calc-screen strong[style*="--accent-red"] { color: var(--phone-ink-negative) !important; }
body.phone-device .win-body .calc-screen strong:is([style*="#ffab40"],[style*="rgb(255, 171, 64)"]) { color: var(--phone-ink-caution) !important; }
body.phone-device [data-type="newcoin"] .win-body > div:first-child > span[style*="--accent-cyan"] { color: var(--phone-ink-link) !important; }
