@layer reset, base, chamber, controls, drawers, responsive;
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p { margin: 0; }
  button, input, textarea, select { font: inherit; }
  button, a, summary, select { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  [hidden] { display: none !important; }
}
@layer base {
  :root { color-scheme: dark; --background: #030b14; --panel: #07131e; --line: #6cafc125; --text: #dceaf0; --muted: #94b4c4; --dim: #658696; --accent: #8ce3f3; --danger: #efa79f; --amber: #dcb87d; --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace; --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-family: var(--sans); font-size: 14px; line-height: 1.5; }
  body { min-width: 320px; background: var(--background); color: var(--text); }
  button { color: inherit; }
  button:disabled { cursor: not-allowed; opacity: .33; }
  button, select, textarea, a, summary, audio { outline-offset: 4px; }
  :focus-visible { outline: 2px solid var(--accent); }
  a { color: inherit; text-underline-offset: 4px; }
  svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
  ::selection { color: #04121d; background: var(--accent); }
  .skip-link { position: fixed; left: 20px; top: -80px; z-index: 20; padding: 12px 18px; color: #061620; background: var(--accent); }
  .skip-link:focus { top: 16px; }
  .eyebrow { font: 10px var(--mono); letter-spacing: .13em; color: var(--muted); }
}
@layer chamber {
  .chamber { height: 100svh; min-height: 480px; position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse at 50% 44%, #102e404d, transparent 62%), linear-gradient(180deg, #030a12, #071521 48%, #030a12); }
  .chamber::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 44%, #6b192359, transparent 64%), linear-gradient(180deg, #160810, #2b0d17 48%, #16080c); transition: opacity 3.5s cubic-bezier(.4, 0, .2, 1); }
  body[data-mood="alert"] .chamber::before { opacity: 1; }
  .chamber::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; box-shadow: inset 0 0 120px 30px #0005; }
  .chamber-architecture { position: absolute; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
  .chamber-grain { position: absolute; inset: 0; opacity: .12; background-image: repeating-linear-gradient(0deg, transparent 0, transparent 2px, #0004 3px, transparent 4px); mix-blend-mode: soft-light; }
  .presence-field { position: absolute; width: min(1320px, 100%); height: 64%; top: 10%; left: 50%; transform: translateX(-50%); pointer-events: none; }
  .voice-visualization { position: absolute; display: block; inset: 0; width: 100%; height: 100%; }
  .contact-panel { position: absolute; z-index: 2; bottom: 19%; left: 50%; width: min(680px, calc(100% - 48px)); transform: translateX(-50%); text-align: center; }
  .live-caption { max-width: 620px; margin: 0 auto; font-size: clamp(15px, 1.65vw, 21px); font-weight: 300; line-height: 1.55; letter-spacing: .006em; color: #e0f1f8; text-shadow: 0 1px 20px #0a203b, 0 2px 9px #010711; max-height: 5.1em; overflow: auto; scrollbar-width: thin; }
  .live-caption:empty { display: none; }
  .interim-transcript { margin: 0 auto 14px; max-width: 620px; font-size: 13px; font-style: italic; line-height: 1.6; color: var(--muted); }
  .status-badge { display: inline-flex; gap: 7px; align-items: center; font: inherit; color: inherit; }
  .status-dot { width: 3px; height: 3px; display: inline-block; border-radius: 50%; background: currentColor; }
  .connection-entry { margin-top: 20px; min-width: 110px; }
  .chamber-footer { position: absolute; bottom: max(22px, env(safe-area-inset-bottom)); left: 48px; right: 48px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 24px; z-index: 2; }
  .footer-meta { min-width: 0; max-width: 420px; display: grid; justify-items: start; gap: 7px; padding-bottom: 8px; font: 10px/1.6 var(--sans); color: #819eac; letter-spacing: .01em; }
  .fan-label { font: inherit; color: inherit; }
  .footer-setup { justify-self: end; }
  .session-trigger { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; padding: 18px 20px 9px; color: #9cb9c7; background: transparent; border: 0; border-radius: 8px; font-size: 11px; letter-spacing: .025em; }
  .session-trigger:hover { color: #d5f0f7; background: #16334750; }
  .session-trigger svg { width: 14px; height: 14px; }
  .drawer-handle { position: absolute; top: 6px; left: calc(50% - 14px); width: 28px; height: 2px; border-radius: 3px; background: #86b9ca5c; }
  .transcript-count { font: 9px var(--mono); background: #72b4cc20; padding: 2px 5px; border-radius: 2px; color: #a4d3e4; }
}
@layer controls {
  .button { border: 1px solid #6ba6bd3b; border-radius: 5px; padding: 13px 16px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; font-weight: 400; line-height: 1.2; transition: background .16s, border-color .16s, opacity .16s; }
  .button svg { width: 15px; height: 15px; }
  .button--primary { background: #9bcddaeb; color: #09202e; border-color: #b6e6f2; }
  .button--primary:hover:not(:disabled) { background: #c3eff7; }
  .button--secondary { background: #09213360; color: #b4d4e2; }
  .button--secondary:hover:not(:disabled) { background: #163f57aa; border-color: #78b8cf99; }
  .button--quiet { background: transparent; border-color: transparent; color: var(--muted); }
  .button--quiet:hover:not(:disabled) { background: #24465444; }
  .utility-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; padding: 10px; min-height: 44px; }
  .utility-button svg { height: 15px; width: 15px; }
  .utility-button:hover { background: #1e3b4a40; color: var(--text); border-color: var(--line); }
  .utility-button svg circle { fill: #0b1923; }
  .setup-attention { width: 4px; height: 4px; background: var(--amber); border-radius: 50%; margin-left: 2px; }
  body[data-prepared="true"] .setup-attention { display: none; }
  .text-button { border: 0; background: transparent; padding: 10px 0; min-height: 40px; font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 9px; }
  .text-button:hover:not(:disabled) { color: var(--accent); }
  .text-button > span { font-size: 15px; line-height: 1; }
  .error-message { color: #f4b1a7; border: 1px solid #aa6a5c77; background: #2e1c1bef; margin-top: 12px; padding: 10px 13px; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; text-align: left; }
  .footer-meta .error-message { color: #c19b96; border: 0; background: transparent; margin: 0; padding: 0; font-size: 10px; }
  .status-badge[data-state="error"] { color: var(--danger); }
  #muteButton[aria-pressed="true"] { border-color: #be9a6177; color: var(--amber); background: #60431b22; }
}
@layer drawers {
  .drawer { position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; width: min(510px, 100%); height: 100dvh; max-width: 100vw; max-height: 100dvh; border: 0; border-left: 1px solid #70abc52b; background: linear-gradient(150deg, #102537fa, #04101afd 62%); box-shadow: -20px 0 80px #0006; color: var(--text); }
  .drawer[open] { display: flex; flex-direction: column; animation: drawer-entrance .24s ease-out; }
  .drawer::backdrop { background: #00060f66; backdrop-filter: blur(5px); }
  .drawer-heading { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 23px 28px 13px; }
  .close-button { display: inline-flex; align-items: center; justify-content: center; height: 44px; width: 44px; color: var(--muted); border: 1px solid #91c2d31d; background: #0002; border-radius: 50%; font-size: 22px; font-weight: 200; }
  .close-button:hover { color: var(--text); background: #29495850; }
  .drawer-body { overflow-y: auto; overscroll-behavior: contain; padding: 18px 32px 30px; scrollbar-width: thin; scrollbar-color: #3b5b6c transparent; }
  .drawer h2 { font-size: 29px; font-weight: 350; letter-spacing: -.04em; line-height: 1.25; }
  .drawer-intro { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.7; }
  .session-drawer { inset: auto 0 0; margin: 0 auto; width: min(760px, 100%); height: auto; max-height: 80dvh; border: 1px solid #70abc535; border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -20px 100px #0008; }
  .session-drawer[open] { animation-name: bottom-drawer-entrance; }
  .session-drawer::before { content: ""; position: absolute; top: 9px; left: calc(50% - 18px); width: 36px; height: 3px; border-radius: 3px; background: #8dbccc45; }
  .session-drawer .drawer-heading { padding: 25px 28px 0; }
  .session-drawer h2 { font-size: 19px; letter-spacing: -.015em; }
  .session-drawer .drawer-body { padding: 18px 28px max(20px, env(safe-area-inset-bottom)); }
  .session-status { margin-bottom: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
  .session-controls { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr 1fr; gap: 8px; }
  .preparation-note { font-size: 11px; color: var(--muted); margin-top: 12px; }
  .preparation-note .text-button { margin-left: 4px; color: #add9e8; }
  .session-secondary { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); margin-top: 21px; padding-top: 12px; }
  .setup-steps { padding: 0; list-style: none; display: grid; gap: 20px; margin: 27px 0; }
  .setup-steps li { display: flex; align-items: flex-start; gap: 13px; }
  .step-number { font: 10px/1.8 var(--mono); color: #81becf; padding-top: 1px; }
  .setup-steps h3 { font-size: 12px; font-weight: 500; color: #c5dce6; }
  .setup-steps p { font-size: 11px; color: var(--muted); line-height: 1.7; margin-top: 4px; }
  .setup-guide { font-size: 12px; line-height: 1.7; color: #bfdeea; background: #5a9bb310; border-left: 2px solid #6cbcd477; padding: 12px 14px; }
  .compatibility-list { list-style: none; margin: 23px 0 0; padding: 0; border-top: 1px solid var(--line); }
  .compatibility-list li { border-bottom: 1px solid var(--line); padding: 12px 0; display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; align-items: start; color: var(--muted); font-size: 11px; line-height: 1.6; }
  .capability-name { color: #bed6e2; }
  .capability-status { font-size: 11px; text-align: right; }
  .compatibility-list .available, .compatibility-list .ready { color: #8dd7e9; }
  .compatibility-list .unsupported, .compatibility-list .unavailable, .compatibility-list .error { color: #dfa098; }
  .compatibility-list .pending, .compatibility-list .downloadable, .compatibility-list .downloading { color: #d4ba8d; }
  .setup-actions { display: grid; gap: 8px; margin-top: 20px; }
  .setup-actions:has(> button:not([hidden])) { margin-bottom: 12px; }
  .button--setup { width: 100%; text-align: left; justify-content: space-between; padding: 13px 14px; background: #0a253774; }
  .button--setup > span:last-child { color: var(--accent); }
  .button--setup:hover:not(:disabled) { background: #17405b; border-color: #72c6e166; }
  .download-status { margin-top: 17px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
  progress { width: 100%; height: 4px; appearance: none; border: 0; background: #1d3a4d; accent-color: var(--accent); margin-top: 9px; }
  progress::-webkit-progress-bar { background: #1d3a4d; }
  progress::-webkit-progress-value { background: var(--accent); }
  progress::-moz-progress-bar { background: var(--accent); }
  #checkCompatibilityButton { margin-top: 8px; }
  .setup-footnote { color: var(--dim); font-size: 11px; line-height: 1.7; margin-top: 13px; }
  .voice-lab { margin-top: 29px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .voice-lab > summary { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 17px 0; cursor: pointer; list-style: none; font-size: 13px; }
  summary::-webkit-details-marker { display: none; }
  .lab-tag { color: var(--dim); font: 8px var(--mono); letter-spacing: .05em; border: 1px solid var(--line); padding: 3px 5px; margin-left: 10px; }
  .details-chevron { color: var(--muted); font-size: 20px; font-weight: 200; transition: transform .15s; }
  .voice-lab[open] .details-chevron { transform: rotate(45deg); }
  .voice-lab-content { padding: 0 0 23px; }
  .lab-intro { font-size: 11px; color: var(--muted); line-height: 1.7; margin-bottom: 21px; }
  .voice-lab h3 { font: 10px var(--mono); color: #b4d1df; margin-bottom: 17px; }
  .field-index { color: var(--accent); display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1px solid #91dcf033; font-size: 8px; margin-right: 7px; }
  .voice-lab label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
  select, textarea { width: 100%; border: 1px solid #72a4bc44; background: #030e18; color: var(--text); border-radius: 3px; padding: 11px; font-size: 12px; line-height: 1.7; }
  select { padding-right: 25px; text-overflow: ellipsis; }
  textarea { display: block; min-height: 100px; resize: vertical; }
  audio { display: block; width: 100%; height: 34px; margin-top: 14px; }
  .field-hint { font-size: 10px; line-height: 1.6; color: var(--dim); margin-top: 12px; }
  .lab-synthesis { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 21px; }
  .lab-actions { display: flex; gap: 9px; margin-top: 12px; }
  .voice-status { margin-top: 11px; color: var(--muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
  .technical-details { margin-top: 24px; padding-top: 13px; border-top: 1px solid var(--line); }
  .technical-details summary { color: var(--muted); font-size: 10px; cursor: pointer; }
  .technical-details pre { max-height: 300px; margin: 13px 0 0; padding: 13px; font: 9px/1.8 var(--mono); white-space: pre-wrap; overflow: auto; overflow-wrap: anywhere; color: var(--muted); background: #020b12; }
  .privacy-panel { padding-top: 24px; }
  .privacy-panel h3 { font-size: 13px; font-weight: 400; }
  .privacy-panel p { font-size: 11px; color: var(--dim); line-height: 1.7; margin-top: 8px; }
  .privacy-panel a { display: inline-block; margin-top: 13px; color: var(--muted); font-size: 11px; text-decoration: none; }
  .privacy-panel a:hover { color: var(--accent); }
  .drawer-bottom { flex: 0 0 auto; padding: 18px 32px max(23px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #05111be0; }
  .drawer-bottom .button { width: 100%; }
  .transcript-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .transcript-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
  .transcript { flex: 1; min-height: 180px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3b5b6c transparent; }
  .empty-transcript { min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 12px; }
  .empty-glyph { font: 30px var(--mono); color: #426c80; margin-bottom: 20px; }
  .empty-transcript > span:last-child { color: var(--dim); font-size: 11px; margin-top: 5px; }
  .message { padding: 22px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  .message-meta { color: var(--dim); font: 8px var(--mono); letter-spacing: .1em; margin-bottom: 9px; }
  .message-text { font-size: 13px; line-height: 1.8; color: var(--text); white-space: pre-wrap; }
  .message--assistant .message-meta { color: #8ad6ea; }
  .message--user .message-text { color: #97b5c4; }
  @keyframes drawer-entrance { from { opacity: .5; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
  @keyframes bottom-drawer-entrance { from { opacity: .5; transform: translateY(60px); } to { opacity: 1; transform: translateY(0); } }
}
@layer responsive {
  @media (max-width: 600px) {
    .presence-field { top: 13%; height: 52%; width: 115%; }
    .contact-panel { bottom: max(26%, 180px); width: calc(100% - 40px); }
    .live-caption { max-height: 4.7em; font-size: 16px; }
    .chamber-footer { bottom: max(18px, env(safe-area-inset-bottom)); left: 22px; right: 22px; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 18px; }
    .footer-meta { grid-column: 1; grid-row: 2; padding: 0; gap: 7px; }
    .session-trigger { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
    .footer-setup { grid-column: 2; grid-row: 2; padding-right: 0; font-size: 10px; }
    .session-controls { grid-template-columns: 1fr 1fr; }
    .session-controls .button { min-height: 48px; }
    .session-drawer .drawer-heading { padding: 24px 20px 0; }
    .session-drawer .drawer-body { padding: 16px 20px max(20px, env(safe-area-inset-bottom)); }
    .preparation-note { max-width: 290px; }
    .drawer-heading { padding: 19px 20px 11px; }
    .drawer-body { padding: 17px 24px 25px; }
    .drawer-bottom { padding: 17px 24px max(22px, env(safe-area-inset-bottom)); }
    .drawer h2 { font-size: 27px; }
    .session-drawer h2 { font-size: 19px; }
  }
  @media (max-height: 600px) and (min-width: 601px) { .contact-panel { bottom: 22%; } .presence-field { top: 3%; } .live-caption { max-height: 3.2em; } }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
}
