/* ==========================================================================
   Mobile Settings v2 — collapsible sections, iOS-native toggles.
   ========================================================================== */

@media (max-width: 767px) {

  .msv-wrap {
    /* binary-hatching-pearl D2 (2026-05-09): L/R floor removed per Iron-Law
       class fix — env safe-area only. */
    padding: 14px env(safe-area-inset-right, 0px)
             calc(80px + env(safe-area-inset-bottom, 0px))
             env(safe-area-inset-left, 0px);
    background: #0a2e2e;
    color: #e0e0e8;
    min-height: 100%;
  }

  .msv-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: env(safe-area-inset-top, 0px) 0 12px;
  }

  /* Greg G-155 (FergiPhone 2026-10-24) — the G-146 shape, on Settings: the cards ran to the glass (no side gutter),
     the header added the notch a second time (.main-content already sits below the band — the same double count
     Library removed 2026-05-14), the light page showed as a strip under the band, and the room's own "Settings"
     repeated the band's title flush at x 0. A 12 px gutter; no second notch; the title for screen readers only. */
  .msv-wrap { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .msv-header { padding-top: 0; justify-content: flex-end; }
  .msv-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  body[data-modal-palette="settings"] { background: #0a2e2e; }

  .msv-title {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 24px;
    font-weight: 700;
  }

  .msv-tier-chip {
    background: rgba(109, 212, 212, 0.18);
    color: #6DD4D4;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
  }

  /* Section card */
  .msv-section {
    background: #0f3636;
    border: 1px solid #1a5252;
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
  }

  .msv-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    appearance: none;
    background: transparent;
    border: 0;
    color: #e0e0e8;
    text-align: left;
    padding: 14px 16px;
    min-height: 52px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .msv-section-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 17px;
    font-weight: 700;
  }

  .msv-section-chevron {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6f7d85;
    transition: transform 0.2s ease;
  }

  .msv-collapsed .msv-section-chevron { transform: rotate(-90deg); }

  .msv-section-body {
    border-top: 1px solid #1a5252;
    padding: 4px 4px 8px;
  }

  .msv-collapsed .msv-section-body { display: none; }

  /* Row */
  .msv-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    min-height: 56px;
    border-bottom: 1px solid rgba(26, 82, 82, 0.5);
  }

  .msv-row:last-child { border-bottom: 0; }

  .msv-row-main {
    flex: 1;
    min-width: 0;
  }

  .msv-row-label {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e8;
    line-height: 1.3;
  }

  .msv-row-hint {
    margin-top: 3px;
    font-size: 12px;
    color: #7d8a92;
    line-height: 1.4;
  }

  .msv-row-value {
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .msv-readonly {
    color: #a8b0b8;
    font-size: 13px;
    font-weight: 500;
  }

  .msv-muted {
    color: #6f7d85;
    font-size: 13px;
  }

  /* iOS-style toggle */
  .msv-toggle {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
  }

  .msv-toggle input { display: none; }

  .msv-toggle-track {
    position: absolute;
    inset: 0;
    background: #3a4a52;
    border-radius: 31px;
    transition: background 0.2s ease;
  }

  .msv-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    border-radius: 27px;
    background: #fff;
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  }

  .msv-toggle input:checked + .msv-toggle-track { background: #34c759; }

  .msv-toggle input:checked + .msv-toggle-track .msv-toggle-thumb {
    transform: translateX(20px);
  }

  /* Action rows */
  .msv-action-row {
    display: flex;
    gap: 10px;
    padding: 10px 14px 14px;
  }

  .msv-btn-primary,
  .msv-btn-secondary {
    appearance: none;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    min-height: 44px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    flex: 1;
  }

  .msv-btn-primary {
    background: #6DD4D4;
    color: #0a2e2e;
  }

  .msv-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e8;
    border: 1px solid #1a5252;
  }

  .msv-btn-primary:active { transform: scale(0.98); }
  .msv-btn-secondary:active { transform: scale(0.98); }

  .msv-fineprint {
    padding: 10px 14px 12px;
    color: #7d8a92;
    font-size: 11px;
    font-style: italic;
  }
}
