/* Dedicated Mobile & Tablet Art Direction (<= 979px / <= 768px / <= 640px)
   Loaded LAST after site.css, orbit.css, and modularity.css.
   ALL rules are strictly scoped to mobile/tablet media queries so Desktop (>= 980px) stays 100% untouched. */

/* ============================================================================
   1. TABLET & MOBILE CHROME (<= 979px): Whisper-clean smoked-glass navbar & drawer
   ============================================================================ */
@media (max-width: 979px) {
  html {
    scroll-padding-top: 4.1rem;
  }

  /* Kill the deep -3.25rem desktop feather veil that fogged out mobile hero/section headings */
  .nav {
    background: color-mix(in oklab, var(--background) 84%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(165%);
    backdrop-filter: blur(20px) saturate(165%);
    border-bottom: 1px solid color-mix(in oklab, var(--border) 72%, transparent);
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
  }
  .nav::before {
    display: none;
  }
  [data-theme="dark"] .nav {
    background: color-mix(in oklab, #0c0d0f 82%, transparent);
    border-bottom-color: rgba(255, 255, 255, 0.075);
  }
  html.nav-locked .nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--background);
    border-bottom-color: var(--divider);
  }

  .nav .wrap {
    height: 3.4rem;
    gap: 0.5rem;
    padding-left: max(1.15rem, env(safe-area-inset-left));
    padding-right: max(1.15rem, env(safe-area-inset-right));
  }
  .nav-brand {
    font-size: 1.16rem;
    min-height: 2.4rem;
    letter-spacing: -0.028em;
  }
  .nav-brand.wordmark-lockup {
    gap: 0.4rem;
  }
  .nav-brand .brand-mark {
    width: 1.42rem;
    height: 1.42rem;
  }

  .nav-end {
    gap: 0.28rem;
  }

  /* Quiet, borderless icon-only theme button */
  .nav .theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    background: transparent;
    color: var(--muted-foreground);
  }
  .nav .theme-toggle:hover,
  .nav .theme-toggle:active {
    background: var(--surface);
    border-color: transparent;
    color: var(--foreground);
  }
  .nav .theme-toggle svg {
    width: 0.96rem;
    height: 0.96rem;
  }

  /* Understated, compact Download pill — never loud teal fighting the Hero CTA */
  .nav .btn-primary.btn-sm.nav-dl,
  [data-theme="dark"] .nav .btn-primary.btn-sm.nav-dl {
    height: 1.98rem;
    padding: 0 0.78rem;
    font-size: 0.78rem;
    font-weight: 560;
    letter-spacing: -0.01em;
    background: var(--surface);
    color: var(--foreground);
    border: 1px solid var(--border-strong);
    box-shadow: none;
  }
  .nav .btn-primary.btn-sm.nav-dl:hover,
  [data-theme="dark"] .nav .btn-primary.btn-sm.nav-dl:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
  }

  /* Frameless Apple / Linear 2-line hamburger (no clunky dark circle border) */
  .nav-menu-btn {
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--foreground);
  }
  .nav-menu-btn:hover,
  .nav-menu-btn:active {
    background: var(--surface);
    border-color: transparent;
  }
  .nav-menu-bars {
    width: 1.05rem;
    height: 0.44rem;
  }
  .nav-menu-bars i {
    height: 1.5px;
  }
  .nav-menu-bars i:first-child { top: 0; }
  .nav-menu-bars i:last-child { bottom: 0; }

  /* Rock-solid frosted navigation sheet (high contrast, zero ghost bleed-through) */
  .nav-drawer-backdrop {
    background: rgba(6, 8, 10, 0.52);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  [data-theme="dark"] .nav-drawer-backdrop {
    background: rgba(0, 0, 0, 0.72);
  }
  .nav-drawer-panel {
    padding: calc(3.4rem + env(safe-area-inset-top) + 0.65rem) max(1.25rem, env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
    background: var(--background);
    border-bottom: 1px solid var(--border);
    border-radius: 0 0 24px 24px;
    box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.28);
  }
  [data-theme="dark"] .nav-drawer-panel {
    background: #0e1014;
    border-bottom-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 28px 72px -12px rgba(0, 0, 0, 0.85);
  }
  .nav-drawer-links a {
    min-height: 3rem;
    padding: 0.4rem 0.1rem;
    font-size: 1.05rem;
    font-weight: 520;
    letter-spacing: -0.02em;
  }
  .nav-drawer-links svg {
    width: 0.92rem;
    height: 0.92rem;
    opacity: 0.45;
  }
  .nav-drawer-prefs {
    margin-top: 1rem;
    padding-top: 1rem;
    gap: 0.75rem;
  }
  .nav-drawer-label {
    font-size: 0.66rem;
    letter-spacing: 0.08em;
  }
  .nav-seg {
    padding: 0.18rem;
  }
  .nav-seg button,
  .nav-seg a {
    min-height: 2.15rem;
    font-size: 0.8rem;
  }
  .nav-drawer-actions {
    margin-top: 1.15rem;
    gap: 0.55rem;
  }
  .nav-drawer-actions .btn-lg {
    height: 2.75rem;
    font-size: 0.88rem;
  }
  .nav-drawer-meta {
    margin-top: 0.85rem;
    padding-top: 0.55rem;
    gap: 1.5rem;
  }
  .nav-drawer-meta a {
    min-height: 2.25rem;
    font-size: 0.82rem;
  }
}

/* ============================================================================
   2. TABLET + MOBILE EDITORIAL SYSTEMS (<= 959px)
   ============================================================================ */
@media (max-width: 959px) {
  /* Collapse empty architecture placeholder gracefully until populated */
  #architecture:empty {
    padding: 0;
    border: 0;
    margin: 0;
  }

  /* ----- Act 2 (#practice): Apple underlined Subject tabs + tidy wrapped Card Type chips ----- */
  .ex-playground {
    gap: 1rem;
  }
  .ex-rail {
    gap: 0.8rem;
    padding-bottom: 0.95rem;
    border-bottom: 1px solid var(--divider);
  }
  .ex-rail-group {
    gap: 0.35rem;
  }
  .ex-rail-label {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    opacity: 0.72;
  }

  /* Replace chunky bordered oval pills with crisp Apple/Linear underlined text tabs */
  .ex-rail .pill-tabs {
    gap: 1.2rem;
    border-bottom: 1px solid var(--divider);
    padding-top: 0;
    padding-bottom: 0;
  }
  .ex-rail .pill-tabs button {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--muted-foreground);
    min-height: 2.35rem;
    padding: 0.42rem 0 0.58rem;
    margin-bottom: -1px;
    font-size: 0.86rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
  }
  .ex-rail .pill-tabs button:hover {
    background: transparent;
    color: var(--foreground);
  }
  .ex-rail .pill-tabs button[aria-selected="true"] {
    background: transparent;
    color: var(--foreground);
    border-bottom-color: var(--foreground);
    font-weight: 600;
  }

  /* Card types: clean wrapped soft micro-chips (ZERO clipped oval rings, zero double scroll rails!) */
  .ex-rail .ex-chips {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    padding: 0;
    gap: 0.36rem;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .ex-rail .ex-chip {
    flex: 0 1 auto;
    white-space: nowrap;
    min-height: 2rem;
    padding: 0.32rem 0.72rem;
    border-radius: 9px;
    border: 1px solid transparent;
    background: var(--surface);
    color: var(--secondary-ink);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: -0.008em;
  }
  .ex-rail .ex-chip[aria-selected="true"] {
    background: var(--foreground);
    border-color: transparent;
    color: var(--background);
    font-weight: 600;
  }

  .ex-desc {
    display: none;
  }
  .ex-body {
    padding: 0.1rem 0 0.25rem;
    min-height: 12rem;
  }
  .ex-foot {
    margin-top: 0.2rem;
    padding: 0.5rem 0 0;
    border-top: 0;
    gap: 0.55rem;
  }
  .ex-foot .btn {
    height: 2.35rem;
    padding: 0 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.83rem;
    font-weight: 560;
  }
  .ex-foot .btn-ghost {
    border-color: transparent;
    color: var(--muted-foreground);
    padding: 0 0.6rem;
  }
  .ex-foot .btn-primary:disabled {
    background: color-mix(in oklab, var(--brand) 68%, var(--card));
    color: #ffffff;
    border-color: transparent;
  }
  [data-theme="dark"] .ex-foot .btn-primary:disabled {
    background: color-mix(in oklab, var(--brand) 56%, var(--card));
    color: #0f1517;
  }

  /* ----- Act 3 (#memory): Crisp Health/Linear FSRS widget + graded specimen card ----- */
  .memory-grid {
    gap: 2.15rem;
    padding-top: 1.65rem;
  }
  .mem-col {
    gap: 1rem;
  }
  .mem-col h3 {
    font-size: 1.2rem;
    font-weight: 580;
    letter-spacing: -0.024em;
  }
  .spot-desc {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    line-height: 1.54;
    color: var(--muted-foreground);
  }
  .mem-col + .mem-col {
    padding-top: 2.15rem;
  }

  .exam-box {
    gap: 0.85rem;
    padding: 1rem 1rem 1.05rem;
    border-radius: 16px;
  }
  .exam-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
  }
  .exam-top label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--secondary-ink);
  }
  .exam-top b {
    font-size: 0.92rem;
    font-weight: 660;
    color: var(--foreground);
  }
  .slider {
    width: 100%;
    height: 4px;
    border-radius: 999px;
  }
  .slider::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    background: var(--foreground);
    border: 2.5px solid var(--background);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--border-strong);
  }
  .slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--foreground);
    border: 2.5px solid var(--background);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--border-strong);
  }
  .exam-legend {
    gap: 0.6rem 1rem;
    font-size: 0.78rem;
  }
  .exam-legend .lg.deck {
    padding: 0;
    margin-top: 0;
    border: 0;
    background: transparent;
  }
  .exam-legend .lg.deck b {
    font-size: 1.24rem;
    letter-spacing: -0.025em;
  }
  .exam-legend .lg.deck span {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.79rem;
    color: var(--muted-foreground);
  }

  /* Calm, cohesive AI grading specimen card */
  .homework {
    padding: 1.05rem 1.05rem 1.1rem;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    gap: 0.88rem;
  }
  .hw-q {
    font-size: 0.89rem;
    line-height: 1.5;
  }
  .hw-q .katex { font-size: 0.98em; }
  .hw-a {
    padding: 0.1rem 0 0.1rem 0.85rem;
    font-size: 0.84rem;
    line-height: 1.58;
  }
  .hw-grade {
    gap: 0.6rem;
    padding-top: 0.15rem;
  }
  .feedback-text {
    font-size: 0.84rem;
    line-height: 1.55;
    min-height: 0;
  }

  /* ----- Act 4 (#agents): Refined underlined Mini-Game tabs + crisp full-bleed framing ----- */
  .mg-showcase {
    gap: 0.95rem;
    padding-top: 1.15rem;
    border-top: 0;
  }
  .mg-sidebar {
    gap: 0.65rem;
  }
  .mg-tabs {
    gap: 1.05rem;
    border-bottom: 1px solid var(--divider);
  }
  .mg-tab {
    padding: 0.5rem 0 0.65rem;
    min-height: 2.35rem;
  }
  .mg-tab[aria-selected="true"] {
    padding: 0.5rem 0 0.65rem;
    border-bottom-color: var(--foreground);
  }
  .mg-tab-name {
    font-size: 0.84rem;
    font-weight: 520;
    letter-spacing: -0.014em;
  }
  .mg-tab[aria-selected="true"] .mg-tab-name {
    font-weight: 600;
  }
  .mg-mobile-caption {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--muted-foreground);
  }
  .mg-mobile-caption span {
    margin-top: 0.28rem;
    font-size: 0.7rem;
    opacity: 0.78;
  }

  /* ----- Act 5 Market tabs: Clean underlined text tabs (ALL 5 fit cleanly in view!) ----- */
  .market-head-row .pill-tabs {
    gap: 1.15rem;
    border-bottom: 1px solid var(--divider);
    padding-top: 0;
    padding-bottom: 0;
  }
  .market-head-row .pill-tabs button {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--muted-foreground);
    min-height: 2.35rem;
    padding: 0.42rem 0 0.58rem;
    margin-bottom: -1px;
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
  }
  .market-head-row .pill-tabs button:hover {
    background: transparent;
    color: var(--foreground);
  }
  .market-head-row .pill-tabs button[aria-selected="true"] {
    background: transparent;
    color: var(--foreground);
    border-bottom-color: var(--foreground);
    font-weight: 600;
  }

  /* ----- Film (#film): Clean 16:9 poster + flush bottom scrim (no watermark collision!) ----- */
  .yt-frame {
    border-radius: 16px;
  }
  .yt-play {
    width: 3.35rem;
    height: 3.35rem;
    background: rgba(12, 13, 15, 0.76);
    border-color: rgba(255, 255, 255, 0.28);
  }
  .yt-play svg {
    width: 1.25rem;
    height: 1.25rem;
  }
  .yt-meta {
    left: auto;
    right: 0.65rem;
    bottom: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 7px;
    padding: 0.22rem 0.54rem;
    background: rgba(10, 11, 14, 0.82);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 0.74rem;
  }
  .yt-meta > span:first-child {
    display: none;
  }
  .yt-dur {
    font-size: 0.72rem;
    color: #f6f7f8;
  }
}

/* ============================================================================
   3. NATIVE iOS BOTTOM SHEET TRY-MODAL (<= 768px)
   ============================================================================ */
@media (max-width: 768px) {
  .try-modal {
    border-radius: 22px 22px 0 0;
    border-top: 1px solid var(--border-strong);
  }
  .try-modal-in::before {
    width: 2.2rem;
    height: 3.5px;
    margin: 0.55rem auto 0.2rem;
    opacity: 0.55;
  }
  .try-modal-head {
    padding: 0.45rem 1.15rem 0.7rem;
  }
  .try-modal-title h3 {
    font-size: 1.05rem;
    font-weight: 600;
  }
  .try-modal-close {
    width: 2.15rem;
    height: 2.15rem;
    border-color: transparent;
    background: var(--surface);
  }
  .try-modal-title .ex-chips {
    gap: 0.34rem;
    padding: 0.1rem 1.85rem 0.1rem 1.15rem;
    margin-inline: -1.15rem;
    width: calc(100% + 2.3rem);
    max-width: calc(100% + 2.3rem);
  }
  .try-modal-title .ex-chip {
    min-height: 2rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9px;
    border-color: transparent;
    background: var(--surface);
    font-size: 0.79rem;
  }
  .try-modal-title .ex-chip[aria-selected="true"] {
    background: var(--foreground);
    color: var(--background);
  }
  .try-modal-foot {
    padding: 0.75rem 1.15rem 0.9rem;
  }
  .try-modal-foot .rep-actions button {
    min-height: 2.5rem;
    font-size: 0.85rem;
  }
  .try-modal-foot .rep-actions a {
    min-height: 2.15rem;
    font-size: 0.8rem;
  }
}

/* ============================================================================
   4. PHONE ART DIRECTION (<= 640px): Apple / Linear / Notion proportion & polish
   ============================================================================ */
@media (max-width: 640px) {
  .wrap {
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
  }

  /* Subtle chapter separation across acts */
  #practice,
  #memory,
  #agents,
  #market,
  #film,
  #plans,
  .cta {
    border-top: 1px solid var(--divider);
  }

  /* ----- ACT 1: HERO (Owns the viewport gracefully — zero collision with Act 2) ----- */
  .hero {
    padding: 3.1rem 0 4.65rem;
  }
  .hero::before,
  .cta::before {
    background-size: 44px 44px;
    opacity: 0.7;
  }
  .hero-header {
    padding: 0 0.15rem;
  }
  .hero-h1 {
    font-size: clamp(2.35rem, 10.2vw, 2.8rem);
    font-weight: 560;
    line-height: 1.03;
    letter-spacing: -0.044em;
  }
  .hero-sub {
    margin-top: 0.88rem;
    font-size: 0.97rem;
    line-height: 1.54;
    color: var(--muted-foreground);
    max-width: 31ch;
  }

  /* Refined Apple-grade CTA pair: compact auto-width centered pills with clear hierarchy */
  .hero-cta {
    margin-top: 1.45rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: auto;
    max-width: none;
  }
  .hero-cta .btn-lg {
    width: auto;
    height: 2.68rem;
    padding: 0 1.28rem;
    font-size: 0.89rem;
    font-weight: 560;
    letter-spacing: -0.012em;
    border-radius: var(--radius-pill);
  }
  .hero-cta .btn-lg:not(.btn-primary),
  [data-theme="dark"] .hero-cta .btn-lg:not(.btn-primary) {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--foreground);
  }
  .hero-cta .btn-lg:not(.btn-primary):hover,
  [data-theme="dark"] .hero-cta .btn-lg:not(.btn-primary):hover {
    background: var(--surface);
  }

  /* Edge-accented 16:10 painterly video showcase */
  .showcase-wrap {
    margin-top: 2.2rem;
    margin-inline: -0.4rem;
  }
  .painterly-frame {
    padding: 0.52rem;
    border-radius: 20px;
    box-shadow: 0 24px 52px -18px rgba(0, 0, 0, 0.3);
  }
  [data-theme="dark"] .painterly-frame {
    box-shadow: 0 28px 64px -16px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }
  .real-screen-deck {
    border-radius: 13px;
  }
  .hero-vid-btn {
    width: 2rem;
    height: 2rem;
    right: 0.55rem;
    bottom: 0.65rem;
    opacity: 0.8;
  }
  .hero-vid-btn svg {
    width: 0.74rem;
    height: 0.74rem;
  }

  /* ----- EDITORIAL SECTION RHYTHM & CALM TYPOGRAPHY ----- */
  .section {
    padding: 3.75rem 0;
  }
  #practice {
    padding-top: 3.6rem;
  }
  .sec-head-left,
  #practice .sec-head-left {
    margin-bottom: 1.45rem;
    gap: 0.7rem;
  }
  .sec-h2 {
    font-size: clamp(1.6rem, 6.4vw, 1.98rem);
    font-weight: 560;
    line-height: 1.1;
    letter-spacing: -0.034em;
  }
  .sec-lead {
    margin-top: 0.6rem;
    font-size: 0.93rem;
    line-height: 1.56;
    color: var(--muted-foreground);
    max-width: 38ch;
  }
  .textlink {
    font-size: 0.88rem;
    font-weight: 540;
    min-height: 2.15rem;
  }

  .tri-cols {
    gap: 1rem;
    margin-top: 1.95rem;
  }
  .tri-col + .tri-col {
    padding-top: 1rem;
  }
  .tri-col h3 {
    font-size: 0.94rem;
    font-weight: 580;
    margin-bottom: 0.25rem;
  }
  .tri-col p {
    font-size: 0.88rem;
    line-height: 1.54;
    color: var(--muted-foreground);
  }

  /* ----- FULL-BLEED UNDERLINED TAB RAILS (smooth right fade, zero sliced borders) ----- */
  .ex-rail .pill-tabs,
  .market-head-row .pill-tabs,
  .mg-tabs {
    width: calc(100% + 2.5rem);
    max-width: calc(100% + 2.5rem);
    margin-inline: -1.25rem;
    padding: 0 2.25rem 0 1.25rem;
    scroll-padding-inline: 1.25rem;
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 34px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 34px), transparent 100%);
  }

  /* Market tabs: compact enough that EN fits all 5 completely; smooth fade if PT-BR scrolls */
  .market-head-row .pill-tabs {
    gap: 1rem;
    padding-right: 1.25rem;
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 20px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 20px), transparent 100%);
  }

  /* Mini-game tabs: crisp 3-tab fit with zero clipping on 390px EN */
  .mg-tabs {
    gap: 0.78rem;
    padding-right: 1.25rem;
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 14px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 14px), transparent 100%);
  }
  .mg-tab-name {
    font-size: 0.81rem;
  }

  /* Keep .ex-rail .ex-chips wrapped inside .wrap (override site.css full-bleed scroll rail) */
  .ex-rail .ex-chips {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    padding: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }

  /* ----- PAINTERLY GALLERY: Museum snap-carousel, clean centered dots, no touch arrows ----- */
  .gallery-rail {
    margin-inline: -1.25rem;
    padding: 0.1rem 1.25rem 0.35rem;
    scroll-padding-inline: 1.25rem;
    gap: 0.78rem;
  }
  .gal-card {
    width: 84vw;
    max-width: 20.5rem;
    height: 22.5rem;
    border-radius: 22px;
  }
  .gal-scrim {
    background: linear-gradient(180deg, rgba(8, 10, 12, 0.5) 0%, rgba(8, 10, 12, 0.08) 44%, rgba(8, 10, 12, 0.86) 100%);
  }
  .gal-title {
    padding: 1.15rem 1.15rem 0;
    font-size: 1.2rem;
  }
  .gal-title span {
    font-size: 0.69rem;
    padding: 0.18rem 0.56rem;
  }
  .gal-foot {
    left: 1.15rem;
    right: 1.15rem;
    bottom: 1.15rem;
    gap: 0.72rem;
  }
  .gal-foot p {
    font-size: 0.86rem;
    line-height: 1.46;
  }
  .gal-cta-pill {
    height: 2.15rem;
    padding: 0 0.92rem;
    font-size: 0.79rem;
    font-weight: 600;
  }
  .gallery-controls {
    margin-top: 0.9rem;
    justify-content: center;
  }
  /* Hide clunky < > desktop arrows on touch phones — swipe + crisp centered dots */
  .gallery-controls .ctrl-circle {
    display: none;
  }
  .gal-dots {
    margin-right: 0;
    gap: 0.38rem;
  }
  .gal-dot {
    width: 6px;
    height: 6px;
  }
  .gal-dot[aria-current="true"] {
    width: 22px;
    background: var(--foreground);
  }

  /* ----- ETUDE MARKET SHELF: App-Store-grade horizontal cards, zero tag-chip clutter ----- */
  .market-wrap {
    margin-top: 3.15rem;
    padding-top: 2.75rem;
    border-top: 1px solid var(--divider);
  }
  .market-head-row {
    gap: 0.85rem;
    margin-bottom: 1.15rem;
  }
  .market-grid {
    margin-inline: -1.25rem;
    padding: 0.1rem 1.25rem 0.4rem;
    scroll-padding-inline: 1.25rem;
    gap: 0.8rem;
  }
  .market-grid .mk {
    width: min(17.75rem, 80vw);
    border-radius: 18px;
  }
  .market-grid .mk-body {
    padding: 0.82rem 0.95rem 0.95rem;
    gap: 0.28rem;
  }
  .market-grid .mk-name {
    font-size: 0.93rem;
    font-weight: 600;
  }
  .market-grid .mk-desc {
    font-size: 0.8rem;
    line-height: 1.46;
    color: var(--muted-foreground);
    -webkit-line-clamp: 2;
  }
  /* Hide noisy tag chip piles on narrow phone cards so cover art + title + 2-line pitch shine */
  .market-grid .mk-tags {
    display: none;
  }
  .market-foot {
    margin-top: 0.85rem;
    gap: 0.45rem;
  }

  /* ----- ACT 6: PLANS (Compact editorial pricing cards — zero heavy dark-box-stack fatigue) ----- */
  .billing-toggle {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 19.5rem;
    padding: 0.2rem;
    gap: 0.15rem;
  }
  .billing-toggle button {
    min-height: 2.25rem;
    padding: 0.32rem 0.6rem;
    font-size: 0.81rem;
  }
  .billing-save {
    font-size: 0.74rem;
    margin-left: 0.22rem;
  }

  .plans-grid {
    gap: 0.72rem;
  }
  .plan-card {
    padding: 1.05rem 1.1rem;
    border-radius: 16px;
    gap: 0.78rem;
    background: var(--card);
    border: 1px solid var(--border);
  }
  .plan-card.plan-best {
    background: color-mix(in oklab, var(--brand) 5.5%, var(--card));
    border-color: var(--brand-border);
    box-shadow: 0 8px 24px -14px rgba(61, 137, 115, 0.22);
  }
  [data-theme="dark"] .plan-card.plan-best {
    background: color-mix(in oklab, var(--brand) 7%, var(--card));
    box-shadow: none;
  }

  /* Inline Name + Price header row cuts vertical card height nearly in half */
  .plan-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.16rem 0.75rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--divider);
  }
  .plan-top h3 {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.04rem;
    font-weight: 600;
    justify-content: flex-start;
    gap: 0.45rem;
    min-height: 0;
  }
  .plan-badge {
    font-size: 0.62rem;
    padding: 0.14rem 0.48rem;
  }
  .plan-price {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    font-size: 0.79rem;
    gap: 0.22rem;
  }
  .plan-price b {
    font-size: 1.55rem;
    font-weight: 660;
    letter-spacing: -0.035em;
  }
  .plan-sub {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 0;
    font-size: 0.77rem;
  }

  .plan-list {
    gap: 0.36rem;
    font-size: 0.82rem;
    line-height: 1.44;
    color: var(--secondary-ink);
  }
  .plan-list li {
    padding-left: 0.92rem;
  }
  .plan-list li::before {
    top: 0.48rem;
    width: 4px;
    height: 4px;
  }
  .plan-card .btn {
    height: 2.45rem;
    min-height: 2.45rem;
    font-size: 0.85rem;
    border-radius: var(--radius-pill);
  }
  .plans-footnote {
    margin-top: 1.15rem;
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--muted-foreground);
  }

  /* ----- CLOSING CTA ----- */
  .cta {
    padding: 3.75rem 0 3.5rem;
  }
  .cta h2 {
    font-size: clamp(2rem, 8.6vw, 2.55rem);
    font-weight: 560;
    line-height: 1.04;
    letter-spacing: -0.04em;
  }
  .cta-sub {
    margin-top: 0.8rem;
    font-size: 0.93rem;
    line-height: 1.54;
    color: var(--muted-foreground);
    max-width: 32ch;
  }
  .cta-trust {
    margin-top: 1.25rem;
    font-size: 0.76rem;
    line-height: 1.5;
  }
}

/* ============================================================================
   5. FOOTER (<= 859px): Serene, compact 2-column editorial footer
   ============================================================================ */
@media (max-width: 859px) {
  .footer {
    padding: 2.5rem 0 calc(2.25rem + env(safe-area-inset-bottom));
    font-size: 0.85rem;
  }
  .footer .wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 1.25rem;
  }
  .footer-brand-col {
    grid-column: 1 / -1;
    gap: 0.5rem;
    padding-bottom: 0.35rem;
  }
  .footer-tagline {
    font-size: 0.86rem;
    line-height: 1.54;
    color: var(--muted-foreground);
  }
  .footer h4 {
    margin-bottom: 0.45rem;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .footer ul {
    gap: 0.14rem;
  }
  .footer .footer-compare ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.14rem 1.25rem;
  }
  .footer ul a {
    min-height: 1.9rem;
    font-size: 0.85rem;
    color: var(--secondary-ink);
  }
  .footer .fine {
    padding-top: 1.25rem;
    margin-top: 0.2rem;
    gap: 0.75rem;
    font-size: 0.78rem;
  }
  .footer-langs {
    padding: 0.18rem;
  }
  .footer-langs a {
    min-height: 2.05rem;
    padding: 0.2rem 0.78rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 359px) {
  .hero-cta .btn-lg {
    width: 100%;
  }
  .nav-drawer-actions {
    grid-template-columns: 1fr;
  }
}
