:root {
    --bg: #14161a;
    --surface: #1d2025;
    --surface-raised: #262a31;
    --hairline: #33373f;
    --text: #ece8e0;
    --muted: #8b8d93;
    --muted-strong: #a1a3a9;
    --amber: #e1a756;
    --amber-dim: #4a3d2a;
    --teal: #5fa8a2;
    --teal-dim: #24403d;
    --danger: #c97064;
    --danger-strong: #d98f85;
  }
  * { box-sizing: border-box; }
  html, body {
    margin: 0; padding: 0; height: 100%;
    background: var(--bg); color: var(--text);
    font-family: 'Karla', sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3, .serif { font-family: 'Fraunces', serif; font-weight: 500; }
  button {
    font-family: inherit; cursor: pointer; border: none;
    -webkit-tap-highlight-color: transparent;
  }
  a { color: inherit; }
  :focus-visible {
    outline: 2px solid var(--muted-strong); outline-offset: 2px; border-radius: 4px;
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important; scroll-behavior: auto !important;
    }
  }
  #app { min-height: 100vh; display: flex; flex-direction: column; }

  /* ---------- LANDING ---------- */
  .landing {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 32px 20px; position: relative; overflow: hidden;
  }
  .landing.home {
    justify-content: flex-start; overflow-y: auto; padding-top: 64px; padding-bottom: 56px;
  }
  .home-content { position: relative; max-width: 620px; text-align: center; }
  .home-content h1 { font-size: 2.6rem; margin: 0 0 8px; letter-spacing: 0.3px; }
  .tagline { color: var(--muted-strong); font-size: 1.05rem; margin: 0 0 40px; }
  .mission { text-align: left; margin-bottom: 40px; }
  .mission h2 { font-size: 1.05rem; color: var(--text); margin-bottom: 16px; text-align: center; }
  .mission p { color: var(--muted-strong); font-size: 0.95rem; line-height: 1.7; margin-bottom: 14px; }
  .cta-btn {
    background-image: linear-gradient(90deg, var(--amber), var(--teal));
    color: #14161a; font-weight: 700; font-size: 1rem; padding: 15px 38px;
    border-radius: 30px; transition: transform 0.15s ease, opacity 0.15s ease;
  }
  .cta-btn:hover { opacity: 0.92; }
  .cta-btn:active { transform: scale(0.97); }
  .home-quote {
    font-family: 'Fraunces', serif; font-style: italic; font-weight: 400;
    color: var(--text); font-size: 1.05rem; line-height: 1.6; text-align: left;
    margin: 0 0 40px; padding-left: 18px;
    border-left: 3px solid var(--amber);
    border-image: linear-gradient(180deg, var(--amber), var(--teal)) 1;
  }
  .glow {
    position: absolute; top: 50%; left: 50%; width: 700px; height: 700px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(225,167,86,0.10) 0%, rgba(95,168,162,0.08) 45%, transparent 70%);
    pointer-events: none;
  }
  .brand { position: relative; text-align: center; margin-bottom: 56px; }
  .brand h1 { font-size: 2.4rem; margin: 0 0 10px; letter-spacing: 0.3px; }
  .brand p { color: var(--muted); font-size: 1.02rem; max-width: 420px; margin: 0 auto; line-height: 1.5; }
  .choices {
    position: relative; display: flex; gap: 2px; width: 100%; max-width: 760px;
    background: var(--hairline); border-radius: 14px; overflow: hidden;
  }
  .choice {
    flex: 1; background: var(--surface); padding: 32px 22px; text-align: left;
    display: flex; flex-direction: column; gap: 10px; transition: background 0.2s ease;
  }
  .choice:hover { background: var(--surface-raised); }
  .choice .tag { font-size: 0.8rem; color: var(--muted); }
  .choice h2 { font-size: 1.3rem; margin: 0; }
  .choice p { color: var(--muted); font-size: 0.88rem; line-height: 1.5; margin: 0; }
  .choice.vent h2 { color: var(--amber); }
  .choice.listen h2 { color: var(--teal); }
  .choice.flex h2 {
    background-image: linear-gradient(90deg, var(--amber), var(--teal));
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  .queue-status {
    position: relative; margin-top: 22px; color: var(--muted); font-size: 0.82rem;
    display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap;
  }
  .queue-status .dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px;
  }
  .queue-status .dot.amber { background: var(--amber); }
  .queue-status .dot.teal { background: var(--teal); }
  .queue-status .dot.flex { background-image: linear-gradient(90deg, var(--amber), var(--teal)); }
  .footnote {
    position: relative; margin-top: 40px; color: var(--muted); font-size: 0.82rem;
    text-align: center; max-width: 480px; line-height: 1.6;
  }
  .footnote a { color: var(--muted); text-decoration: underline; }
  .footer-links { position: relative; margin-top: 14px; text-align: center; }
  .footer-links a {
    color: var(--muted-strong); font-size: 0.78rem; text-decoration: underline;
    margin: 0 8px;
  }

  /* ---------- WAITING ---------- */
  .waiting {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 22px; padding: 24px;
  }
  .pulse {
    width: 14px; height: 14px; border-radius: 50%;
    animation: pulse 1.8s ease-in-out infinite;
  }
  .pulse.amber { background: var(--amber); }
  .pulse.teal { background: var(--teal); }
  .pulse.flex { background-image: linear-gradient(135deg, var(--amber), var(--teal)); }
  @keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.6); opacity: 1; }
  }
  .waiting p { color: var(--muted); font-size: 0.95rem; }
  .cancel-btn {
    background: transparent; color: var(--muted); font-size: 0.85rem;
    text-decoration: underline; padding: 6px;
  }

  /* ---------- CHAT ---------- */
  .chat { flex: 1; display: flex; flex-direction: column; height: 100vh; }
  .chat-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--hairline); background: var(--surface);
  }
  .chat-identity { display: flex; align-items: center; gap: 8px; }
  .chat-top .role-pill {
    font-size: 0.78rem; padding: 4px 10px; border-radius: 20px; color: var(--bg); font-weight: 600;
  }
  .chat-top .you-are { color: var(--muted); font-size: 0.85rem; }
  .role-pill.venter-view { background: var(--amber); }
  .role-pill.listener-view { background: var(--teal); }
  .chat-top .timer { color: var(--muted); font-size: 0.82rem; }
  .chat-top-actions { display: flex; gap: 8px; }
  .icon-btn {
    background: var(--surface-raised); color: var(--muted-strong); font-size: 0.78rem;
    padding: 8px 14px; border-radius: 8px; min-height: 32px;
  }
  .icon-btn:hover { color: var(--text); }
  .icon-btn.report:hover { color: var(--danger-strong); }

  .messages {
    flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px;
    max-width: 640px; margin: 0 auto; width: 100%;
  }
  .msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 0.95rem; line-height: 1.45; }
  .msg.mine { align-self: flex-end; background: var(--surface-raised); border-bottom-right-radius: 3px; }
  .msg.theirs { align-self: flex-start; background: var(--surface); border: 1px solid var(--hairline); border-bottom-left-radius: 3px; }
  .msg.system { align-self: center; color: var(--muted); font-size: 0.82rem; background: none; padding: 4px; }

  .crisis-banner {
    max-width: 640px; margin: 0 auto; width: calc(100% - 40px);
    background: var(--surface-raised); border: 1px solid var(--danger);
    border-radius: 10px; padding: 14px 16px; font-size: 0.88rem; line-height: 1.55;
    margin-bottom: 12px;
  }
  .crisis-banner strong { color: var(--danger-strong); }

  .typing-indicator {
    align-self: flex-start; color: var(--muted); font-size: 0.85rem;
    display: flex; align-items: center; gap: 6px; padding: 4px 2px;
  }
  .typing-dots { display: inline-flex; gap: 3px; }
  .typing-dots span {
    width: 5px; height: 5px; border-radius: 50%; background: var(--muted);
    animation: typing-bounce 1.2s infinite ease-in-out;
  }
  .typing-dots span:nth-child(2) { animation-delay: 0.15s; }
  .typing-dots span:nth-child(3) { animation-delay: 0.3s; }
  @keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-3px); opacity: 1; }
  }
  .composer {
    display: flex; align-items: flex-end; gap: 10px; padding: 14px 18px;
    border-top: 1px solid var(--hairline); background: var(--surface);
    max-width: 640px; margin: 0 auto; width: 100%;
  }
  .composer textarea {
    flex: 1; resize: none; background: var(--surface-raised);
    border: 1px solid var(--hairline); border-radius: 16px;
    color: var(--text); padding: 12px 16px; font-family: inherit;
    font-size: 0.95rem; line-height: 1.4; max-height: 120px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  .composer textarea::placeholder { color: var(--muted); }
  .composer textarea:focus {
    outline: none; border-color: var(--hairline);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
  }
  .composer.venter-mode textarea:focus {
    border-color: var(--amber); box-shadow: 0 0 0 3px rgba(225, 167, 86, 0.15);
  }
  .composer.listener-mode textarea:focus {
    border-color: var(--teal); box-shadow: 0 0 0 3px rgba(95, 168, 162, 0.15);
  }
  .send-btn {
    background: var(--amber); color: #1a1408; border-radius: 20px;
    padding: 0 22px; height: 44px; font-weight: 600; font-size: 0.92rem;
    flex-shrink: 0; transition: transform 0.1s ease, opacity 0.15s ease;
  }
  .send-btn:hover { opacity: 0.92; }
  .send-btn:active { transform: scale(0.96); }
  .send-btn.listener-mode { background: var(--teal); color: #0c2220; }
  .send-btn:disabled { opacity: 0.4; cursor: default; }

  /* ---------- RATING / END ---------- */
  .end-screen {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 20px; padding: 24px; text-align: center;
  }
  .end-screen h2 { margin: 0; }
  .stars { display: flex; gap: 6px; }
  .star { font-size: 1.8rem; background: none; color: var(--hairline); padding: 6px; min-width: 44px; min-height: 44px; }
  .star.filled { color: var(--amber); }
  .again-btn { background: var(--surface-raised); color: var(--text); padding: 10px 22px; border-radius: 10px; margin-top: 10px; }

  /* ---------- REPORT MODAL ---------- */
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex;
    align-items: center; justify-content: center; padding: 20px; z-index: 10;
  }
  .modal { background: var(--surface); border-radius: 14px; padding: 24px; max-width: 420px; width: 100%; }
  .modal.wide { max-width: 480px; max-height: 85vh; overflow-y: auto; }
  .modal h3 { margin: 0 0 10px; }
  .modal p { color: var(--muted); font-size: 0.88rem; margin: 0 0 16px; }
  .modal select, .modal textarea {
    width: 100%; background: var(--surface-raised); border: 1px solid var(--hairline);
    color: var(--text); border-radius: 8px; padding: 10px; font-family: inherit; margin-bottom: 12px;
  }
  .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
  .modal-actions button { padding: 8px 16px; border-radius: 8px; font-size: 0.88rem; }
  .btn-ghost { background: transparent; color: var(--muted); }
  .btn-danger { background: var(--danger); color: #200a08; font-weight: 600; }

  @media (max-width: 560px) {
    .choices { flex-direction: column; }
    .brand h1 { font-size: 1.9rem; }
  }
