/* ================================================================
   TheAirplaneMode.app — app.css
   All styles. Loaded by index.html via <link rel="stylesheet">.
   Split from index.html for maintainability.
================================================================ */
    /* ── Landing page ────────────────────────────────────────────── */
    #screen-landing {
      justify-content: space-between;
      align-items: flex-start;
      padding: 48px 28px max(40px, env(safe-area-inset-bottom));
      max-width: 420px;
      margin: 0 auto;
      width: 100%;
      overflow-y: auto;
    }

    .landing-signin-skip {
      align-self: flex-end;
      background: none;
      border: none;
      color: var(--muted);
      font-size: 13px;
      font-family: var(--font);
      cursor: pointer;
      padding: 0;
      letter-spacing: 0.02em;
    }
    .landing-signin-skip:hover { color: var(--text); }

    .landing-wordmark {
      margin-top: 24px;
      line-height: 1;
    }
    .lw-the {
      font-size: 13px;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 2px;
    }
    .lw-main {
      font-size: 34px;
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.01em;
    }
    .lw-mode { color: var(--accent2); }
    .lw-dot {
      font-size: 10px;
      color: var(--accent);
      margin-top: 8px;
      letter-spacing: 0.05em;
    }

    .landing-hero {
      font-size: 22px;
      font-weight: 600;
      line-height: 1.45;
      color: var(--text);
      margin-top: 32px;
    }

    .landing-sub {
      font-size: 15px;
      font-weight: 400;
      line-height: 1.5;
      color: var(--accent2);
      margin-top: 10px;
    }

    .landing-hooks {
      display: flex;
      flex-direction: column;
      gap: 20px;
      margin-top: 36px;
      width: 100%;
    }
    .landing-hook {
      display: flex;
      gap: 16px;
      align-items: flex-start;
    }
    .lh-icon {
      font-size: 20px;
      flex-shrink: 0;
      width: 32px;
      text-align: center;
      margin-top: 2px;
      opacity: 0.75;
    }
    .lh-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 4px;
    }
    .lh-sub {
      font-size: 13px;
      color: var(--muted);
      line-height: 1.55;
    }

    .landing-cta-wrap {
      width: 100%;
      margin-top: 44px;
    }
    .landing-cta-btn {
      margin-top: 0;
    }
    .landing-legal {
      text-align: center;
      font-size: 12px;
      color: var(--muted);
      margin-top: 12px;
      letter-spacing: 0.03em;
    }

    /* ── Reset & base ─────────────────────────────────────────────── */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg:        #0a0f1e;
      --bg2:       #111827;
      --surface:   #1a2234;
      --border:    #2a3a54;
      --text:      #e8edf5;
      --muted:     #7a8ba0;
      --accent:    #3b82f6;
      --accent2:   #60a5fa;
      --green:     #22c55e;
      --red:       #ef4444;
      --amber:     #f59e0b;
      --radius:    12px;
      --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }

    html, body {
      height: 100%;
      background: var(--bg);
      color: var(--text);
      font-family: var(--font);
      -webkit-font-smoothing: antialiased;
      overscroll-behavior: none;
    }

    /* ── Screens ──────────────────────────────────────────────────── */
    .screen {
      display: none;
      min-height: 100dvh;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px 20px;
      padding-top: max(24px, env(safe-area-inset-top));
      padding-bottom: max(24px, env(safe-area-inset-bottom));
      animation: fadeIn 0.3s ease;
    }
    .screen.active { display: flex; }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* ── Logo / wordmark ──────────────────────────────────────────── */
    .logo {
      font-size: 13px;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 48px;
      text-align: center;
    }
    .logo strong {
      display: block;
      font-size: 22px;
      font-weight: 700;
      letter-spacing: 0.04em;
      color: var(--text);
      margin-bottom: 4px;
    }

    /* ── Card ─────────────────────────────────────────────────────── */
    .card {
      width: 100%;
      max-width: 400px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 32px 28px;
    }

    .card-title {
      font-size: 22px;
      font-weight: 700;
      margin-bottom: 8px;
      line-height: 1.3;
    }
    .card-sub {
      font-size: 14px;
      color: var(--muted);
      margin-bottom: 28px;
      line-height: 1.6;
    }

    /* ── Inputs ───────────────────────────────────────────────────── */
    label {
      display: block;
      font-size: 12px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 8px;
    }

    input[type="email"],
    input[type="text"],
    input[type="number"] {
      width: 100%;
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      font-size: 20px;
      font-family: var(--font);
      padding: 14px 16px;
      outline: none;
      transition: border-color 0.2s;
      -webkit-appearance: none;
    }
    input:focus { border-color: var(--accent); }
    input::placeholder { color: var(--border); }

    /* PIN input — big and obvious */
    .pin-input {
      text-align: center;
      letter-spacing: 0.3em;
      font-size: 32px;
      font-weight: 700;
    }

    /* ── Buttons ──────────────────────────────────────────────────── */
    .btn {
      display: block;
      width: 100%;
      padding: 16px;
      border: none;
      border-radius: 8px;
      font-size: 16px;
      font-weight: 600;
      font-family: var(--font);
      cursor: pointer;
      transition: opacity 0.15s, transform 0.1s;
      margin-top: 20px;
      letter-spacing: 0.01em;
    }
    .btn:active { transform: scale(0.98); }
    .btn:disabled { opacity: 0.45; cursor: not-allowed; }

    .btn-primary { background: var(--accent); color: #fff; }
    .btn-primary:hover:not(:disabled) { opacity: 0.88; }

    .btn-ghost {
      background: transparent;
      color: var(--muted);
      border: 1px solid var(--border);
      margin-top: 12px;
      font-size: 14px;
    }
    .btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }

    /* ── Inline link ──────────────────────────────────────────────── */
    .link {
      background: none;
      border: none;
      color: var(--accent2);
      font-size: 14px;
      cursor: pointer;
      text-decoration: underline;
      font-family: var(--font);
      display: inline;
      padding: 0;
    }

    /* ── Status / error ───────────────────────────────────────────── */
    .status {
      font-size: 14px;
      margin-top: 14px;
      min-height: 20px;
      text-align: center;
      color: var(--muted);
      line-height: 1.5;
    }
    .status.error   { color: var(--red); }
    .status.success { color: var(--green); }

    /* ── PIN reveal box ───────────────────────────────────────────── */
    .pin-box {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 20px;
      text-align: center;
      margin: 20px 0;
    }
    .pin-box .pin-number {
      font-size: 48px;
      font-weight: 800;
      letter-spacing: 0.2em;
      color: var(--accent2);
      display: block;
    }
    .pin-box .pin-label {
      font-size: 12px;
      color: var(--muted);
      margin-top: 6px;
      text-transform: uppercase;
      letter-spacing: 0.1em;
    }

    /* ── Divider ──────────────────────────────────────────────────── */
    .divider {
      display: flex;
      align-items: center;
      gap: 12px;
      margin: 20px 0;
      color: var(--muted);
      font-size: 12px;
    }
    .divider::before, .divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border);
    }

    /* ── App screen — the real thing ──────────────────────────────── */
    #screen-app {
      justify-content: flex-start;
      padding-top: max(20px, env(safe-area-inset-top));
    }

    .app-header {
      width: 100%;
      max-width: 480px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 0 20px 0;
      border-bottom: 1px solid var(--border);
      margin-bottom: 24px;
    }
    .app-header-name {
      font-size: 13px;
      color: var(--muted);
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }
    .app-header-user {
      font-size: 13px;
      color: var(--muted);
    }

    /* ── Where Do I Go button ─────────────────────────────────────── */
    .wdig-wrap {
      width: 100%;
      max-width: 480px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      margin-bottom: 32px;
    }

    .wdig-btn {
      width: 200px;
      height: 200px;
      border-radius: 50%;
      background: var(--accent);
      border: none;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
      box-shadow: 0 0 0 0 rgba(59,130,246,0.4);
      transition: transform 0.15s, box-shadow 0.15s;
      color: #fff;
    }
    .wdig-btn:active { transform: scale(0.96); }
    .wdig-btn .wdig-label {
      font-size: 15px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-align: center;
      line-height: 1.3;
    }
    .wdig-btn .wdig-arrow {
      font-size: 32px;
      line-height: 1;
    }
    .wdig-btn.pulse {
      animation: pulse 2.5s infinite;
    }
    @keyframes pulse {
      0%   { box-shadow: 0 0 0 0 rgba(59,130,246,0.5); }
      70%  { box-shadow: 0 0 0 28px rgba(59,130,246,0); }
      100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
    }

    .wdig-phase {
      font-size: 12px;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--muted);
    }

    /* ── Onboarding cards ─────────────────────────────────────────── */
    .onboard-step {
      width: 100%;
      max-width: 400px;
    }

    .step-hint {
      font-size: 13px;
      color: var(--muted);
      margin-top: 16px;
      text-align: center;
      line-height: 1.6;
    }
    .pronoun-chip {
      padding: 7px 16px;
      border-radius: 20px;
      border: 1px solid var(--border);
      background: transparent;
      color: var(--muted);
      font-size: 13px;
      cursor: pointer;
      transition: border-color 0.15s, color 0.15s, background 0.15s;
    }
    .pronoun-chip.active {
      border-color: var(--accent2);
      color: var(--accent2);
      background: rgba(100,180,255,0.08);
    }
    .pronoun-chip:hover:not(.active) {
      border-color: var(--accent);
      color: var(--text);
    }

    /* ── Quick cards strip ────────────────────────────────────────── */
    .cards-strip {
      width: 100%;
      max-width: 480px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .quick-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px 18px;
      display: flex;
      align-items: center;
      gap: 14px;
      cursor: pointer;
      transition: border-color 0.15s;
    }
    .quick-card:hover { border-color: var(--accent); }
    .quick-card .qc-icon { font-size: 22px; flex-shrink: 0; }
    .quick-card .qc-body { flex: 1; }
    .quick-card .qc-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
    .quick-card .qc-sub   { font-size: 12px; color: var(--muted); }
    .quick-card .qc-arrow { color: var(--muted); font-size: 16px; }

    /* ── Spinner ──────────────────────────────────────────────────── */
    .spinner {
      width: 32px;
      height: 32px;
      border: 3px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
      margin: 0 auto 16px;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ── Language picker chips ────────────────────────────────────── */
    .lang-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin-bottom: 20px;
    }
    .lang-chip {
      background: var(--bg2);
      border: 2px solid var(--border);
      border-radius: 8px;
      padding: 12px 10px;
      text-align: center;
      cursor: pointer;
      font-size: 14px;
      font-family: var(--font);
      color: var(--text);
      transition: border-color 0.15s, background 0.15s;
    }
    .lang-chip:hover { border-color: var(--accent); }
    .lang-chip.selected {
      border-color: var(--accent);
      background: rgba(59,130,246,0.15);
      color: var(--accent2);
    }
    .lang-chip .lang-flag { font-size: 20px; display: block; margin-bottom: 4px; }

    /* ── Wren working screen ─────────────────────────────────────── */
    .wren-working {
      text-align: center;
      padding: 40px 20px;
    }
    .wren-spinner-wrap {
      position: relative;
      width: 80px;
      height: 80px;
      margin: 0 auto 24px;
    }
    .wren-spinner {
      width: 80px;
      height: 80px;
      border: 3px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
    .wren-icon {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 28px;
    }
    .wren-working-title {
      font-size: 20px;
      font-weight: 700;
      margin-bottom: 8px;
    }
    .wren-working-sub {
      font-size: 14px;
      color: var(--muted);
      line-height: 1.6;
      max-width: 300px;
      margin: 0 auto;
    }
    .wren-working-dots span {
      animation: blink 1.4s infinite both;
      color: var(--accent2);
    }
    .wren-working-dots span:nth-child(2) { animation-delay: 0.2s; }
    .wren-working-dots span:nth-child(3) { animation-delay: 0.4s; }
    @keyframes blink { 0%,80%,100%{opacity:0} 40%{opacity:1} }

    /* ── Phrase card display ─────────────────────────────────────── */
    #screen-phrase-cards {
      justify-content: flex-start;
      padding-top: max(20px, env(safe-area-inset-top));
    }
    .cards-header {
      width: 100%;
      max-width: 480px;
      display: flex;
      align-items: center;
      gap: 12px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 20px;
    }
    .cards-header-back {
      background: none;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      padding: 8px 12px;
      font-size: 14px;
      font-family: var(--font);
      cursor: pointer;
    }
    .cards-header-title {
      flex: 1;
      font-size: 16px;
      font-weight: 600;
    }
    .cards-header-dest {
      font-size: 13px;
      color: var(--muted);
    }

    /* The swipeable card stack */
    .phrase-cards-list {
      width: 100%;
      max-width: 480px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      overflow-y: auto;
      padding-bottom: 40px;
    }

    .phrase-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 20px 20px 16px;
      position: relative;
    }
    .phrase-card.critical {
      border-color: rgba(239,68,68,0.5);
      background: rgba(239,68,68,0.06);
    }
    .phrase-card .pc-context {
      font-size: 11px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 10px;
    }
    .phrase-card.critical .pc-context { color: var(--red); }
    .phrase-card .pc-local {
      font-size: 26px;
      font-weight: 700;
      line-height: 1.3;
      margin-bottom: 8px;
      color: var(--text);
    }
    .phrase-card .pc-phonetic {
      font-size: 14px;
      color: var(--accent2);
      margin-bottom: 6px;
      font-style: italic;
    }
    .phrase-card .pc-divider {
      height: 1px;
      background: var(--border);
      margin: 10px 0;
    }
    .phrase-card .pc-lang-badge {
      display: inline-block;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 4px;
      font-size: 11px;
      padding: 2px 7px;
      color: var(--muted);
      margin-bottom: 8px;
    }
    /* BIG show-to-driver button */
    .pc-show-btn {
      display: block;
      width: 100%;
      margin-top: 12px;
      padding: 14px;
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: 8px;
      font-size: 15px;
      font-weight: 700;
      font-family: var(--font);
      cursor: pointer;
      letter-spacing: 0.02em;
      transition: opacity 0.15s;
    }
    .pc-show-btn:active { opacity: 0.8; }
    .phrase-card.critical .pc-show-btn {
      background: var(--red);
    }

    /* Full-screen show mode (show to driver) */
    .fullscreen-card {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 9999;
      background: #fff;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 32px 24px;
      text-align: center;
    }
    .fullscreen-card.active { display: flex; }
    .fullscreen-card .fc-lang {
      font-size: 13px;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: #999;
      margin-bottom: 16px;
    }
    .fullscreen-card .fc-phrase {
      font-size: 36px;
      font-weight: 800;
      color: #111;
      line-height: 1.3;
      margin-bottom: 20px;
    }
    .fullscreen-card .fc-phonetic {
      font-size: 18px;
      color: #555;
      font-style: italic;
      margin-bottom: 32px;
    }
    .fullscreen-card .fc-dismiss {
      position: absolute;
      bottom: 40px;
      left: 50%;
      transform: translateX(-50%);
      background: #111;
      color: #fff;
      border: none;
      border-radius: 8px;
      padding: 14px 32px;
      font-size: 16px;
      font-weight: 600;
      font-family: var(--font);
      cursor: pointer;
    }
    .fullscreen-card.danger { background: #fff0f0; }
    .fullscreen-card.danger .fc-phrase { color: #c00; }

    /* ── Authorized flash ─────────────────────────────────────────── */
    .auth-flash {
      text-align: center;
    }
    .auth-flash .auth-mark {
      font-size: 64px;
      display: block;
      margin-bottom: 16px;
    }
    .auth-flash .auth-word {
      font-size: 28px;
      font-weight: 800;
      letter-spacing: 0.06em;
      color: var(--green);
      display: block;
      margin-bottom: 8px;
    }
    .auth-flash .auth-sub {
      font-size: 15px;
      color: var(--muted);
    }

    /* ── WDIG Answer screen ───────────────────────────────────────── */
    #screen-wdig {
      justify-content: flex-start;
      padding-top: max(20px, env(safe-area-inset-top));
    }
    .wdig-answer-wrap {
      width: 100%;
      max-width: 480px;
    }
    .wdig-back {
      background: none;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      padding: 8px 12px;
      font-size: 14px;
      font-family: var(--font);
      cursor: pointer;
      margin-bottom: 24px;
    }
    .wdig-answer-phase {
      font-size: 11px;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 10px;
    }
    .wdig-answer-main {
      font-size: 28px;
      font-weight: 800;
      line-height: 1.25;
      color: var(--text);
      margin-bottom: 12px;
    }
    .wdig-answer-detail {
      font-size: 15px;
      color: var(--muted);
      line-height: 1.6;
      margin-bottom: 32px;
    }
    .wdig-answer-trip {
      display: flex;
      align-items: center;
      gap: 10px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 14px 16px;
      margin-bottom: 24px;
      font-size: 14px;
    }
    .wdig-answer-trip .trip-name { font-weight: 600; }
    .wdig-answer-trip .trip-dest { color: var(--muted); font-size: 13px; }
    .wdig-answer-actions {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .wdig-advance-btn {
      display: block;
      width: 100%;
      padding: 16px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      font-size: 15px;
      font-weight: 600;
      font-family: var(--font);
      cursor: pointer;
      text-align: left;
      transition: border-color 0.15s;
    }
    .wdig-advance-btn:hover { border-color: var(--accent); }
    .wdig-advance-btn .adv-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; }
    .wdig-advance-btn .adv-next  { color: var(--accent2); }

    /* ── Turbulence Protocol screen ───────────────────────────────── */
    #screen-turbulence {
      justify-content: flex-start;
      padding-top: max(20px, env(safe-area-inset-top));
      background: #070b15;
    }
    .turb-wrap {
      width: 100%;
      max-width: 480px;
    }
    .turb-back {
      background: none;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      padding: 8px 12px;
      font-size: 14px;
      font-family: var(--font);
      cursor: pointer;
      margin-bottom: 28px;
    }
    .turb-headline {
      font-size: 22px;
      font-weight: 800;
      color: var(--text);
      margin-bottom: 6px;
      line-height: 1.3;
    }
    .turb-subhead {
      font-size: 14px;
      color: var(--muted);
      margin-bottom: 32px;
      line-height: 1.6;
    }

    /* Breathing circle */
    .breathing-section {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-bottom: 36px;
    }
    .breathing-label {
      font-size: 12px;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 20px;
    }
    .breath-circle-wrap {
      position: relative;
      width: 140px;
      height: 140px;
      margin-bottom: 16px;
    }
    .breath-ring {
      width: 140px;
      height: 140px;
      border-radius: 50%;
      border: 3px solid var(--border);
      position: absolute;
      inset: 0;
    }
    .breath-core {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      background: rgba(59,130,246,0.15);
      border: 2px solid var(--accent);
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      animation: breathe 8s ease-in-out infinite;
    }
    @keyframes breathe {
      0%,100% { transform: translate(-50%,-50%) scale(0.7); opacity: 0.5; }
      45%      { transform: translate(-50%,-50%) scale(1.15); opacity: 1; }
      55%      { transform: translate(-50%,-50%) scale(1.15); opacity: 1; }
    }
    .breath-instruction {
      font-size: 14px;
      color: var(--accent2);
      letter-spacing: 0.05em;
      animation: breathe-text 8s ease-in-out infinite;
    }
    @keyframes breathe-text {
      0%,100% { opacity: 0.5; content: ''; }
      25%  { opacity: 1; }
      50%  { opacity: 0.7; }
    }

    /* Jello theory block */
    .jello-block {
      background: var(--surface);
      border: 1px solid var(--border);
      border-left: 3px solid var(--accent);
      border-radius: var(--radius);
      padding: 20px 20px;
      margin-bottom: 24px;
    }
    .jello-block .jello-title {
      font-size: 13px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 10px;
    }
    .jello-block .jello-text {
      font-size: 16px;
      line-height: 1.65;
      color: var(--text);
    }
    .jello-block .jello-text strong { color: var(--accent2); }

    /* Kinetic commands */
    .kinetic-section {
      margin-bottom: 32px;
    }
    .kinetic-label {
      font-size: 12px;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 14px;
    }
    .kinetic-commands {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .kinetic-cmd {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 14px 16px;
      font-size: 16px;
      font-weight: 700;
      color: var(--text);
      letter-spacing: 0.02em;
    }
    .kinetic-cmd .cmd-num {
      font-size: 11px;
      color: var(--muted);
      font-weight: 400;
      margin-right: 10px;
      letter-spacing: 0.08em;
    }

    /* Offline badge */
    .offline-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: rgba(34,197,94,0.1);
      border: 1px solid rgba(34,197,94,0.3);
      border-radius: 20px;
      padding: 4px 12px;
      font-size: 12px;
      color: var(--green);
      letter-spacing: 0.06em;
      margin-bottom: 28px;
    }

    /* ── Assistance screen ─────────────────────────────────────────────── */
    #screen-assistance {
      justify-content: flex-start;
      padding-top: max(20px, env(safe-area-inset-top));
      background: #0a0a0f;
    }
    .assistance-wrap {
      width: 100%;
      max-width: 480px;
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    .assistance-header {
      width: 100%;
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 28px;
    }
    .assistance-back {
      background: none;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      padding: 8px 12px;
      font-size: 14px;
      font-family: var(--font);
      cursor: pointer;
    }
    .assistance-title {
      font-size: 16px;
      font-weight: 700;
      flex: 1;
    }
    /* The hold button — the heart of the assistance UX */
    .assistance-hold-zone {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-bottom: 32px;
    }
    .assistance-hold-label {
      font-size: 12px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 18px;
    }
    .assistance-btn {
      width: 180px;
      height: 180px;
      border-radius: 50%;
      border: 3px solid rgba(239,68,68,0.4);
      background: rgba(239,68,68,0.08);
      color: #f87171;
      font-size: 15px;
      font-weight: 700;
      font-family: var(--font);
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: background 0.15s, border-color 0.15s, transform 0.1s;
      user-select: none;
      -webkit-user-select: none;
      touch-action: none;
      position: relative;
      outline: none;
    }
    .assistance-btn:active, .assistance-btn.holding {
      background: rgba(239,68,68,0.18);
      border-color: rgba(239,68,68,0.8);
      transform: scale(0.97);
    }
    .assistance-btn.level-2 { border-color: rgba(251,146,60,0.8); color: #fb923c; background: rgba(251,146,60,0.12); }
    .assistance-btn.level-3 { border-color: rgba(239,68,68,0.9); color: #f87171; background: rgba(239,68,68,0.18); }
    .assistance-btn.level-4 { border-color: #ef4444; color: #fff; background: rgba(239,68,68,0.35); animation: assistance-pulse 1s ease-in-out infinite; }
    @keyframes assistance-pulse {
      0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
      50%      { box-shadow: 0 0 0 20px rgba(239,68,68,0); }
    }
    .assistance-btn-icon { font-size: 32px; line-height: 1; }
    .assistance-btn-text { font-size: 13px; font-weight: 700; letter-spacing: 0.05em; }
    /* Fill ring around button showing hold progress */
    .assistance-progress-ring {
      position: absolute;
      top: -6px; left: -6px;
      width: 192px; height: 192px;
      border-radius: 50%;
      pointer-events: none;
    }
    .assistance-progress-ring circle {
      fill: none;
      stroke: #ef4444;
      stroke-width: 4;
      stroke-dasharray: 565;
      stroke-dashoffset: 565;
      stroke-linecap: round;
      transform: rotate(-90deg);
      transform-origin: 50% 50%;
      transition: stroke-dashoffset 0.1s linear;
    }
    .assistance-level-indicator {
      margin-top: 14px;
      font-size: 12px;
      color: var(--muted);
      letter-spacing: 0.08em;
      text-transform: uppercase;
      min-height: 18px;
    }
    /* Response area — shown after signal sent */
    .assistance-response {
      width: 100%;
      display: none;
      flex-direction: column;
      gap: 12px;
    }
    .assistance-response.visible { display: flex; }
    .assistance-response-level {
      font-size: 11px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 4px;
    }
    .assistance-response-label {
      font-size: 22px;
      font-weight: 800;
      color: var(--text);
      margin-bottom: 12px;
    }
    .assistance-instruction {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px 16px;
      font-size: 16px;
      font-weight: 600;
      line-height: 1.5;
      color: var(--text);
    }
    .assistance-wren-note {
      font-size: 14px;
      color: var(--muted);
      font-style: italic;
      text-align: center;
      padding: 4px 8px;
    }
    /* Level 2: bilingual help card */
    .assistance-help-card {
      background: #fff;
      border-radius: 14px;
      padding: 20px;
      text-align: center;
      display: none;
    }
    .assistance-help-card.visible { display: block; }
    .assistance-help-english {
      font-size: 18px;
      font-weight: 700;
      color: #111;
      margin-bottom: 10px;
      line-height: 1.4;
    }
    .assistance-help-note {
      font-size: 13px;
      color: #555;
    }
    /* Level 3: safe question */
    .assistance-safe-question {
      display: none;
      flex-direction: column;
      gap: 10px;
      width: 100%;
    }
    .assistance-safe-question.visible { display: flex; }
    .assistance-safe-q-text {
      font-size: 20px;
      font-weight: 700;
      color: var(--text);
      text-align: center;
      margin-bottom: 4px;
    }
    .assistance-safe-yes {
      background: rgba(34,197,94,0.15);
      border: 2px solid rgba(34,197,94,0.5);
      border-radius: 12px;
      color: #4ade80;
      font-size: 18px;
      font-weight: 700;
      font-family: var(--font);
      padding: 16px;
      cursor: pointer;
      width: 100%;
    }
    .assistance-safe-no {
      background: rgba(239,68,68,0.15);
      border: 2px solid rgba(239,68,68,0.5);
      border-radius: 12px;
      color: #f87171;
      font-size: 18px;
      font-weight: 700;
      font-family: var(--font);
      padding: 16px;
      cursor: pointer;
      width: 100%;
    }
    /* Level 4: emergency full */
    .assistance-emergency-banner {
      display: none;
      background: #ef4444;
      border-radius: 12px;
      padding: 18px;
      text-align: center;
      width: 100%;
    }
    .assistance-emergency-banner.visible { display: block; }
    .assistance-emergency-banner h2 { color: #fff; font-size: 20px; margin-bottom: 6px; }
    .assistance-emergency-banner p { color: rgba(255,255,255,0.85); font-size: 14px; }
    /* I'm safe / resolve button */
    .assistance-im-safe {
      background: none;
      border: 2px solid rgba(34,197,94,0.5);
      border-radius: 12px;
      color: #4ade80;
      font-size: 16px;
      font-weight: 700;
      font-family: var(--font);
      padding: 14px;
      cursor: pointer;
      width: 100%;
      display: none;
    }
    .assistance-im-safe.visible { display: block; }
    /* Contacts section */
    .assistance-contacts-section {
      width: 100%;
      margin-top: 8px;
    }
    .assistance-contacts-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--muted);
      letter-spacing: 0.06em;
      text-transform: uppercase;
      margin-bottom: 10px;
    }
    .assistance-contact-row {
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 14px;
      margin-bottom: 8px;
    }
    .assistance-contact-name { font-size: 15px; font-weight: 600; flex: 1; }
    .assistance-contact-rel  { font-size: 12px; color: var(--muted); }
    .assistance-contact-del  { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
    .assistance-add-contact {
      background: none;
      border: 1px dashed var(--border);
      border-radius: 10px;
      color: var(--muted);
      font-size: 14px;
      font-family: var(--font);
      padding: 12px;
      cursor: pointer;
      width: 100%;
      text-align: center;
    }
    .assistance-add-contact:hover { border-color: var(--accent); color: var(--accent); }
    /* Add contact form */
    .assistance-add-form {
      display: none;
      flex-direction: column;
      gap: 8px;
      margin-top: 6px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 14px;
    }
    .assistance-add-form.visible { display: flex; }
    .assistance-add-form input {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      font-size: 15px;
      font-family: var(--font);
      padding: 10px 12px;
      width: 100%;
      box-sizing: border-box;
    }
    .assistance-add-form-row { display: flex; gap: 8px; }
    .assistance-save-contact {
      background: var(--accent);
      border: none;
      border-radius: 8px;
      color: #fff;
      font-size: 14px;
      font-weight: 700;
      font-family: var(--font);
      padding: 10px;
      cursor: pointer;
      flex: 1;
    }
    .assistance-cancel-contact {
      background: none;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--muted);
      font-size: 14px;
      font-family: var(--font);
      padding: 10px;
      cursor: pointer;
    }

    /* ── My Trips screen ──────────────────────────────────────────── */
    #screen-trips {
      justify-content: flex-start;
      padding-top: max(20px, env(safe-area-inset-top));
    }
    .trips-header {
      width: 100%;
      max-width: 480px;
      display: flex;
      align-items: center;
      gap: 12px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 20px;
    }
    .trips-header-back {
      background: none;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      padding: 8px 12px;
      font-size: 14px;
      font-family: var(--font);
      cursor: pointer;
    }
    .trips-header-title {
      font-size: 18px;
      font-weight: 700;
      flex: 1;
    }
    .trips-list {
      width: 100%;
      max-width: 480px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      overflow-y: auto;
      padding-bottom: 40px;
    }
    .trip-row {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px 18px;
      cursor: pointer;
      transition: border-color 0.15s;
      display: flex;
      align-items: center;
      gap: 14px;
    }
    .trip-row:hover { border-color: var(--accent); }
    .trip-row.active-trip { border-color: rgba(59,130,246,0.5); }
    .trip-row .tr-icon { font-size: 24px; flex-shrink: 0; }
    .trip-row .tr-body { flex: 1; min-width: 0; }
    .trip-row .tr-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .trip-row .tr-dest { font-size: 13px; color: var(--muted); }
    .trip-row .tr-phase {
      font-size: 11px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--accent2);
      white-space: nowrap;
    }
    .trips-empty {
      text-align: center;
      color: var(--muted);
      font-size: 15px;
      padding: 40px 0;
    }

    /* ================================================================
       FLORENCE — live chat screen
    ================================================================ */
    #screen-florence.active {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      justify-content: flex-start;
      padding: 0;
      height: 100dvh;
    }

    .flr-identity {
      padding-top: calc(44px + 14px); /* 44px frame header + visual padding */
      padding-left: 20px;
      padding-right: 20px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    .flr-name   { font-size: 16px; font-weight: 600; color: var(--text); }
    .flr-status { font-size: 13px; color: var(--muted); margin-left: 8px; }

    .flr-messages {
      flex: 1;
      overflow-y: auto;
      padding: 16px 20px 8px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      -webkit-overflow-scrolling: touch;
    }

    .flr-msg {
      max-width: 82%;
      padding: 10px 14px;
      font-size: 15px;
      line-height: 1.55;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .flr-msg-vip {
      background: var(--bg2);
      border-radius: 14px 14px 14px 4px;
      align-self: flex-start;
    }
    .flr-msg-user {
      background: rgba(59,130,246,0.22);
      border-radius: 14px 14px 4px 14px;
      align-self: flex-end;
    }

    /* Typing indicator */
    .flr-typing {
      display: flex;
      gap: 5px;
      padding: 12px 14px;
      background: var(--bg2);
      border-radius: 14px 14px 14px 4px;
      align-self: flex-start;
      width: fit-content;
    }
    .flr-typing span {
      width: 7px; height: 7px;
      background: var(--muted);
      border-radius: 50%;
      animation: flrBounce 1.2s ease-in-out infinite;
    }
    .flr-typing span:nth-child(2) { animation-delay: 0.18s; }
    .flr-typing span:nth-child(3) { animation-delay: 0.36s; }
    @keyframes flrBounce {
      0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
      40% { transform: translateY(-6px); opacity: 1; }
    }

    /* Suggested action chips */
    .flr-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-self: flex-start;
      max-width: 90%;
    }
    .flr-action-chip {
      font-size: 13px;
      padding: 6px 13px;
      border-radius: 20px;
      background: rgba(59,130,246,0.13);
      border: 1px solid rgba(59,130,246,0.32);
      color: var(--accent2);
      cursor: pointer;
    }
    .flr-action-chip:active { background: rgba(59,130,246,0.25); }

    /* Escalation card */
    .flr-escalate-card {
      background: rgba(239,68,68,0.1);
      border: 1px solid rgba(239,68,68,0.3);
      border-radius: 12px;
      padding: 12px 16px;
      cursor: pointer;
      align-self: flex-start;
      max-width: 90%;
    }
    .flr-escalate-card:active { background: rgba(239,68,68,0.2); }
    .flr-esc-label { font-size: 14px; font-weight: 600; color: var(--red); }
    .flr-esc-sub   { font-size: 12px; color: var(--muted); margin-top: 3px; }

    /* Input area */
    .flr-input-wrap {
      display: flex;
      align-items: flex-end;
      gap: 10px;
      padding: 10px 16px calc(56px + 12px); /* 56px bottom nav + visual padding */
      border-top: 1px solid var(--border);
      background: var(--bg);
      flex-shrink: 0;
    }
    .flr-input {
      flex: 1;
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 10px 16px;
      color: var(--text);
      font-family: var(--font);
      font-size: 15px;
      line-height: 1.4;
      resize: none;
      max-height: 130px;
      overflow-y: auto;
    }
    .flr-input::placeholder { color: var(--muted); }
    .flr-input:focus { outline: none; border-color: var(--accent); }
    .flr-send {
      width: 42px; height: 42px;
      border-radius: 50%;
      background: var(--accent);
      color: #fff;
      font-size: 19px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      cursor: pointer;
    }
    .flr-send:active { background: var(--accent2); }

    /* ================================================================
       THE FRAME — header bar + right slider rail + bottom nav.
       pointer-events: none on frame root; all on interactive children.
       body.tam-active added by JS when frame is shown.
    ================================================================ */

    #tam-frame {
      display: none;
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 500;
    }

    /* Screens shift to avoid the header and bottom nav */
    body.tam-active .screen {
      padding-top: 44px;
      padding-bottom: 56px;
    }

    /* ── Header bar ─────────────────────────────────────────────── */
    #frame-header {
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 44px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      pointer-events: all;
      background: var(--bg);
      border-bottom: 1px solid rgba(42, 58, 84, 0.45);
      z-index: 10;
    }
    #frame-logo {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.22em;
      text-transform: uppercase;
      color: rgba(122, 139, 160, 0.55);
      pointer-events: none;
      user-select: none;
    }
    #frame-ham-btn, #frame-account-btn {
      background: none;
      border: none;
      color: rgba(122, 139, 160, 0.6);
      font-size: 18px;
      padding: 8px;
      cursor: pointer;
      pointer-events: all;
      -webkit-tap-highlight-color: transparent;
      line-height: 1;
      transition: color 0.2s;
    }
    #frame-ham-btn:hover, #frame-ham-btn:active,
    #frame-account-btn:hover, #frame-account-btn:active { color: var(--muted); }

    /* ── Border pieces ───────────────────────────────────────────── */
    .fb { position: absolute; background: rgba(42, 58, 84, 0.45); pointer-events: none; }
    /* Left decorative line */
    .fb-left { left: 8px; top: 44px; bottom: 56px; width: 1px; }
    /* Right border: two pieces — above and below the slider track */
    .fb-right-u { right: 8px; top: 44px;             height: 15%; width: 1px; }
    .fb-right-l { right: 8px; top: calc(44px + 55%); bottom: 56px; width: 1px; }

    /* ── Slider track (right rail, 15%–55% between header and footer) ── */
    #frame-slider {
      position: absolute;
      right: 8px;
      top: calc(44px + 15%);
      width: 1px;
      height: 40%;
      pointer-events: none;
      overflow: visible;
    }

    #fs-above {
      position: absolute;
      top: 0; left: 0;
      width: 1px;
      background: rgba(34, 197, 94, 0.22);
      height: 100%;
    }

    #fs-below {
      position: absolute;
      bottom: 0; left: 0;
      width: 1px;
      background: rgba(239, 68, 68, 0.7);
      height: 0;
    }

    #fs-dot {
      position: absolute;
      left: -4px;
      top: calc(100% - 9px);
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.88);
      box-shadow: 0 0 5px 1px rgba(255, 255, 255, 0.3);
      pointer-events: none;
      transition: box-shadow 0.3s ease;
    }
    #fs-dot.elevated {
      box-shadow: 0 0 8px 3px rgba(239, 68, 68, 0.55),
                  0 0 3px 1px rgba(255, 255, 255, 0.9);
    }

    #fs-touch {
      position: absolute;
      top: -20px;
      bottom: -20px;
      right: -14px;
      width: 30px;
      pointer-events: all;
      cursor: ns-resize;
      background: transparent;
      -webkit-tap-highlight-color: transparent;
    }

    /* Tooltip — appears to the left of the right-side dot */
    #frame-slider-tip {
      position: absolute;
      right: 18px;
      top: 50%;
      background: rgba(17, 24, 39, 0.92);
      border: 1px solid rgba(42, 58, 84, 0.8);
      border-radius: 6px;
      padding: 5px 10px;
      font-size: 11px;
      color: var(--muted);
      font-family: var(--font);
      font-style: italic;
      white-space: nowrap;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.2s ease;
      letter-spacing: 0.02em;
    }
    #frame-slider-tip.visible { opacity: 1; }

    /* ── Bottom nav bar ─────────────────────────────────────────── */
    #frame-bottom-nav {
      position: absolute;
      bottom: 0; left: 0; right: 0;
      height: 56px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 8px;
      padding-bottom: env(safe-area-inset-bottom);
      pointer-events: all;
      background: var(--bg);
      border-top: 1px solid rgba(42, 58, 84, 0.45);
    }
    #frame-ham-bot {
      background: none;
      border: none;
      color: rgba(122, 139, 160, 0.6);
      font-size: 18px;
      padding: 8px 10px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      line-height: 1;
      transition: color 0.2s;
    }
    #frame-ham-bot:hover, #frame-ham-bot:active { color: var(--muted); }
    #frame-nav-center {
      display: flex;
      align-items: center;
      flex: 1;
      justify-content: center;
    }
    .fnav-c {
      background: none;
      border: none;
      color: var(--muted);
      font-size: 12px;
      font-family: var(--font);
      font-weight: 500;
      padding: 8px 9px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      transition: color 0.15s;
      white-space: nowrap;
      letter-spacing: 0.02em;
    }
    .fnav-c:hover, .fnav-c:active, .fnav-c.active { color: var(--text); }
    #frame-ctx-btn {
      background: none;
      border: none;
      color: rgba(122, 139, 160, 0.6);
      font-size: 20px;
      padding: 8px 10px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      line-height: 1;
      transition: color 0.2s;
    }
    #frame-ctx-btn:hover, #frame-ctx-btn:active { color: var(--muted); }

    /* Countdown — floats above bottom nav */
    #frame-countdown {
      position: absolute;
      bottom: 60px;
      left: 20px;
      font-size: 7px;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: rgba(122, 139, 160, 0.5);
      font-family: var(--font);
      pointer-events: none;
      user-select: none;
      line-height: 1;
    }

    /* Med alert — floats above bottom nav */
    #frame-medi-btn {
      position: absolute;
      bottom: 60px;
      left: 50%;
      transform: translateX(-50%);
      background: none;
      border: none;
      padding: 0 4px;
      font-size: 11px;
      color: rgba(239, 68, 68, 0.75);
      cursor: pointer;
      pointer-events: all;
      -webkit-tap-highlight-color: transparent;
      line-height: 1;
      white-space: nowrap;
    }
    #frame-medi-btn:hover { color: var(--red); }

    /* ── Left menu (slide in from left) ─────────────────────────── */
    #frame-left-menu { display: none; position: fixed; inset: 0; z-index: 600; }
    #frame-left-menu.open { display: block; }
    #flm-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
    #flm-panel {
      position: absolute;
      top: 0; left: 0; bottom: 0;
      width: min(280px, 80vw);
      background: var(--bg2);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      animation: slideInLeft 0.22s ease;
      overflow: hidden;
    }
    @keyframes slideInLeft {
      from { transform: translateX(-100%); }
      to   { transform: translateX(0); }
    }
    #flm-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      padding: 18px 18px 14px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    #flm-trip-name {
      font-size: 15px;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 3px;
    }
    #flm-vip-subtitle {
      font-size: 11px;
      color: var(--muted);
    }
    #flm-close {
      background: none;
      border: none;
      color: var(--muted);
      font-size: 18px;
      cursor: pointer;
      padding: 2px 6px;
      font-family: var(--font);
      flex-shrink: 0;
    }
    #flm-close:hover { color: var(--text); }
    #flm-nav { flex: 1; overflow-y: auto; padding: 6px 0; }

    .flm-section-hdr {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      background: none;
      border: none;
      color: var(--text);
      font-size: 14px;
      font-family: var(--font);
      font-weight: 600;
      text-align: left;
      padding: 11px 18px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      transition: background 0.12s;
    }
    .flm-section-hdr:hover, .flm-section-hdr:active { background: rgba(42,58,84,0.2); }
    .flm-arrow {
      font-size: 10px;
      color: var(--muted);
      transition: transform 0.18s ease;
      pointer-events: none;
      margin-left: 8px;
      flex-shrink: 0;
    }
    .flm-section-hdr.open .flm-arrow { transform: rotate(90deg); }
    .flm-section-hdr.current-stage::before {
      content: '●';
      font-size: 6px;
      color: rgba(34,197,94,0.9);
      margin-right: 8px;
      vertical-align: middle;
    }

    .flm-section-body { display: none; }
    .flm-section-body.open { display: block; animation: expandDown 0.18s ease; }
    @keyframes expandDown {
      from { opacity: 0; transform: translateY(-4px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .flm-item {
      display: block;
      width: 100%;
      background: none;
      border: none;
      color: var(--muted);
      font-size: 13px;
      font-family: var(--font);
      text-align: left;
      padding: 9px 18px 9px 32px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      transition: color 0.12s, background 0.12s;
    }
    .flm-item:hover, .flm-item:active { color: var(--text); background: rgba(42,58,84,0.15); }

    #flm-slider-hint {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 18px;
      border-top: 1px solid var(--border);
      flex-shrink: 0;
    }
    .flm-mini-rail {
      width: 3px;
      height: 40px;
      background: rgba(42,58,84,0.6);
      border-radius: 2px;
      position: relative;
      flex-shrink: 0;
    }
    .flm-mini-dot {
      position: absolute;
      bottom: 0;
      left: -3px;
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: rgba(255,255,255,0.85);
      box-shadow: 0 0 5px 1px rgba(255,255,255,0.3);
    }
    #flm-slider-hint span { font-size: 11px; color: var(--muted); line-height: 1.5; }

    /* ── Right menu (slide in from right) ───────────────────────── */
    #frame-right-menu { display: none; position: fixed; inset: 0; z-index: 600; }
    #frame-right-menu.open { display: block; }
    #frm-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
    #frm-panel {
      position: absolute;
      top: 0; right: 0; bottom: 0;
      width: min(260px, 78vw);
      background: var(--bg2);
      border-left: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      animation: slideInRight 0.22s ease;
      overflow: hidden;
    }
    @keyframes slideInRight {
      from { transform: translateX(100%); }
      to   { transform: translateX(0); }
    }
    #frm-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 18px 18px 14px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    #frm-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.12em;
      color: var(--muted);
    }
    #frm-close {
      background: none; border: none; color: var(--muted);
      font-size: 18px; cursor: pointer; padding: 2px 6px; font-family: var(--font);
    }
    #frm-close:hover { color: var(--text); }
    #frm-context-zone { padding: 6px 0; border-bottom: 1px solid var(--border); }
    #frm-context-zone:empty { display: none; }
    #frm-trips-zone { flex: 1; overflow-y: auto; padding: 6px 0; }
    .frm-zone-label {
      font-size: 10px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.12em; color: var(--muted); padding: 8px 18px 4px;
    }
    .frm-trip-item {
      display: block; width: 100%; background: none; border: none;
      color: var(--text); font-size: 14px; font-family: var(--font);
      text-align: left; padding: 11px 18px; cursor: pointer;
      -webkit-tap-highlight-color: transparent; transition: background 0.12s;
    }
    .frm-trip-item:hover, .frm-trip-item:active { background: rgba(42,58,84,0.2); }
    .frm-trip-item.active-trip { color: rgba(34,197,94,0.9); }
    #frm-new-trip-btn { color: var(--muted); border-top: 1px solid var(--border); margin-top: 8px; }

    /* ── Account menu (slides from right, top section only) ─────── */
    #frame-account-menu { display: none; position: fixed; inset: 0; z-index: 600; }
    #frame-account-menu.open { display: block; }
    #fam-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
    #fam-panel {
      position: absolute;
      top: 0; right: 0;
      width: min(260px, 78vw);
      background: var(--bg2);
      border-left: 1px solid var(--border);
      border-bottom: 1px solid var(--border);
      border-radius: 0 0 0 16px;
      animation: slideInRight 0.22s ease;
    }
    #fam-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 18px 18px 14px;
      border-bottom: 1px solid var(--border);
    }
    #fam-display-name { font-size: 15px; font-weight: 700; color: var(--text); }
    #fam-close {
      background: none; border: none; color: var(--muted);
      font-size: 18px; cursor: pointer; padding: 2px 6px; font-family: var(--font);
    }
    #fam-close:hover { color: var(--text); }
    #fam-nav { padding: 8px 0 16px; }
    .fam-item {
      display: block; width: 100%; background: none; border: none;
      color: var(--text); font-size: 14px; font-family: var(--font);
      text-align: left; padding: 12px 18px; cursor: pointer;
      -webkit-tap-highlight-color: transparent; transition: background 0.12s;
    }
    .fam-item:hover, .fam-item:active { background: rgba(42,58,84,0.2); }

    /* ── Med alert stub modal ───────────────────────────────────── */
    #frame-medi-modal { display: none; position: fixed; inset: 0; z-index: 700; }
    #frame-medi-modal.open { display: block; }
    #frame-medi-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
    #frame-medi-panel {
      position: absolute;
      bottom: 0; left: 0; right: 0;
      background: var(--bg2);
      border-top: 1px solid rgba(239,68,68,0.4);
      border-radius: 16px 16px 0 0;
      padding: 24px 24px;
      padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
    #frame-medi-header {
      display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
    }
    #frame-medi-title { font-size: 17px; font-weight: 700; color: var(--red); }
    #frame-medi-close {
      background: none; border: none; color: var(--muted);
      font-size: 18px; cursor: pointer; padding: 4px 8px; font-family: var(--font);
    }
    #frame-medi-body { font-size: 14px; color: var(--muted); line-height: 1.6; }

    .fam-item-signout { color: var(--muted); margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }

    /* ================================================================
       PHASE BACKGROUNDS — five static gradients keyed to trip phase.
       Applied as class on #screen-app. All share the same blue palette.
    ================================================================ */

    /* Dream — flat ocean, flat sky, a clean straight horizon. The blue of possibility. */
    .bg-dream {
      background: linear-gradient(to top,
        #0a2848 0%, #1a4a7a 35%, #2e6b9e 58%,
        #5ba3d0 75%, #87ceeb 88%, #b8e4f7 100%);
    }

    /* Transit — pre-dawn blue. The world is mostly asleep. You're the one who got up. */
    .bg-transit {
      background: linear-gradient(to top,
        #060e1c 0%, #0d2444 30%, #1a3d6e 52%,
        #2d5f8a 72%, #4a7fa8 88%, #6a9fc4 100%);
    }

    /* Terminal — glass and steel and morning sky pouring through tall airport windows. */
    .bg-terminal {
      background: linear-gradient(160deg,
        #0d2035 0%, #1a4060 30%, #2a6590 55%,
        #3d8ab5 73%, #6ab4d4 88%, #9dd4ea 100%);
    }

    /* Inflight — cloud floor below, deep sky above. You're above the weather now. */
    .bg-inflight {
      background: linear-gradient(to top,
        #c8e8f4 0%, #d8f2fc 12%, #8ec8e8 28%,
        #5aa8d8 48%, #2a7ab8 66%, #1a5090 82%, #0d3070 100%);
    }

    /* The Glory — the curve of the Earth from 35,000 feet. Things are getting brighter. */
    .bg-glory {
      background: linear-gradient(to top,
        #020810 0%, #050f28 12%, #0a1e4a 28%, #1a4a7a 48%,
        #3a7ab8 64%, #6ab4e8 76%, #a8d8f4 88%,
        #d8f0fb 94%, #f4faff 100%);
    }

    /* ================================================================
       CHAT HOME — screen-app is now the Florence conversation.
       Bottom-anchored: history floats up, input is always at the bottom.
    ================================================================ */

    /* frame-logo: override uppercase so "The Airplane Mode App" renders correctly */
    #frame-logo {
      text-transform: none;
      font-size: 10px;
      letter-spacing: 0.06em;
    }

    /* screen-app: fixed height so chat-history overflow-y triggers correctly */
    #screen-app {
      align-items: stretch;
      justify-content: flex-start;
      overflow: hidden;
      padding-left: 0;
      padding-right: 0;
      height: 100dvh;        /* border-box — padding-top 44px + padding-bottom 56px already inside */
      position: relative;    /* anchor for absolutely-positioned children if needed */
      /* padding-top (44px) and padding-bottom (56px) come from body.tam-active .screen */
    }

    /* ── Live data panel — passport + boarding pass strip ──────── */
    #data-panel {
      flex-shrink: 0;
      display: none;           /* shown by JS when any field is filled */
      flex-direction: column;
      gap: 4px;
      padding: 7px 16px;
      border-bottom: 1px solid rgba(255,255,255,0.08);
      background: rgba(0,0,0,0.18);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }
    #data-panel.has-data { display: flex; }

    #dp-passport,
    #dp-boarding {
      display: none;
      font-size: 11px;
      font-family: var(--font);
      color: rgba(255,255,255,0.62);
      letter-spacing: 0.035em;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.5;
    }
    #dp-passport.has-data,
    #dp-boarding.has-data { display: block; }

    /* Chat history — fills space, messages pile from bottom */
    .chat-history {
      flex: 1;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      padding: 8px 16px 8px;
      gap: 8px;
      -webkit-overflow-scrolling: touch;
    }
    /* Spacer that grows so early messages sit at the bottom */
    .chat-history::before {
      content: '';
      flex-shrink: 0;
      flex-grow: 1;
    }

    /* Individual messages */
    .chat-msg {
      max-width: 78%;
      padding: 10px 14px;
      border-radius: 16px;
      font-size: 15px;
      line-height: 1.55;
      word-wrap: break-word;
      animation: chat-msg-in 0.25s ease-out;
    }
    @keyframes chat-msg-in {
      from { opacity: 0; transform: translateY(5px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .chat-msg-flr {
      align-self: flex-start;
      background: rgba(255,255,255,0.12);
      color: rgba(255,255,255,0.96);
      border: 1px solid rgba(255,255,255,0.14);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }

    .chat-msg-user {
      align-self: flex-end;
      background: rgba(255,255,255,0.22);
      color: #fff;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }

    /* Typing indicator */
    .chat-typing {
      display: flex;
      gap: 5px;
      padding: 12px 14px;
      align-self: flex-start;
      background: rgba(255,255,255,0.1);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 14px;
      backdrop-filter: blur(8px);
      animation: chat-msg-in 0.2s ease-out;
    }
    .chat-typing span {
      width: 6px; height: 6px;
      border-radius: 50%;
      background: rgba(255,255,255,0.65);
      animation: chat-dot 1.2s infinite both;
    }
    .chat-typing span:nth-child(2) { animation-delay: 0.2s; }
    .chat-typing span:nth-child(3) { animation-delay: 0.4s; }
    @keyframes chat-dot { 0%,80%,100%{opacity:0.25} 40%{opacity:1} }

    /* Escalation card — shown when Florence recommends help */
    .chat-escalate {
      max-width: 78%;
      align-self: flex-start;
      padding: 12px 16px;
      background: rgba(239,68,68,0.18);
      border: 1px solid rgba(239,68,68,0.38);
      border-radius: 14px;
      cursor: pointer;
      backdrop-filter: blur(8px);
      animation: chat-msg-in 0.2s ease-out;
    }
    .chat-escalate-label { font-size: 14px; font-weight: 600; color: #fca5a5; }
    .chat-escalate-sub   { font-size: 12px; color: rgba(252,165,165,0.8); margin-top: 2px; }

    /* Input area — pinned at bottom; screen's padding-bottom handles nav clearance */
    .chat-input-area {
      flex-shrink: 0;
      padding: 8px 16px;
      background: linear-gradient(to top, rgba(0,0,0,0.22) 0%, transparent 100%);
    }

    /* Suggestion pills — appear above the input after Florence's reply */
    .chat-pills {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 10px;
    }
    .chat-pill {
      padding: 8px 16px;
      border-radius: 20px;
      border: 1px solid rgba(255,255,255,0.35);
      background: rgba(255,255,255,0.1);
      color: rgba(255,255,255,0.95);
      font-size: 14px;
      font-family: var(--font);
      cursor: pointer;
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
      transition: background 0.15s, border-color 0.15s;
      animation: chat-msg-in 0.2s ease-out;
    }
    .chat-pill:hover  { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.55); }
    .chat-pill:active { background: rgba(255,255,255,0.3); }

    /* Pronoun sub-chips — shown during naming step */
    .chat-pronoun-chips {
      display: flex;
      gap: 6px;
      margin-bottom: 8px;
    }
    .chat-pronoun-chip {
      padding: 5px 12px;
      border-radius: 14px;
      border: 1px solid rgba(255,255,255,0.22);
      background: transparent;
      color: rgba(255,255,255,0.6);
      font-size: 12px;
      font-family: var(--font);
      cursor: pointer;
      transition: all 0.15s;
    }
    .chat-pronoun-chip.active {
      background: rgba(255,255,255,0.18);
      color: rgba(255,255,255,0.95);
      border-color: rgba(255,255,255,0.45);
    }

    /* Input row */
    .chat-input-row {
      display: flex;
      gap: 8px;
      align-items: center;
    }

    /* Scroll arrows — hold to scroll chat history */
    .chat-scroll-arrows {
      display: flex;
      flex-direction: column;
      gap: 3px;
      flex-shrink: 0;
    }
    .chat-scroll-arrows button {
      width: 32px;
      height: 22px;
      border-radius: 6px;
      border: 1px solid rgba(255,255,255,0.22);
      background: rgba(255,255,255,0.08);
      color: rgba(255,255,255,0.72);
      font-size: 10px;
      line-height: 1;
      cursor: pointer;
      font-family: var(--font);
      user-select: none;
      -webkit-user-select: none;
      touch-action: none;
      transition: background 0.12s;
    }
    .chat-scroll-arrows button:active {
      background: rgba(255,255,255,0.22);
      color: #fff;
    }
    .chat-input {
      flex: 1;
      background: rgba(255,255,255,0.1);
      border: 1px solid rgba(255,255,255,0.25);
      border-radius: 24px;
      color: #fff;
      padding: 12px 18px;
      font-size: 16px;
      font-family: var(--font);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      transition: border-color 0.15s, background 0.15s;
    }
    .chat-input::placeholder { color: rgba(255,255,255,0.42); }
    .chat-input:focus {
      outline: none;
      border-color: rgba(255,255,255,0.5);
      background: rgba(255,255,255,0.15);
    }
    .chat-send {
      width: 44px; height: 44px;
      flex-shrink: 0;
      border-radius: 50%;
      background: rgba(255,255,255,0.18);
      border: 1px solid rgba(255,255,255,0.3);
      color: #fff;
      font-size: 20px;
      font-family: var(--font);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
      transition: background 0.15s;
    }
    .chat-send:hover  { background: rgba(255,255,255,0.28); }
    .chat-send:active { background: rgba(255,255,255,0.35); }
