@media (max-width: 979px) {
  /* DARK (default) */
  html.web-shell {
    /* Midnight navy — same palette as the web app (owner 2026-09-26, after
       trying CoinMarketCap's phone slate #171923 / #222530). Originally
       near-black #0a0b0e / #111318. */
    --mws-bg: #0d1421;
    --mws-bg-2: #111a2a;
    --mws-card: #171f30;
    --mws-well: #1d2638;
    --mws-line: #26314a;
    --mws-line-2: #1f2940;
    --mws-line-strong: #313d58;
    --mws-ink: #eef2f7;
    --mws-ink-2: #a7b1c2;
    --mws-ink-3: #7d889c;
    --mws-hero-a: #1c2740;
    --mws-hero-b: #151e30;
    --mws-gold: #f0b90b;
    --mws-gold-2: #fcd535;
    --mws-up: #20c775;
    --mws-down: #ea3943;
    --mws-demo: #8b7bff;
    --mws-shadow: none;
    --mws-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --success: #20c775;
    --danger: #ea3943;
  }
  /* LIGHT — same palette family as the app's light theme (styles.css
     html[data-theme="light"]), so the phone shell follows the Theme
     picker in Preferences (owner request 2026-09-22). Gold stays the
     brand accent; green/red darken for contrast on white. */
  html.web-shell[data-theme="light"] {
    --mws-bg: #f7f8fa;
    --mws-bg-2: #ffffff;
    --mws-card: #ffffff;
    --mws-well: #f2f4f7;
    --mws-line: #e4e7ec;
    --mws-line-2: #eceff3;
    --mws-line-strong: #d5dae2;
    --mws-ink: #1e2329;
    --mws-ink-2: #5b6573;
    --mws-ink-3: #848e9c;
    --mws-hero-a: #ffffff;
    --mws-hero-b: #f7f9fc;
    --mws-gold: #b47c07;
    --mws-gold-2: #f0b90b;
    --mws-up: #12925a;
    --mws-down: #cf3038;
    --mws-demo: #6b5bd6;
    --mws-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    --success: #12925a;
    --danger: #cf3038;
  }
  /* The status-bar inset is carried by .app-header alone. styles.css
     also pads <body> with it, which in the INSTALLED (standalone) app
     stacked two insets and left a ~47px dead strip above the header —
     invisible in a browser tab, where the inset is 0 (owner report
     2026-09-22). Telegram keeps the body padding (no .web-shell). */
  html.web-shell body { font-family: var(--font); color: var(--mws-ink); padding-top: 0; }
  html.web-shell main#app { padding-left: 16px; padding-right: 16px; }

  /* ------------------------------------------------------------ header */
  html.web-shell .app-header {
    height: calc(60px + env(safe-area-inset-top, 0));
    padding: env(safe-area-inset-top, 0) 16px 0 16px;
    gap: 12px;
    border-bottom: 1px solid var(--mws-line-2);
  }
  html.web-shell .app-header .header-spacer { display: none; }
  html.web-shell .app-header h1 {
    flex: 1 1 auto; min-width: 0;
    font-size: 18px; font-weight: 800; letter-spacing: -0.01em;
    text-align: left; justify-content: flex-start;
    display: flex; align-items: center; gap: 10px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* Home wordmark: gold rounded square with the trend line + white name */
  html.web-shell .app-header h1.logo {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--mws-ink);
    filter: none;
    font-size: 17px;
    gap: 10px;
  }
  html.web-shell .app-header h1.logo::before {
    width: 28px; height: 28px; border-radius: 8px;
    box-shadow: none;
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M3 17 L9 11 L13 14 L21 5' stroke='%230a0b0e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 15px 15px no-repeat,
      linear-gradient(135deg, #fcd535, #f0b90b);
  }
  html.web-shell .app-header h1 .mws-ht-badge { flex-shrink: 0; }

  /* square back button with a chevron (the ← glyph is hidden) */
  html.web-shell #back-btn {
    width: 36px; height: 36px; flex: 0 0 36px;
    border-radius: 10px;
    background: var(--mws-card);
    border: 1px solid var(--mws-line);
    font-size: 0; color: var(--mws-ink);
    display: inline-flex; align-items: center; justify-content: center;
  }
  html.web-shell #back-btn.hidden { display: none !important; }
  html.web-shell #back-btn::before {
    content: ""; width: 18px; height: 18px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  /* right slot: tz pill, bell, gear, captions */
  html.web-shell .mws-hdr-r {
    margin-left: auto; flex-shrink: 0;
    display: flex; align-items: center; gap: 8px;
  }
  html.web-shell .mws-hdr-r:empty { display: none; }
  html.web-shell .mws-tzpill {
    font-family: var(--mws-mono); font-size: 10.5px; color: var(--mws-ink-3);
    border: 1px solid var(--mws-line); border-radius: 999px; padding: 5px 10px;
  }
  html.web-shell .mws-hdr-btn {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--mws-card); border: 1px solid var(--mws-line);
    color: var(--mws-ink-2); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0;
  }
  html.web-shell .mws-hdr-cap {
    font-family: var(--mws-mono); font-size: 10.5px; letter-spacing: 0.08em;
    color: var(--mws-ink-3); text-transform: uppercase;
  }
  html.web-shell .mws-hdr-cap.up { color: var(--mws-up); }
  html.web-shell .mws-hdr-cap.down { color: var(--mws-down); }


  /* bottom tab bar — board icon set (trend · cube · gem · bars · shield)
     drawn as CSS masks so the shared nav markup stays untouched */
  html.web-shell .bottom-nav .nav-dot { display: none; }
  html.web-shell .bottom-nav .nav-icon svg { display: none; }
  html.web-shell .bottom-nav .nav-icon::before {
    content: ""; display: block; width: 22px; height: 22px; background: currentColor;
    -webkit-mask: var(--mws-nav-ic) center / contain no-repeat;
            mask: var(--mws-nav-ic) center / contain no-repeat;
  }
  html.web-shell .nav-btn[data-route="dashboard"] { --mws-nav-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17 L9 11 L13 14 L21 5'/%3E%3C/svg%3E"); }
  html.web-shell .nav-btn[data-route="portfolio"] { --mws-nav-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 3 7.5v9L12 21l9-4.5v-9z'/%3E%3Cpath d='M3 7.5 12 12l9-4.5M12 12v9'/%3E%3C/svg%3E"); }
  html.web-shell .nav-btn[data-route="wallet"] { --mws-nav-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h12l4 6-10 12L2 9z'/%3E%3Cpath d='M2 9h20'/%3E%3Cpath d='M12 3 8 9l4 12 4-12z'/%3E%3C/svg%3E"); }
  html.web-shell .nav-btn[data-route="simulator"] { --mws-nav-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20v-6M9 20V10M14 20V6M19 20v-8'/%3E%3C/svg%3E"); }
  html.web-shell .nav-btn[data-route="profile"] { --mws-nav-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 4 6v6c0 4.5 3.4 8.2 8 9 4.6-.8 8-4.5 8-9V6z'/%3E%3C/svg%3E"); }

  /* tab-bar typography is theme-independent (the dark colour rules in
     styles.css are gated to dark, so restate the type here) */
  html.web-shell .bottom-nav .nav-btn .nav-label {
    font-family: var(--mws-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  html.web-shell[data-theme="light"] .nav-btn { color: var(--mws-ink-3); }
  html.web-shell[data-theme="light"] .nav-btn.active { color: #8a5e00; }
  html.web-shell[data-theme="light"] .app-header h1.logo { color: var(--mws-ink); }
  html.web-shell[data-theme="light"] #back-btn,
  html.web-shell[data-theme="light"] .mws-hdr-btn {
    background: var(--mws-card); border-color: var(--mws-line); color: var(--mws-ink);
  }

  /* breadcrumbs never show on this surface (JS also skips them) */
  html.web-shell #breadcrumbs { display: none !important; }
  /* desktop topbar widgets injected into the header stay hidden */
  html.web-shell .app-header .tfx-topbar-extra { display: none !important; }

  /* -------------------------------------------------------- page frame */
  html.web-shell .mws-page {
    display: flex; flex-direction: column; gap: 14px;
    padding-top: 14px; padding-bottom: 28px;
  }
  html.web-shell .mws-page > .card { margin: 0; }

  /* ---------------------------------------------------- shared pieces */
  html.web-shell .mws-card {
    background: var(--mws-card); border: 1px solid var(--mws-line);
    border-radius: 16px; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
  }
  html.web-shell .mws-card.tight { gap: 0; }
  html.web-shell .mws-lbl {
    font-family: var(--mws-mono); font-size: 10px; letter-spacing: 0.14em;
    color: var(--mws-ink-3); text-transform: uppercase;
  }
  html.web-shell .mws-mono { font-family: var(--mws-mono); }
  html.web-shell .mws-up { color: var(--mws-up) !important; }
  html.web-shell .mws-down { color: var(--mws-down) !important; }
  html.web-shell .mws-dim { color: var(--mws-ink-3); }
  /* key → value row (board "Buy size ....... $100") */
  html.web-shell .mws-kv {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; font-size: 14px; color: var(--mws-ink-2); min-height: 26px;
  }
  html.web-shell .mws-kv .v {
    font-family: var(--mws-mono); font-weight: 600; color: var(--mws-ink);
    text-align: right;
  }
  html.web-shell .mws-hr { height: 1px; background: var(--mws-line-2); border: 0; margin: 0; }
  /* 2-up stat grid inside a card (HOLDING / AVG ENTRY …) */
  html.web-shell .mws-stats {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
  }
  html.web-shell .mws-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  html.web-shell .mws-stat .v {
    font-family: var(--mws-mono); font-size: 15px; font-weight: 600;
    color: var(--mws-ink); overflow-wrap: anywhere;
  }
  /* pills row + segmented control */
  html.web-shell .mws-chips { display: flex; gap: 8px; flex-wrap: wrap; }
  html.web-shell .mws-chip {
    font-family: var(--mws-mono); font-size: 11.5px;
    padding: 6px 14px; border-radius: 999px; cursor: pointer;
    background: transparent; border: 1px solid var(--mws-line);
    color: var(--mws-ink-3);
  }
  html.web-shell .mws-chip.on {
    background: rgba(240, 185, 11, 0.14); border-color: rgba(240, 185, 11, 0.35);
    color: var(--mws-gold); font-weight: 600;
  }
  html.web-shell .mws-pill.on { color: var(--mws-gold); }
  /* list rows (coin avatar · name/sub · right value) */
  html.web-shell .mws-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--mws-card); border: 1px solid var(--mws-line);
    border-radius: 16px; padding: 14px; cursor: pointer; min-width: 0;
  }
  html.web-shell .mws-row.static { cursor: default; }
  html.web-shell .mws-row .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
  html.web-shell .mws-row .nm {
    font-weight: 800; font-size: 14.5px;
    display: flex; align-items: center; gap: 7px; min-width: 0;
  }
  html.web-shell .mws-row .sub {
    font-family: var(--mws-mono); font-size: 11px; color: var(--mws-ink-3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  html.web-shell .mws-row .right {
    margin-left: auto; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  }
  html.web-shell .mws-row .right .v { font-family: var(--mws-mono); font-size: 14px; font-weight: 600; }
  html.web-shell .mws-row .right .cap { font-family: var(--mws-mono); font-size: 10.5px; color: var(--mws-ink-3); }
  /* section header row above a list */
  html.web-shell .mws-sec {
    display: flex; align-items: center; justify-content: space-between;
    margin: 4px 2px -2px 2px;
  }
  html.web-shell .mws-sec .sum { font-family: var(--mws-mono); font-size: 11px; }
  /* buttons: pill primary (gold) + outline secondary, full-width pairs */
  html.web-shell .mws-btns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
  html.web-shell .mws-btns.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.web-shell .mws-btn {
    height: 48px; border-radius: 999px; padding: 0 18px;
    font-family: var(--font); font-size: 14.5px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    cursor: pointer; white-space: nowrap;
    background: transparent; color: var(--mws-ink); border: 1px solid var(--mws-line-strong);
  }
  html.web-shell .mws-btn.gold {
    background: linear-gradient(180deg, #fcd535 0%, #f0b90b 100%);
    color: #1a1206; border: 0;
    box-shadow: 0 8px 30px -8px rgba(240, 185, 11, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  }
  html.web-shell .mws-btn.danger { color: var(--mws-down); border-color: rgba(234, 57, 67, 0.4); }
  html.web-shell .mws-btn.up { color: var(--mws-up); border-color: rgba(32, 199, 117, 0.4); }
  html.web-shell .mws-btn.block { width: 100%; }
  html.web-shell .mws-btn:disabled { opacity: 0.5; cursor: default; }
  html.web-shell .mws-link {
    background: none; border: 0; padding: 0; cursor: pointer;
    font-size: 12.5px; font-weight: 700; color: var(--mws-gold);
  }
  html.web-shell .mws-link.danger { color: var(--mws-down); }
  /* badges */
  html.web-shell .mws-badge {
    font-family: var(--mws-mono); font-size: 9.5px; font-weight: 700;
    padding: 2px 7px; border-radius: 6px; letter-spacing: 0.04em;
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  }
  html.web-shell .mws-badge.live, html.web-shell .mws-badge.up { color: var(--mws-up); background: rgba(32, 199, 117, 0.12); }
  html.web-shell .mws-badge.down { color: var(--mws-down); background: rgba(234, 57, 67, 0.12); }
  html.web-shell .mws-badge.gold { color: var(--mws-gold); background: rgba(240, 185, 11, 0.12); }
  html.web-shell .mws-badge.demo { color: var(--mws-demo); background: rgba(139, 123, 255, 0.14); }
  html.web-shell .mws-badge.off { color: var(--mws-ink-3); background: var(--mws-well); }
  html.web-shell .mws-badge.line { background: transparent; border: 1px solid currentColor; }
  /* icon square (list leading icon) */
  html.web-shell .mws-icosq {
    width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(240, 185, 11, 0.12); color: var(--mws-gold);
  }
  html.web-shell .mws-icosq.up { background: rgba(32, 199, 117, 0.12); color: var(--mws-up); }
  html.web-shell .mws-icosq.down { background: rgba(234, 57, 67, 0.12); color: var(--mws-down); }
  /* switch (use on <input type=checkbox class="mws-switch">) */
  html.web-shell input[type="checkbox"].mws-switch,
  html.web-shell .mws-switch-host input[type="checkbox"] {
    -webkit-appearance: none; appearance: none;
    width: 36px; height: 20px; border-radius: 999px; flex-shrink: 0;
    background: var(--mws-well); border: 1px solid var(--mws-line);
    position: relative; cursor: pointer; margin: 0;
    transition: background .15s, border-color .15s;
  }
  html.web-shell input[type="checkbox"].mws-switch::after,
  html.web-shell .mws-switch-host input[type="checkbox"]::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--mws-ink-3); transition: transform .15s, background .15s;
  }
  html.web-shell input[type="checkbox"].mws-switch:checked,
  html.web-shell .mws-switch-host input[type="checkbox"]:checked {
    background: rgba(32, 199, 117, 0.25); border-color: rgba(32, 199, 117, 0.45);
  }
  html.web-shell input[type="checkbox"].mws-switch:checked::after,
  html.web-shell .mws-switch-host input[type="checkbox"]:checked::after {
    transform: translateX(16px); background: var(--mws-up);
  }
  /* compact right-aligned input well (board "Buy size [$100]") */
  html.web-shell .mws-inwell {
    height: 38px; min-width: 64px; max-width: 150px; box-sizing: border-box;
    background: var(--mws-bg); border: 1px solid var(--mws-line);
    border-radius: 10px; padding: 0 12px;
    font-family: var(--mws-mono); font-size: 14px; font-weight: 600;
    color: var(--mws-ink); text-align: right;
  }
  html.web-shell .mws-inwell:focus { outline: none; border-color: rgba(240, 185, 11, 0.5); }
  /* area chart (kit._mwsAreaChart) */
  html.web-shell .mws-chart svg { display: block; }
  html.web-shell .mws-chart.empty {
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--mws-ink-3);
    border: 1px dashed var(--mws-line); border-radius: 12px;
  }
  /* empty / note text */
  html.web-shell .mws-note { font-size: 12px; color: var(--mws-ink-3); text-align: center; line-height: 1.5; }
  html.web-shell .mws-empty {
    padding: 28px 16px; text-align: center; color: var(--mws-ink-3); font-size: 13px;
    border: 1px dashed var(--mws-line); border-radius: 16px;
  }

  /* ------------------------------------------ legacy pieces, restyled
     Screens that still embed shared cards (info toggles, market card,
     modals, forms) get the board language here so nothing reads as the
     old Telegram look. */
  html.web-shell .card h2,
  html.web-shell .card > h3 {
    font-family: var(--mws-mono); font-size: 10.5px; font-weight: 500;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--mws-ink-3);
  }
  html.web-shell .card .kv { border-color: var(--mws-line-2); }
  html.web-shell .card .kv .k { color: var(--mws-ink-2); }
  html.web-shell .card .kv .v { font-family: var(--mws-mono); font-weight: 600; }
  html.web-shell .stat-grid .stat {
    background: var(--mws-well); border: 1px solid var(--mws-line); border-radius: 12px;
  }
  html.web-shell .stat-grid .stat .label {
    font-family: var(--mws-mono); font-size: 9.5px; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--mws-ink-3);
  }
  html.web-shell .stat-grid .stat .value { font-family: var(--mws-mono); font-weight: 600; }
  html.web-shell .positive { color: var(--mws-up); }
  html.web-shell .negative { color: var(--mws-down); }
  html.web-shell .modal,
  html.web-shell .modal-card,
  html.web-shell .sheet {
    background: var(--mws-card); border: 1px solid var(--mws-line);
    border-radius: 20px; color: var(--mws-ink);
  }
  html.web-shell .toast {
    background: var(--mws-well); border: 1px solid var(--mws-line);
    color: var(--mws-ink); border-radius: 14px;
  }

  /* ---- Home/Wallet/Portfolio/Profile (app.js renderers) refinements */
  html.web-shell .mws-chev { color: var(--mws-ink-3); font-size: 20px; line-height: 1; margin-left: auto; transition: transform .15s; }
  html.web-shell .mws-chev.open { transform: rotate(90deg); }
  html.web-shell .mws-pcard { cursor: pointer; }
  html.web-shell .mws-setlist { padding: 4px 16px; }
  html.web-shell .mws-setrow {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 50px; font-size: 14px; color: var(--mws-ink-2); cursor: pointer;
  }
  html.web-shell .mws-setrow + .mws-setrow { border-top: 1px solid var(--mws-line-2); }
  html.web-shell .mws-pbot .rt { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
  html.web-shell .mws-pbot .rt .v { font-family: var(--mws-mono); font-size: 14px; font-weight: 600; }
  html.web-shell .mws-pbot .rt .cap { font-family: var(--mws-mono); font-size: 10px; color: var(--mws-ink-3); }
  html.web-shell .mws-pbot.demo { border-color: rgba(139, 123, 255, 0.35); }
  html.web-shell .mws-pbot .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.web-shell .mws-hdr-r .mws-seg .s { padding: 5px 11px; }
  html.web-shell .mws-ptile { align-items: flex-start; text-align: left; }
  html.web-shell .mws-ptile svg { align-self: flex-start; }
  /* merged balance card: realized figures under a hairline (no tiles) */
  html.web-shell .mws-herosplit {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px; padding-top: 13px; margin-top: 2px;
    border-top: 1px solid var(--mws-line-2);
  }
  html.web-shell .mws-herostat { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
  html.web-shell .mws-herostat .v {
    font-family: var(--mws-mono); font-size: 17px; font-weight: 600;
  }
  html.web-shell .mws-herostat + .mws-herostat { padding-left: 14px; border-left: 1px solid var(--mws-line-2); }
  /* Home "Your bots": one card, hairline rows (web-app rhythm) */
  html.web-shell .mws-botlist { padding: 0; overflow: hidden; }
  html.web-shell .mws-botlist .mws-bot { padding: 13px 14px; border-radius: 0; }
  html.web-shell .mws-botlist .mws-bot + .mws-bot { border-top: 1px solid var(--mws-line-2); }
  html.web-shell .mws-botlist .mws-bot:active { background: var(--mws-well); }
  /* Wallet hero: SPOT / FUNDING / EARN columns (replaces the grey
     run-on line and the duplicate BALANCES card) */
  html.web-shell .mws-wsplit {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px; padding-top: 13px; border-top: 1px solid var(--mws-line-2);
  }
  html.web-shell .mws-wstat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  html.web-shell .mws-wstat .v {
    font-family: var(--mws-mono); font-size: 15px; font-weight: 600;
    color: var(--mws-ink); overflow-wrap: anywhere;
  }
  html.web-shell .mws-wstat .v.gain { color: var(--mws-up); }
  html.web-shell .mws-wstat .sub { font-size: 10.5px; color: var(--mws-ink-3); }
  /* No scrollbars on this surface — the pale indicator streaking down
     the right edge while scrolling looked like a glitch in the
     installed app (owner report 2026-09-22). Desktop keeps its
     scrollbars (this block is phone-width only). */
  html.web-shell, html.web-shell body,
  html.web-shell #app, html.web-shell .mws-page {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  html.web-shell::-webkit-scrollbar,
  html.web-shell body::-webkit-scrollbar,
  html.web-shell #app::-webkit-scrollbar,
  html.web-shell *::-webkit-scrollbar {
    width: 0; height: 0; display: none;
  }
  html.web-shell .mws-botlist .mws-pbot { padding: 13px 14px; border-radius: 0; border: 0; }
  html.web-shell .mws-botlist .mws-pbot + .mws-pbot { border-top: 1px solid var(--mws-line-2); }
  html.web-shell .mws-botlist .mws-pbot.demo .nm { color: var(--mws-ink); }
  html.web-shell .mws-botlist .mws-pbot:active { background: var(--mws-well); }
  html.web-shell .mws-erow .right .qty {
    font-family: var(--mws-mono); font-size: 10.5px; color: var(--mws-ink-3);
  }
  /* ---------------------------------------------------- LIGHT mode
     Everything above is token-driven, so light mostly "just works".
     These rules add what a light surface needs: soft card shadows
     instead of glow, a white header / tab bar, and readable pill
     buttons. Telegram and desktop are unaffected (scope unchanged). */
  html.web-shell[data-theme="light"] body { background: var(--mws-bg); }
  html.web-shell[data-theme="light"] .app-header,
  html.web-shell[data-theme="light"] .bottom-nav,
  html.web-shell[data-theme="light"] .bottom-nav--glass {
    background: var(--mws-bg-2);
    border-color: var(--mws-line);
  }
  html.web-shell[data-theme="light"] .card,
  html.web-shell[data-theme="light"] .mws-card,
  html.web-shell[data-theme="light"] .mws-row,
  html.web-shell[data-theme="light"] .mws-botlist {
    background: var(--mws-card);
    border-color: var(--mws-line);
    box-shadow: var(--mws-shadow);
  }
  html.web-shell[data-theme="light"] .mws-hero {
    background: linear-gradient(180deg, var(--mws-hero-a), var(--mws-hero-b));
  }
  html.web-shell[data-theme="light"] .mws-btn.gold,
  html.web-shell[data-theme="light"] .btn {
    box-shadow: 0 6px 18px -8px rgba(240, 185, 11, 0.55);
  }
  html.web-shell[data-theme="light"] .mws-chip.on,
  html.web-shell[data-theme="light"] .mws-seg .s.on,
  html.web-shell[data-theme="light"] .mws-pill.on {
    background: rgba(240, 185, 11, 0.18);
    border-color: rgba(240, 185, 11, 0.45);
    color: #8a5e00;
  }
  html.web-shell[data-theme="light"] .mws-badge.live,
  html.web-shell[data-theme="light"] .mws-badge.up { background: rgba(18, 146, 90, 0.12); }
  html.web-shell[data-theme="light"] .mws-badge.down { background: rgba(207, 48, 56, 0.12); }
  html.web-shell[data-theme="light"] .mws-badge.gold { background: rgba(240, 185, 11, 0.18); color: #8a5e00; }
  html.web-shell[data-theme="light"] .mws-badge.demo { background: rgba(107, 91, 214, 0.14); }
  html.web-shell[data-theme="light"] .mws-badge.off { background: var(--mws-well); }
  html.web-shell[data-theme="light"] .mws-icosq { background: rgba(240, 185, 11, 0.16); color: #8a5e00; }
  html.web-shell[data-theme="light"] .mws-switch,
  html.web-shell[data-theme="light"] .mws-switch-host input[type="checkbox"] { background: #dfe3ea; }
  html.web-shell[data-theme="light"] .mws-inwell { background: var(--mws-well); }
  html.web-shell[data-theme="light"] .mws-addcoin { border-color: var(--mws-line-strong); }
  /* legacy pieces harvested into phone screens */
  html.web-shell[data-theme="light"] .stat-grid .stat { background: var(--mws-well); }
  html.web-shell[data-theme="light"] .modal,
  html.web-shell[data-theme="light"] .modal-card,
  html.web-shell[data-theme="light"] .sheet,
  html.web-shell[data-theme="light"] .toast {
    background: var(--mws-card); border-color: var(--mws-line); color: var(--mws-ink);
  }
  /* button variants in light: same silhouette as dark (outline for
     secondary / danger; gold pill stays the only filled button) */
  html.web-shell[data-theme="light"] .btn.danger,
  html.web-shell[data-theme="light"] .mws-btn.danger {
    background: transparent; color: var(--mws-down);
    border: 1px solid rgba(207, 48, 56, 0.45); box-shadow: none;
  }
  html.web-shell[data-theme="light"] .btn.secondary,
  html.web-shell[data-theme="light"] .btn.ghost,
  html.web-shell[data-theme="light"] .mws-btn {
    background: transparent; color: var(--mws-ink);
    border: 1px solid var(--mws-line-strong); box-shadow: none;
  }
  html.web-shell[data-theme="light"] .mws-btn.gold {
    background: linear-gradient(180deg, #fcd535 0%, #f0b90b 100%);
    color: #1a1206; border: 0;
    box-shadow: 0 6px 18px -8px rgba(240, 185, 11, 0.55);
  }
  html.web-shell[data-theme="light"] .mws-btn.up {
    color: var(--mws-up); border-color: rgba(18, 146, 90, 0.45);
  }
  /* stat tiles carry a context line under the number */
  html.web-shell .mws-tile .sub {
    font-family: var(--mws-mono); font-size: 9.5px; line-height: 1.35;
    color: var(--mws-ink-3); margin-top: 1px;
  }
  html.web-shell .mws-tile .sub.mws-up { color: var(--mws-up) !important; opacity: .9; }
  html.web-shell .mws-tile .sub.mws-down { color: var(--mws-down) !important; opacity: .9; }
  html.web-shell .mws-tiles.three .mws-tile { padding: 12px 11px; }
  /* one card, three columns (Portfolio summary) */
  html.web-shell .mws-statcard {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0; padding: 16px 0;
  }
  html.web-shell .mws-scol {
    display: flex; flex-direction: column; gap: 5px;
    padding: 0 12px; min-width: 0;
  }
  html.web-shell .mws-scol + .mws-scol { border-left: 1px solid var(--mws-line-2); }
  html.web-shell .mws-scol .v {
    font-family: var(--mws-mono); font-size: 19px; font-weight: 600;
    letter-spacing: -0.01em; overflow-wrap: anywhere;
  }
  html.web-shell .mws-scol .sub {
    font-family: var(--mws-mono); font-size: 9.5px; color: var(--mws-ink-3);
  }
  html.web-shell .mws-scol .sub.mws-up { color: var(--mws-up) !important; opacity: .9; }
  html.web-shell .mws-scol .sub.mws-down { color: var(--mws-down) !important; opacity: .9; }
  /* bot age chip next to the coin name (Home / Portfolio rows) */
  html.web-shell .mws-age {
    font-family: var(--mws-mono); font-size: 9.5px; color: var(--mws-ink-3);
    border: 1px solid var(--mws-line); border-radius: 5px;
    padding: 1px 5px; white-space: nowrap; flex-shrink: 0;
  }
  /* one-time "add to home screen" nudge (iOS Safari, not installed) */
  html.web-shell .mws-a2hs {
    position: fixed; left: 12px; right: 12px; z-index: 60;
    bottom: calc(var(--nav-h, 64px) + 12px + env(safe-area-inset-bottom, 0));
    display: flex; align-items: center; gap: 12px;
    padding: 12px 12px 12px 14px; border-radius: 16px;
    background: var(--mws-card); border: 1px solid var(--mws-line);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.7);
  }
  html.web-shell[data-theme="light"] .mws-a2hs {
    box-shadow: 0 18px 40px -18px rgba(16, 24, 40, 0.35);
  }
  html.web-shell .mws-a2hs .ic { color: var(--mws-gold); display: inline-flex; flex-shrink: 0; }
  html.web-shell .mws-a2hs .tx { min-width: 0; flex: 1 1 auto; }
  html.web-shell .mws-a2hs .t { font-size: 13px; font-weight: 800; }
  html.web-shell .mws-a2hs .s { font-size: 11px; color: var(--mws-ink-3); margin-top: 2px; }
  html.web-shell .mws-a2hs .go {
    flex-shrink: 0; text-decoration: none; font-size: 12.5px; font-weight: 800;
    color: #1a1206; background: linear-gradient(180deg, #fcd535, #f0b90b);
    padding: 8px 14px; border-radius: 999px;
  }
  html.web-shell .mws-a2hs .x {
    flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
    background: transparent; border: 0; color: var(--mws-ink-3);
    font-size: 19px; line-height: 1; cursor: pointer;
  }
  /* Markets: segment + price rows */
  html.web-shell .mwm-seg { margin-bottom: 2px; }
  html.web-shell .mwm-prow .right .v { font-family: var(--mws-mono); font-size: 13.5px; font-weight: 600; }
  html.web-shell .mwm-prow .right .cap { font-family: var(--mws-mono); font-size: 10.5px; }
  html.web-shell .mwm-rank {
    font-family: var(--mws-mono); font-size: 11px; color: var(--mws-ink-3);
    min-width: 16px; text-align: right; flex-shrink: 0;
  }
  html.web-shell .mwm-chg { font-size: 10.5px; padding: 2px 7px; }
  html.web-shell .mwm-phead {
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px 2px; font-family: var(--mws-mono); font-size: 9.5px;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--mws-ink-3);
  }
  html.web-shell .mwm-phead .c { flex: 1 1 auto; padding-left: 34px; }
  /* 44px = the row's star button (32px) + its 12px gap, so the header
     label sits over the price column, not over the star. */
  html.web-shell .mwm-phead .r { margin-left: auto; margin-right: 44px; }
  /* 1h / 24h / 7d switch in the Prices header. */
  html.web-shell .mwm-per { display: inline-flex; gap: 2px; padding: 2px;
    border: 1px solid var(--mws-line); border-radius: 8px; }
  html.web-shell .mwm-per .p {
    font: 600 10px/1 var(--mws-mono); letter-spacing: 0.04em; text-transform: none;
    color: var(--mws-ink-3); background: transparent; border: 0;
    padding: 5px 8px; border-radius: 6px; cursor: pointer; min-height: 24px;
  }
  html.web-shell .mwm-per .p.on { color: var(--mws-gold); background: rgba(240, 185, 11, 0.14); }
  /* 7-day sparkline between the coin and its price. */
  html.web-shell .mwm-spark { flex-shrink: 0; width: 52px; height: 24px; display: block; opacity: 0.9; }
  html.web-shell .mwm-spark svg { display: block; }
  @media (max-width: 369px) { html.web-shell .mwm-spark { display: none; } }
  /* Watchlist star on each price row + the ★ Watchlist filter chip */
  html.web-shell .mwm-star {
    flex-shrink: 0; width: 32px; height: 32px; margin: -6px -8px -6px -4px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0; border-radius: 9px; cursor: pointer;
    color: var(--mws-ink-3);
  }
  html.web-shell .mwm-star:active { background: var(--mws-well); }
  html.web-shell .mwm-star.on { color: var(--mws-gold-2); }
  html.web-shell .mwm-star.on svg { fill: currentColor; }
  html.web-shell .mwm-wchip .st { display: inline-flex; }
  html.web-shell .mwm-wchip .st svg { width: 13px; height: 13px; }
  html.web-shell .mwm-wchip.on .st svg { fill: currentColor; }
  html.web-shell .mwm-chipsep {
    flex-shrink: 0; width: 1px; align-self: center; height: 18px;
    background: var(--mws-line); margin: 0 2px;
  }
  html.web-shell[data-theme="light"] .mwm-star.on { color: var(--mws-gold-2); }
  /* Profile's Sign out: full-width row button (look comes from the
     house button rule at the end of this file). */
  html.web-shell .mws-signout { width: 100%; height: 48px; font-size: 15px; }
  /* Sideways drags belong to the swipe-back gesture; vertical scrolling
     stays with the browser. Without this iOS claims the horizontal
     movement and cancels the pointer sequence mid-gesture. */
  html.web-shell main#app { touch-action: pan-y; }
}

/* ================================================================
 * House button (owner's chosen style, 2026-09-23): rounded rectangle,
 * soft fill + thin border + text in the button's own colour, no glow.
 * Covers every phone button family — shell .mws-btn, the older shared
 * .btn (dialogs, forms, harvested screens) and the Markets .mmc-btn.
 * Sets LOOK only (radius, fill, border, text colour, shadow) — never
 * size, so no layout moves. ``:not(#_)`` lifts specificity above the
 * older pill rules (styles.css phone block, light-theme overrides)
 * without !important. Phone shell only: Telegram and desktop keep
 * their own buttons.
 * ================================================================ */
@media (max-width: 979px) {
  html.web-shell {
    --hb-gold: #f0b90b; --hb-gold-bg: rgba(240, 185, 11, 0.10); --hb-gold-bd: rgba(240, 185, 11, 0.32);
    --hb-red: var(--mws-down); --hb-red-bg: rgba(234, 57, 67, 0.10); --hb-red-bd: rgba(234, 57, 67, 0.30);
    --hb-green: var(--mws-up); --hb-green-bg: rgba(32, 199, 117, 0.10); --hb-green-bd: rgba(32, 199, 117, 0.30);
    --hb-ink: var(--mws-ink); --hb-ink-bg: rgba(255, 255, 255, 0.04); --hb-ink-bd: var(--mws-line-strong);
  }
  html.web-shell[data-theme="light"] {
    --hb-gold: #9a6a05; --hb-gold-bg: rgba(180, 124, 7, 0.09); --hb-gold-bd: rgba(180, 124, 7, 0.34);
    --hb-red-bg: rgba(207, 48, 56, 0.07); --hb-red-bd: rgba(207, 48, 56, 0.30);
    --hb-green-bg: rgba(18, 146, 90, 0.08); --hb-green-bd: rgba(18, 146, 90, 0.30);
    --hb-ink-bg: rgba(16, 24, 40, 0.03);
  }
  /* shape + neutral default */
  html.web-shell .mws-btn:not(#_),
  html.web-shell .btn:not(#_),
  html.web-shell .mmc-btn:not(#_) {
    border-radius: 12px; box-shadow: none; background-image: none;
    background-color: var(--hb-ink-bg); color: var(--hb-ink);
    border: 1px solid var(--hb-ink-bd);
  }
  /* gold = the main action */
  html.web-shell .mws-btn.gold:not(#_),
  html.web-shell .mws-btn.mwk-useline:not(#_),
  html.web-shell .btn:not(.ghost):not(.secondary):not(.danger):not(.success):not(#_),
  html.web-shell .mmc-btn.pri:not(#_) {
    background-color: var(--hb-gold-bg); color: var(--hb-gold); border-color: var(--hb-gold-bd);
  }
  /* red = destructive */
  html.web-shell .mws-btn.danger:not(#_),
  html.web-shell .btn.danger:not(#_) {
    background-color: var(--hb-red-bg); color: var(--hb-red); border-color: var(--hb-red-bd);
  }
  /* green = start / confirm */
  html.web-shell .mws-btn.up:not(#_),
  html.web-shell .btn.success:not(#_) {
    background-color: var(--hb-green-bg); color: var(--hb-green); border-color: var(--hb-green-bd);
  }
  html.web-shell .mws-btn:not(#_):active,
  html.web-shell .btn:not(#_):active,
  html.web-shell .mmc-btn:not(#_):active { filter: brightness(1.18); }
}

