/* ==========================================================
   APEX LABS — MOBILE FIXES
   Targeted overrides for ≤768px and ≤480px.
   Tablet/desktop untouched. Loaded after styles.css?v=22.
   ========================================================== */

/* ---------- Global no-horizontal-scroll guard ---------- */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  * { min-width: 0; }
}

/* ==========================================================
   1) APEX GENESIS · ALICE STORY (chapters)
   ========================================================== */
@media (max-width: 768px) {
  .genesis { padding: 48px 18px; }
  .genesis-eyebrow { margin-bottom: 32px; }
  .genesis-eyebrow span {
    font-size: 9px; letter-spacing: 2px; padding: 8px 12px;
    max-width: 100%; text-align: center; line-height: 1.4;
  }
  .genesis-grid {
    grid-template-columns: 1fr; gap: 32px;
    max-width: 100%;
  }
  .genesis-text { min-width: 0; max-width: 100%; }
  .genesis-h {
    font-size: clamp(32px, 9vw, 48px);
    line-height: 1; word-wrap: break-word; overflow-wrap: break-word;
  }
  .genesis-desc {
    font-size: 15px; line-height: 1.6;
    max-width: 100%; padding-right: 4px;
    word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;
  }

  /* Chapter cards — keep inside viewport */
  .genesis-chapters { gap: 8px; margin-bottom: 24px; }
  .gch {
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
    gap: 4px 12px;
    padding: 12px 14px;
    font-size: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word; overflow-wrap: break-word;
  }
  .gch .gn {
    grid-row: 1 / span 2; grid-column: 1;
    align-self: center;
    font-size: 16px;
  }
  .gch .gt {
    grid-row: 1; grid-column: 2;
    font-size: 13px; line-height: 1.2;
    word-wrap: break-word; overflow-wrap: break-word;
  }
  .gch .gd {
    grid-row: 2; grid-column: 2;
    font-size: 10px; letter-spacing: 0.5px;
    word-wrap: break-word; overflow-wrap: break-word;
    white-space: normal;
  }

  /* alice-points list */
  .alice-points { padding: 0; max-width: 100%; }
  .alice-points li {
    word-wrap: break-word; overflow-wrap: break-word;
    max-width: 100%;
  }
  .alice-points .ap-v { font-size: 13px; line-height: 1.55; }

  /* Genesis CTA buttons stack cleanly */
  .genesis-cta { gap: 10px; }
  .genesis-cta .btn { width: 100%; justify-content: center; }
  .genesis-foot { gap: 12px 18px; font-size: 10px; }

  /* Genesis card video panel */
  .genesis-card { aspect-ratio: 4 / 5; max-width: 100%; }
  .genesis-tag { top: 16px; left: 16px; font-size: 10px; padding: 5px 10px; letter-spacing: 2px; }
  .genesis-vid-meta { left: 14px; right: 14px; bottom: 14px; padding: 10px 12px; }
  .genesis-vid-meta .v { font-size: 13px; }
  .genesis-vid-meta .l { font-size: 8px; letter-spacing: 1.5px; }
  .genesis-vid-meta .r { font-size: 10px; }
  .genesis-pager { bottom: 78px; }
}

@media (max-width: 480px) {
  .genesis { padding: 40px 14px; }
  .genesis-h { font-size: clamp(28px, 9vw, 40px); }
  .genesis-desc { font-size: 14px; padding-right: 2px; }
  .gch { padding: 10px 12px; }
  .gch .gt { font-size: 12px; }
  .gch .gd { font-size: 9px; letter-spacing: 0.4px; }
  .alice-points .ap-v { font-size: 12px; }
}

/* ==========================================================
   2) iCLAW COMMAND PORTAL
   ========================================================== */
@media (max-width: 768px) {
  .iclaw { padding-bottom: 40px; }
  .iclaw-frame {
    padding: 0 14px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .iclaw-bar {
    padding: 10px 12px;
    font-size: 9px; letter-spacing: 0.5px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .iclaw-title { margin-left: 6px; font-size: 9px; }
  .iclaw-meta { font-size: 9px; }
  .iclaw-body {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .iclaw-sidebar, .iclaw-vault {
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 14px 12px;
  }
  .ic-section { font-size: 9px; letter-spacing: 2px; margin: 6px 0 10px; }

  /* Agent rows — keep inside frame */
  .ic-agent {
    grid-template-columns: 24px 1fr auto;
    gap: 8px;
    padding: 7px 8px;
    font-size: 10px;
    letter-spacing: 0.5px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .ic-agent img { width: 24px; height: 24px; }
  .ic-agent .n { font-size: 11px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ic-agent .r {
    font-size: 8px;
    letter-spacing: 0.5px;
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70px;
  }

  .ic-surf {
    padding: 7px 10px;
    font-size: 10px;
    letter-spacing: 0.5px;
  }

  .iclaw-main { padding: 14px 12px; gap: 12px; }
  .ic-pane { padding: 10px 12px; }
  .ic-pane-h, .ic-pane-meta { font-size: 9px; letter-spacing: 1.2px; }
  .ic-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .ic-cell { padding: 10px; }
  .ic-cell-l { font-size: 8px; letter-spacing: 1.2px; margin-bottom: 6px; }
  .ic-cell-num { font-size: 22px; }
  .ic-input { font-size: 11px; flex-wrap: wrap; }
  .ic-prompt { font-size: 10px; }

  .ic-vault-row {
    font-size: 10px;
    padding: 5px 0;
    gap: 8px;
    min-width: 0;
  }
  .ic-vault-row .l, .ic-vault-row .v {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ic-score-ring { width: 72px; height: 72px; }
  .ic-score-ring .n { font-size: 22px; }
}

@media (max-width: 480px) {
  .iclaw-frame { padding: 0 10px; }
  .iclaw-bar { padding: 8px 10px; }
  .iclaw-bar .iclaw-title { display: none; }
  .iclaw-sidebar, .iclaw-vault { padding: 12px 10px; }
  .iclaw-main { padding: 12px 10px; }

  .ic-agent {
    grid-template-columns: 22px 1fr;
    grid-template-rows: auto auto;
    gap: 2px 8px;
    padding: 6px 8px;
  }
  .ic-agent img {
    grid-row: 1 / span 2; grid-column: 1;
    width: 22px; height: 22px;
    align-self: center;
  }
  .ic-agent .n {
    grid-row: 1; grid-column: 2;
    font-size: 11px;
  }
  .ic-agent .r {
    grid-row: 2; grid-column: 2;
    font-size: 8px;
    text-align: left;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ic-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .ic-cell { padding: 8px; }
  .ic-cell-num { font-size: 20px; }
}

/* ==========================================================
   3) ALICE WIDGET DOCK (FAB + panel)
   ========================================================== */
@media (max-width: 480px) {
  .alice-fab {
    right: 12px; bottom: 12px;
    width: 52px; height: 52px;
  }
  .alice-fab img { width: 44px; height: 44px; }
  .alice-fab-bubble { display: none; }
  .alice-fab-status { width: 12px; height: 12px; }
  .alice-fab-status .dot { width: 7px; height: 7px; }

  .alice-panel {
    /* Already full-screen at ≤768 in styles.css; keep that. */
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .alice-panel .alice-h,
  .alice-h {
    grid-template-columns: 44px 1fr 28px;
    gap: 10px;
    padding: 12px 14px;
    align-items: center;
  }
  .alice-h-eye, .alice-panel .alice-h-eye { width: 40px; height: 40px; }
  .alice-h-eye img, .alice-panel .alice-h-eye img { width: 40px; height: 40px; }
  .alice-meta { min-width: 0; overflow: hidden; }
  .alice-name, .alice-panel .alice-name {
    font-size: 15px;
    letter-spacing: 1.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
  }
  .alice-name .ver { font-size: 9px; letter-spacing: 1px; margin-left: 4px; }
  .alice-role { font-size: 8px; letter-spacing: 1.5px; }
  .alice-status { gap: 4px; }
  .alice-status .badge {
    font-size: 7px;
    letter-spacing: 1px;
    padding: 2px 6px;
  }
  .alice-status .badge .dot { width: 5px; height: 5px; }
}

/* Extra-narrow (≤360px Android) */
@media (max-width: 360px) {
  .genesis { padding: 36px 12px; }
  .iclaw-frame { padding: 0 8px; }
  .gch { padding: 9px 10px; }
  .gch .gn { font-size: 14px; }
  .gch .gt { font-size: 11px; }
  .gch .gd { font-size: 8px; }
  .ic-cell-num { font-size: 18px; }
  .alice-fab { right: 10px; bottom: 10px; width: 48px; height: 48px; }
  .alice-fab img { width: 40px; height: 40px; }
}

/* ==========================================================
   4) HERO — headline overlap, topbar clipping
   Hero h1 was 56px / 48px line-height (0.86) → letters collide.
   ========================================================== */
@media (max-width: 768px) {
  .hero { padding-bottom: 32px; }
  .hero-h1, .hero h1 {
    font-size: clamp(36px, 11vw, 52px);
    line-height: 1.04;
    letter-spacing: -0.01em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
    max-width: 100%;
  }
  .hero-eyebrow, .hero-meta {
    font-size: 10px;
    letter-spacing: 1.4px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
  }
  /* Topbar streaming text — clip cleanly with fade, no mid-word breaks */
  .topbar, .topbar-inner {
    max-width: 100%;
    overflow: hidden;
  }
  .topbar-stream, .topbar-meta, .topbar-status {
    font-size: 9px;
    letter-spacing: 1px;
    white-space: nowrap;
  }
  /* Hero CTA buttons — full width, 44px+ touch */
  .hero-cta { gap: 10px; flex-direction: column; }
  .hero-cta .btn { width: 100%; min-height: 48px; }
}
@media (max-width: 480px) {
  .hero-h1, .hero h1 {
    font-size: clamp(32px, 10vw, 44px);
    line-height: 1.05;
  }
}
@media (max-width: 360px) {
  .hero-h1, .hero h1 { font-size: 32px; line-height: 1.06; }
}

/* ==========================================================
   5) MARQUEE BAND
   ========================================================== */
@media (max-width: 768px) {
  .band-marquee { padding: 32px 0; }
  .marquee-track { font-size: 16px; letter-spacing: 1.5px; }
}
@media (max-width: 480px) {
  .marquee-track { font-size: 14px; }
}

/* ==========================================================
   6) STATS / KPI GRID — 4 cells unlimited / 100× / 24/7 / 0
   Was 2-col w/ 24px left padding pushing num. Reflow tighter.
   ========================================================== */
@media (max-width: 768px) {
  .stats { padding: 48px 18px; }
  .kpi-grid, .stats > div:last-child {
    gap: 12px;
  }
  .kpi {
    padding: 14px 12px 14px 16px;
    min-width: 0;
    box-sizing: border-box;
  }
  .kpi-num, .kpi-text {
    font-size: clamp(28px, 8.5vw, 38px);
    line-height: 1;
    word-wrap: break-word;
  }
  .kpi-label {
    font-size: 9px;
    letter-spacing: 1.2px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}
@media (max-width: 360px) {
  .stats { padding: 40px 12px; }
  .kpi { padding: 12px 10px 12px 12px; }
  .kpi-num, .kpi-text { font-size: 26px; }
  .kpi-label { font-size: 8px; letter-spacing: 1px; }
}

/* ==========================================================
   7) MANIFESTO / THESIS
   ========================================================== */
@media (max-width: 768px) {
  .manifesto { padding: 56px 18px; }
  .manifesto h2 {
    font-size: clamp(22px, 6vw, 30px);
    line-height: 1.18;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .manifesto-pills {
    font-size: 11px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .manifesto-pills > * {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
}
@media (max-width: 360px) {
  .manifesto { padding: 44px 14px; }
}

/* ==========================================================
   8) SCROLLING SCENES (4 scenes)
   ========================================================== */
@media (max-width: 768px) {
  .scenes-stage, .scene-vid { max-width: 100vw; }
  .scenes-overlay, .scene-block { padding: 0 18px; box-sizing: border-box; }
  .scene-h2 {
    font-size: clamp(26px, 8vw, 36px);
    line-height: 1.08;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  .scene-sub {
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}
@media (max-width: 360px) {
  .scene-h2 { font-size: 24px; }
  .scene-sub { font-size: 12px; }
}

/* ==========================================================
   9) TYPO BAND (FOUR BRANDS · ONE OS)
   ========================================================== */
@media (max-width: 768px) {
  .typo-band { padding: 28px 18px 24px; }
  .typo-line {
    font-size: clamp(22px, 7vw, 36px);
    line-height: 1.05;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* ==========================================================
   10) REEL WALL — 16 reels, ensure 2-col mobile
   ========================================================== */
@media (max-width: 768px) {
  .reelwall { padding: 36px 0 48px; }
  .reel-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 0 12px;
  }
  .reel { min-width: 0; }
}
@media (max-width: 360px) {
  .reel-grid { gap: 6px; padding: 0 10px; }
}

/* ==========================================================
   11) FOUR PILLARS (fp-row)
   fp-num was 96px → trim. fp-row 0 32px → reduce to give breathing.
   ========================================================== */
@media (max-width: 768px) {
  .four-pillars { padding: 24px 0 48px; }
  .fp-row {
    grid-template-columns: 1fr;
    padding: 0 18px;
    gap: 18px;
    box-sizing: border-box;
  }
  .fp-text, .fp-vid { min-width: 0; max-width: 100%; }
  .fp-num {
    font-size: clamp(56px, 18vw, 80px);
    line-height: 0.9;
  }
  .fp-eyebrow, .fp-sub, .fp-meta {
    font-size: 10px;
    letter-spacing: 1.2px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .fp-h {
    font-size: clamp(28px, 8vw, 36px);
    line-height: 1.05;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .fp-desc {
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .fp-vid-tag, .fp-vid-status {
    font-size: 9px;
    padding: 5px 10px;
    letter-spacing: 1px;
  }
  .fp-vid-progress { width: 100%; max-width: 100%; }
}
@media (max-width: 360px) {
  .fp-row { padding: 0 14px; }
  .fp-num { font-size: 52px; }
}

/* ==========================================================
   12) PILLARS (legacy section, hidden but defensive)
   ========================================================== */
@media (max-width: 768px) {
  .pillar-grid { grid-template-columns: 1fr; padding: 0 14px; gap: 14px; }
  .pillar { padding: 24px 18px; min-width: 0; }
  .pillar-name {
    font-size: clamp(26px, 8vw, 34px);
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .pillar-desc { font-size: 14px; line-height: 1.55; }
}

/* ==========================================================
   13) SWARMS PARALLEL
   ========================================================== */
@media (max-width: 768px) {
  .swarms-parallel { padding: 32px 0 48px; }
  .swarms-parallel > * { max-width: 100%; box-sizing: border-box; }
}

/* ==========================================================
   14) JETR / SPM DIVE (live ops carousels)
   Force overflow-x:hidden on dive container; carousel cards
   must scroll inside their own track, not the page.
   ========================================================== */
@media (max-width: 768px) {
  .dive { overflow-x: hidden; max-width: 100vw; }
  .dive-stage { max-width: 100vw; overflow-x: hidden; }
  .dive-sub {
    font-size: 13px;
    line-height: 1.55;
    padding: 0 18px;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .spm-rail {
    padding: 14px;
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
  }
  .spm-rail-h {
    font-size: 10px;
    letter-spacing: 1.2px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .spm-rail-track {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
  }
  .spm-rail-card {
    scroll-snap-align: start;
    flex: 0 0 auto;
    min-width: 0;
  }
}

/* ==========================================================
   15) MEMORY / NEXUS
   ========================================================== */
@media (max-width: 768px) {
  .nexus-section { padding: 56px 18px; }
  .nexus-section > * { max-width: 100%; box-sizing: border-box; }
}

/* ==========================================================
   16) ARCHITECTURE (One queen / Many lanes / Infinite skills)
   ========================================================== */
@media (max-width: 768px) {
  .architecture { padding: 40px 0 48px; }
  .arch-grid {
    grid-template-columns: 1fr;
    padding: 0 18px;
    gap: 14px;
  }
  .arch-col {
    padding: 22px 18px;
    min-width: 0;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .arch-col .cell-l {
    font-size: 9px;
    letter-spacing: 1.2px;
    word-wrap: break-word;
  }
  .arch-col .cell-v {
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}
@media (max-width: 360px) {
  .arch-grid { padding: 0 12px; }
  .arch-col { padding: 18px 14px; }
}

/* ==========================================================
   17) BRANDS / AVA-MGR / PROOF-MERGE / STACK / FAQ
   Defensive padding + overflow to keep all in viewport.
   ========================================================== */
@media (max-width: 768px) {
  .brands, .ava-mgr, .proof-merge, .stack, .faq {
    padding-left: 18px;
    padding-right: 18px;
    box-sizing: border-box;
  }
  .brands > *, .ava-mgr > *, .proof-merge > *, .stack > *, .faq > * {
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
  }
  .faq-q {
    font-size: 14px;
    padding: 16px 14px;
    min-height: 56px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .faq-a {
    font-size: 13px;
    line-height: 1.55;
    padding: 0 14px 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}
@media (max-width: 360px) {
  .brands, .ava-mgr, .proof-merge, .stack, .faq {
    padding-left: 12px;
    padding-right: 12px;
  }
  .proof-merge { padding-top: 48px; padding-bottom: 48px; }
}

/* ==========================================================
   18) CTA CONTACT (DEPLOY YOUR AGENT FLEET)
   ========================================================== */
@media (max-width: 768px) {
  .cta, .cta-elite {
    padding: 56px 18px 80px;
    box-sizing: border-box;
  }
  .cta-elite-grid { gap: 24px; }
  .cta-eyebrow {
    font-size: 10px;
    letter-spacing: 1.5px;
    word-wrap: break-word;
  }
  .cta-h2, .cta-h2-xl {
    font-size: clamp(30px, 9vw, 44px);
    line-height: 1.04;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .cta-h-line, .cta-h-grad {
    font-size: clamp(30px, 9vw, 44px);
    line-height: 1.04;
  }
  .cta-sub {
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .cta-buttons {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  .cta-buttons .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
  .cta-mail {
    font-size: 13px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
  }
  .cta-foot {
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 10px;
  }
  /* Safe-area for fixed bottoms */
  .cta-elite, .cta { padding-bottom: max(80px, env(safe-area-inset-bottom, 0) + 60px); }
}
@media (max-width: 360px) {
  .cta, .cta-elite { padding-left: 14px; padding-right: 14px; }
  .cta-h2, .cta-h2-xl, .cta-h-line, .cta-h-grad { font-size: 28px; }
}

/* ==========================================================
   19) DRAWER / MOBILE NAV
   Was 60 36px 32px → 36px horizontal heavy on 320–360 screens.
   ========================================================== */
@media (max-width: 768px) {
  .drawer, .m-drawer {
    max-width: 100vw;
    overflow-x: hidden;
  }
  .drawer-panel, .m-drawer-panel {
    width: 100vw;
    max-width: 100vw;
    padding: 56px 22px 28px;
    box-sizing: border-box;
  }
  .drawer-panel a, .m-drawer-panel a, .m-drawer-link {
    min-height: 48px;
    display: flex;
    align-items: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  /* Honor iOS safe-area for full-screen panels */
  .drawer-panel, .m-drawer-panel {
    padding-top: max(56px, env(safe-area-inset-top, 0) + 28px);
    padding-bottom: max(28px, env(safe-area-inset-bottom, 0) + 16px);
  }
}
@media (max-width: 360px) {
  .drawer-panel, .m-drawer-panel { padding-left: 16px; padding-right: 16px; }
}

/* ==========================================================
   20) GLOBAL TOUCH-TARGET + REDUCED-MOTION
   ========================================================== */
@media (max-width: 768px) {
  .btn, button, [role="button"], .nav-toggle {
    min-height: 44px;
  }
  .nav-toggle { width: 44px; height: 44px; }
  /* Section eyebrows / subs default break */
  .section-eyebrow, .section-sub, .section-h2 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  .section-h2 {
    font-size: clamp(26px, 7.5vw, 38px);
    line-height: 1.08;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track,
  .scene-vid,
  .fp-vid video,
  .hero-vid {
    animation: none !important;
  }
}

/* ==========================================================
   J MOBILE PASS — v2.0 · 2026-04-30
   7 targeted fixes for iPhone 375×812.
   Appended — no existing rules modified.
   ========================================================== */

/* ----------------------------------------------------------
   FIX 1 — CHAT PANEL: cap at 65dvh so hero peeks through.
   av3-panel and alice-panel share the full-height override at
   max-width:768px (styles.css:8750 → 100dvh). We tighten to
   65dvh and give it a bottom-sheet feel with top radius.
   ---------------------------------------------------------- */
@media (max-width: 700px) {
  #alice-panel.av3-panel,
  #alice-panel.av4-panel,
  .alice-panel.av3-panel,
  .alice-panel.av4-panel,
  .alice-panel {
    max-height: 65dvh !important;
    height: auto !important;
    border-radius: 20px 20px 0 0 !important;
  }
}

/* ----------------------------------------------------------
   FIX 2 — CHAT HEADER: hide latency pill; shrink header to
   avatar + name + ONLINE dot only. Prevents "ALI..." truncation.
   ---------------------------------------------------------- */
@media (max-width: 700px) {
  /* Latency pill hidden */
  .av3-online-pill,
  .alice-foot-latency,
  #alice-latency,
  [class*="latency"],
  .alice-h-latency {
    display: none !important;
  }

  /* Header grid: 40px avatar | flex name | close btn */
  .alice-panel .alice-h,
  #alice-panel .alice-h,
  .alice-h {
    grid-template-columns: 40px 1fr 32px !important;
    gap: 8px !important;
    padding: 10px 12px !important;
  }

  /* Avatar 40px */
  .alice-panel .alice-h-eye,
  #alice-panel .alice-h-eye,
  .alice-h-eye {
    width: 40px !important;
    height: 40px !important;
  }
  .alice-panel .alice-h-eye img,
  #alice-panel .alice-h-eye img,
  .alice-h-eye img {
    width: 40px !important;
    height: 40px !important;
  }

  /* Name: single line, no truncation */
  .alice-panel .alice-name,
  #alice-panel .alice-name,
  .alice-name {
    font-size: 13px !important;
    letter-spacing: 0.8px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Role subtitle: max 1 line */
  .alice-panel .alice-role,
  #alice-panel .alice-role,
  .alice-role {
    font-size: 8px !important;
    letter-spacing: 1px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* ----------------------------------------------------------
   FIX 3 — HUD META: hide .hud-row and .hud-meta on mobile to
   stop collision with reel grid / hero overlay text.
   ---------------------------------------------------------- */
@media (max-width: 700px) {
  .hud-meta,
  .hud-row {
    display: none !important;
  }
}

/* ----------------------------------------------------------
   FIX 4 — KPI STRIP: 2×2 grid ≤600px, single-col ≤380px.
   .stats-inner is already 2-col at 768 (styles.css:696).
   We force 2×2 explicitly here to ensure equal widths at 375px.
   ---------------------------------------------------------- */
@media (max-width: 600px) {
  .stats-inner {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .kpi {
    padding: 12px 10px !important;
  }
}
@media (max-width: 380px) {
  .stats-inner {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
}

/* ----------------------------------------------------------
   FIX 5 — MARQUEE TEXT SIZE: reduce clamp on narrow screens.
   Existing mobile-fixes.css sets 16px/14px; styles.css default
   is clamp(18px,4.5vw,22px). We tighten further on phone.
   ---------------------------------------------------------- */
@media (max-width: 700px) {
  .marquee-track {
    font-size: clamp(14px, 4vw, 18px) !important;
  }
}

/* ----------------------------------------------------------
   FIX 6 — JETR CAROUSEL CARDS (.jrow-card): reduce min-width
   from the grid-auto-columns minmax(180px,1fr) in ui-polish.css.
   Override jrow-scroll column sizing and card padding on mobile.
   ---------------------------------------------------------- */
@media (max-width: 700px) {
  .jrow-scroll {
    grid-auto-columns: minmax(200px, 240px) !important;
    gap: 8px !important;
    padding: 4px 2px 12px !important;
  }
  .jrow-card {
    min-width: 200px !important;
  }
  .jrow-body {
    padding: 8px 10px 10px !important;
  }
  .jrow-thumb {
    aspect-ratio: 3 / 4 !important;
  }
}
@media (max-width: 400px) {
  .jrow-scroll {
    grid-auto-columns: minmax(180px, 220px) !important;
  }
  .jrow-card {
    min-width: 180px !important;
  }
}

/* ----------------------------------------------------------
   FIX 7 — ARCHITECTURE SKILL CHIPS: ensure chips don't wrap
   badly at 375px. Shrink font + padding, allow flex-wrap.
   .arch-col already stacks to 1-col; chips need size reduction.
   ---------------------------------------------------------- */
@media (max-width: 700px) {
  .arch-col .chip,
  .arch-col [class*="chip"],
  .arch-col .skill-chip,
  .arch-col .lane-chip,
  .arch-col .tag {
    font-size: 8px !important;
    padding: 3px 7px !important;
    letter-spacing: 0.4px !important;
    white-space: nowrap !important;
  }
}

/* ==========================================================
   APR-30 MOBILE PASS — Brands / Ops / Swarm / Chat
   ========================================================== */

/* ---------- SWARMS-PARALLEL · day-cursor timeline ----------
   Tick labels at --tx:0% and --tx:98% extend off-screen on mobile.
   Strategy: scale down ticks, clamp first/last, show only every other,
   and let the whole row horizontal-scroll if needed.
*/
@media (max-width: 700px) {
  .swp-timeline { padding: 12px 14px !important; }
  .swp-tl-head {
    flex-direction: column !important; align-items: flex-start !important;
    gap: 4px !important; margin-bottom: 10px !important;
  }
  .swp-tl-head .swp-tl-tag,
  .swp-tl-head .swp-tl-meta {
    font-size: 9px !important; letter-spacing: 0.14em !important;
    white-space: normal !important; line-height: 1.4 !important;
  }
  .swp-tl-track {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding-left: 26px !important; padding-right: 26px !important;
  }
  .swp-tl-track::-webkit-scrollbar { display: none !important; }
  .swp-tl-tick {
    font-size: 9px !important; letter-spacing: 0.06em !important;
  }
  .swp-tl-tick b {
    font-size: 10px !important;
    display: block !important; margin-bottom: 2px !important;
  }
  .swp-tl-tick span {
    font-size: 8px !important;
    letter-spacing: 0.06em !important;
    line-height: 1.2 !important;
    display: block !important;
    max-width: 64px !important;
    word-wrap: break-word !important;
    text-align: center !important;
  }
  /* Hide overflow ticks (first/last) on tightest viewports — keep middle 4 */
  .swp-tl-tick:first-child,
  .swp-tl-tick:nth-last-child(2) { display: none !important; }
  /* Lane padding tighter */
  .swp-frame { padding: 14px !important; }
  .swp-lane { padding: 10px !important; }
  .swp-lane .swp-h { gap: 8px !important; }
  .swp-lane .swp-h img { width: 28px !important; height: 28px !important; }
  .swp-lane .swp-name { font-size: 13px !important; }
  .swp-lane .swp-status { font-size: 8px !important; padding: 3px 7px !important; }
  .swp-task { padding: 7px 0 !important; }
  .swp-task .t { font-size: 11px !important; }
  .swp-task .g { font-size: 8.5px !important; padding: 2px 6px !important; }
  .swp-foot { gap: 6px !important; flex-wrap: wrap !important; }
  .swp-foot .r-pill { font-size: 9px !important; padding: 5px 9px !important; }
}

/* ---------- ARCHITECTURE · ac-lane-skills overflow ----------
   Long skill lists (apex-design · ui-ux-pro-max · sparc-... ) get
   text-overflow:ellipsis truncated. Allow horizontal-scroll instead.
*/
@media (max-width: 768px) {
  .ac-lane-skills,
  .ac-skills,
  .ac-skills-foot {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    text-overflow: clip !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent) !important;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent) !important;
  }
  .ac-lane-skills::-webkit-scrollbar,
  .ac-skills::-webkit-scrollbar { display: none !important; }
  .ac-lane-name,
  .ac-lane-skills,
  .ac-skills { font-size: 10px !important; letter-spacing: 0.04em !important; }
  .ac-lane { padding: 10px 12px !important; }
  .ac-grid { gap: 12px !important; }
}

/* ---------- AVA-MANAGER · mgr-v2-tabbar overflow ----------
   Container parent is 275px wide on mobile but tabbar scrollWidth=562.
   Make parent fill width AND let tabbar scroll cleanly.
*/
@media (max-width: 768px) {
  .mgr-v2,
  .mgr-v2-shell,
  .mgr-v2-frame,
  .ava-mgr-frame {
    max-width: 100% !important;
    width: 100% !important;
  }
  .mgr-v2-tabbar {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    flex-wrap: nowrap !important;
    padding: 6px 10px !important;
    gap: 4px !important;
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%) !important;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%) !important;
  }
  .mgr-v2-tabbar::-webkit-scrollbar { display: none !important; }
  .mgr-v2-tab {
    flex-shrink: 0 !important;
    font-size: 10px !important;
    padding: 6px 10px !important;
    letter-spacing: 0.06em !important;
    white-space: nowrap !important;
  }
  .mgr-v2-tab-badge {
    font-size: 9px !important;
    padding: 1px 5px !important;
    margin-left: 4px !important;
  }
  /* AVA manager body inner cards — keep within bounds */
  .mgr-v2-body { padding: 12px !important; }
  .mgr-v2-card { padding: 10px !important; }
}

/* ---------- BRANDS · bpanel mobile breathing room ---------- */
@media (max-width: 700px) {
  .brands { padding: 56px 14px 40px !important; }
  .bpanel { border-radius: 14px !important; }
  .bpanel-content { padding: 22px 18px !important; }
  .bpanel-name { font-size: clamp(36px, 9vw, 56px) !important; line-height: 0.92 !important; }
  .bpanel-desc { font-size: 13px !important; line-height: 1.5 !important; }
  .bpanel-stats { gap: 10px !important; }
  .bpanel-stats .l { font-size: 8.5px !important; letter-spacing: 0.18em !important; }
  .bpanel-stats .v { font-size: 12px !important; }
  .bpanel-tag { font-size: 9px !important; padding: 5px 10px !important; }
}

/* ---------- ENGINE 100x · luna rail mobile ---------- */
@media (max-width: 700px) {
  .engine100x { padding: 56px 14px 40px !important; }
  .e100-rail-wrap { padding: 14px 12px !important; }
  .e100-rail-meta { font-size: 9.5px !important; letter-spacing: 0.1em !important; gap: 8px !important; }
  .e100-card { flex: 0 0 140px !important; }
  .e100-foot { gap: 6px !important; }
  .e100-foot .r-pill { font-size: 9px !important; padding: 5px 9px !important; }
}

/* ---------- JETR LM-RAIL · inner carousel mobile ---------- */
@media (max-width: 700px) {
  .lm-campaign-rail .lm-camp-h { gap: 6px !important; }
  .lm-rail { padding: 12px 4px 6px !important; gap: 10px !important; }
  .lm-rail-card { flex: 0 0 156px !important; }
  .lm-rail-meta { font-size: 9px !important; letter-spacing: 0.1em !important; }
}
