*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --bg: #050507;
    --bg-card: rgba(255,255,255,0.03);
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.18);
    --text: #ffffff;
    --text-muted: rgba(255,255,255,0.6);
    --text-dim: rgba(255,255,255,0.4);
    --primary: #C175FC;
    --primary-soft: rgba(193, 117, 252, 0.15);
    --primary-glow: rgba(193, 117, 252, 0.45);
    --magenta: #E04AC9;
    --magenta-soft: rgba(224, 74, 201, 0.15);
    --green: #4ADE80;
    --red: #ff5577;
  }

  html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Instrument Sans', system-ui, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }

  body { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }

  .flag {
    font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
    line-height: 1;
  }

  /* ambient bg */
  .demo-section {
    position: relative;
    width: 100%;
    padding: 4rem 1.5rem;
    overflow: hidden;
    container-type: inline-size;
    container-name: demo;
  }

  .demo-section::before {
    content: '';
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(193, 117, 252, 0.12), transparent 70%);
    pointer-events: none;
    z-index: 0;
  }

  /* =========== DEMO CARD =========== */
  .demo-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    background: linear-gradient(-61.23deg, rgba(255,255,255,0.05) 13.81%, rgba(153,153,153,0.033) 33.55%, rgba(153,153,153,0.012) 81.13%);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 24px;
    overflow: hidden;
    backdrop-filter: blur(22.5px);
  }

  .demo-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(193, 117, 252, 0.5), transparent 40%, transparent 60%, rgba(224, 74, 201, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
  }

  /* ====== HEADER ====== */
  .demo-header {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 10px;
  }

  .demo-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .demo-header-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
  }

  .selectors {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .selector {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    font-weight: 500;
    width: 100%;
    justify-content: space-between;
  }
  .selector:hover { background: rgba(255,255,255,0.06); border-color: var(--border-strong); }
  .selector:disabled { opacity: 0.5; cursor: not-allowed; }

  .selector .label {
    color: var(--text-dim);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 500;
    flex-shrink: 0;
    display: none;
  }

  @container demo (min-width: 768px) {
    .selector .label { display: inline; }
  }

  .selector .right-group {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex: 1;
    white-space: nowrap;
    min-width: 0;
  }

  @container demo (min-width: 768px) {
    .selector .right-group { flex: 0 0 auto; }
  }

  .selector .value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    min-width: 0;
  }

  .selector .flag { font-size: 14px; }

  .selector .chevron {
    width: 12px;
    height: 12px;
    opacity: 0.5;
    transition: transform 0.2s;
  }
  .selector.open .chevron { transform: rotate(180deg); }

  .dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    max-height: 280px;
    overflow-y: auto;
    background: #1a1a24;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 6px;
    z-index: 10;
    display: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  }
  .dropdown::-webkit-scrollbar { width: 4px; }
  .dropdown::-webkit-scrollbar-track { background: transparent; }
  .dropdown::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
  .selector.open .dropdown { display: block; }

  .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
    white-space: nowrap;
  }
  .dropdown-item:hover { background: rgba(255,255,255,0.06); }
  .dropdown-item.active { background: var(--primary-soft); color: var(--primary); }

  .status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
  }
  .status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse-dot 2s ease-in-out infinite;
  }
  .status.connecting .dot { background: #f59e0b; }
  .status.active .dot { background: var(--magenta); }
  .status.error .dot { background: var(--red); }

  @keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
  }

  /* ====== MIC AREA ====== */
  .mic-area {
    padding: 2rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
  }

  .mic-orb {
    position: relative;
    width: 110px;
    height: 110px;
    margin-bottom: 1.25rem;
    cursor: pointer;
  }
  .mic-orb.connecting { cursor: wait; pointer-events: none; }

  .ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid var(--primary-glow);
    opacity: 0;
  }
  .mic-orb.idle .ring { animation: ring-pulse 3s ease-out infinite; }
  .mic-orb.active .ring { animation: ring-pulse 1.4s ease-out infinite; border-color: var(--magenta); }
  .mic-orb .ring:nth-child(2) { animation-delay: 0.5s; }
  .mic-orb .ring:nth-child(3) { animation-delay: 1s; }

  @keyframes ring-pulse {
    0% { transform: scale(0.7); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
  }

  .mic-core {
    position: absolute;
    inset: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--magenta));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px var(--primary-glow), inset 0 0 20px rgba(255,255,255,0.1);
    transition: all 0.3s ease;
  }
  .mic-orb:hover .mic-core { box-shadow: 0 0 60px var(--primary-glow); transform: scale(1.04); }
  .mic-orb.active .mic-core {
    background: linear-gradient(135deg, var(--magenta), #ff5577);
    box-shadow: 0 0 50px rgba(224, 74, 201, 0.6);
  }
  .mic-orb.connecting .mic-core {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    box-shadow: 0 0 30px rgba(107, 114, 128, 0.4);
  }
  .mic-orb.connecting .ring {
    animation: ring-pulse 1s ease-out infinite;
    border-color: rgba(255,255,255,0.3);
  }
  .mic-orb.connecting .mic-icon { display: none; }
  .mic-orb.connecting .mic-core::after {
    content: '';
    width: 28px;
    height: 28px;
    border: 2.5px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
  }
  @keyframes spinner { to { transform: rotate(360deg); } }

  .mic-icon {
    width: 28px;
    height: 28px;
    color: white;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .cta-button {
    padding: 10px 28px;
    background: white;
    color: #050507;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .cta-button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(255,255,255,0.15); }
  .cta-button.active {
    background: rgba(224, 74, 201, 0.15);
    color: var(--magenta);
    border: 1px solid var(--magenta);
  }
  .cta-button.connecting {
    background: rgba(255,255,255,0.08);
    color: var(--text-muted);
    cursor: wait;
    pointer-events: none;
  }
  .cta-button .dot {
    width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  }
  .cta-button.active .dot { background: var(--magenta); animation: pulse-dot 1s ease-in-out infinite; }
  .cta-button.connecting .dot { background: var(--text-muted); animation: pulse-dot 0.6s ease-in-out infinite; }

  .timer {
    margin-top: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
  }
  .timer.warning { color: var(--red); animation: timer-pulse 1s ease-in-out infinite; }
  @keyframes timer-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

  .error-banner {
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(255, 85, 119, 0.1);
    border: 1px solid rgba(255, 85, 119, 0.3);
    color: var(--red);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    display: none;
  }
  .error-banner.show { display: block; }

  /* ====== TRANSCRIPT ====== */
  .transcript {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.25);
  }

  .transcript-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
  }

  .transcript-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
  }
  .transcript-label .live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--magenta);
    animation: pulse-dot 1.4s ease-in-out infinite;
  }

  .transcript-stream {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 180px;
    min-height: 180px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 8px;
    scroll-behavior: smooth;
    flex-shrink: 0;
  }
  .transcript-stream::-webkit-scrollbar { width: 4px; }
  .transcript-stream::-webkit-scrollbar-track { background: transparent; }
  .transcript-stream::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

  .transcript-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
    font-size: 12px;
    text-align: center;
    padding: 1rem;
  }

  .msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: msg-in 0.4s ease forwards;
    opacity: 0;
    transform: translateY(8px);
  }
  @keyframes msg-in { to { opacity: 1; transform: translateY(0); } }

  .msg-tag {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 3px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
    margin-top: 2px;
  }
  .msg.ai .msg-tag { background: var(--primary-soft); color: var(--primary); }
  .msg.user .msg-tag { background: var(--magenta-soft); color: var(--magenta); }

  .msg-text {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255,255,255,0.88);
  }
  .msg.partial .msg-text { color: rgba(255,255,255,0.55); font-style: italic; }

  /* ====== FOOTER ====== */
  .demo-footer {
    padding: 12px 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
  }
  .demo-footer .latency { display: inline-flex; align-items: center; gap: 6px; }
  .demo-footer .latency .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }

  /* TABLET */
  @container demo (min-width: 768px) {
    .demo-section { padding: 5rem 2rem; }
    .demo-header { padding: 1.25rem 1.5rem; }
    .selectors { flex-direction: row; }
    .selector { flex: 1; padding: 9px 14px; font-size: 13px; min-width: 0; }
    .selector .value { overflow: hidden; text-overflow: ellipsis; }
    .selector .label { font-size: 11px; }
    .mic-area { padding: 2.5rem 1.5rem 1.75rem; }
    .mic-orb { width: 130px; height: 130px; margin-bottom: 1.5rem; }
    .mic-core { inset: 26px; }
    .mic-icon { width: 30px; height: 30px; }
    .cta-button { padding: 11px 32px; font-size: 14px; }
    .timer { font-size: 12px; }
    .transcript { padding: 1.5rem; }
    .transcript-stream { height: 200px; min-height: 200px; max-height: 200px; gap: 14px; }
    .msg-text { font-size: 14px; }
    .msg-tag { font-size: 10px; }
    .demo-footer { padding: 14px 1.5rem; font-size: 11px; }
  }

  /* DESKTOP */
  @container demo (min-width: 1280px) {
    .demo-section { padding: 6rem 2rem; }
    .demo-card { max-width: 760px; }
    .demo-header { padding: 1.5rem 1.75rem; }
    .selector { padding: 10px 16px; }
    .mic-area { padding: 3rem 1.75rem 2rem; }
    .mic-orb { width: 150px; height: 150px; margin-bottom: 1.75rem; }
    .mic-core { inset: 30px; }
    .mic-icon { width: 34px; height: 34px; }
    .cta-button { padding: 12px 36px; font-size: 14px; }
    .transcript { padding: 1.75rem; }
    .transcript-stream { height: 240px; min-height: 240px; max-height: 240px; }
    .demo-footer { padding: 16px 1.75rem; }
  }

  /* CONSENT MODAL */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
  }
  .modal-overlay.show { display: flex; }

  .modal {
    background: #14141c;
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    max-width: 420px;
    width: 100%;
    padding: 1.75rem;
    text-align: center;
  }

  .modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--primary);
  }
  .modal-icon svg { width: 24px; height: 24px; }

  .modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 0.75rem;
  }

  .modal p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 1.25rem;
  }
  .modal p strong { color: var(--text); }

  .modal-actions {
    display: flex;
    gap: 8px;
  }

  .modal-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
  }
  .modal-btn.secondary {
    background: rgba(255,255,255,0.08);
    color: var(--text);
  }
  .modal-btn.secondary:hover { background: rgba(255,255,255,0.15); }
  .modal-btn.primary {
    background: white;
    color: #050507;
  }
  .modal-btn.primary:hover { transform: translateY(-1px); }

/* was an inline style attribute on #timer; moved here so the CSP needs no unsafe-inline */
#timer{visibility:hidden}
