/* Fish Audio Platform semantic-v2 tokens (subset of platform-web app/styles/tokens; picked mockup V1), the local fonts
   (web/fonts: Onest, Lato, Geist Mono, SIL OFL 1.1, licence texts next to them; no CDN) and the shared primitives
   (buttons, segmented control, select, tag, switch, latency badge, banner) of the page. */
@font-face { font-family: "Onest"; src: url("fonts/onest-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Lato"; src: url("fonts/lato-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lato"; src: url("fonts/lato-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --font-heading: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-body: var(--font-heading);
  --font-description: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --coral: #f56138; --coral-50: #fef7f5; --coral-100: #fdf3ef; --coral-200: #f9dacd; --coral-700: #db5633;
  --accent: var(--coral);
  --primary-bg: #1d1d1c; --primary-bg-hover: #333130; --primary-fg: #ffffff;
  --secondary-bg: #60200010; --secondary-bg-hover: #661f0019; --secondary-bg-pressed: #551a0027;
  --tertiary-hover: #60000008;
  --bg-default: #fbfaf9; --bg-medium: #f6f0ec; --bg-weak: #ffffff;
  --elevated: #ffffff; --elevated-medium: #ffffff; --elevated-strong: #ffffff;
  --border: #4110003f; --border-light: #60200010; --divider: #d0c4c0; --input: #4110003f;
  --fill-weak: #60000008; --fill: #60200010; --fill-medium: #661f0019; --fill-strong: #58200020;
  --text-title: #161616; --text-body: #1d1d1c; --text-subtitle: #554f4c; --text-desc: #7a6f6b;
  --text-helper: #9f928e; --text-disabled: #c4b7b4;
  --danger: #f54b45; --danger-bg: #ffefeb; --danger-border: #fdd0c6; --danger-fg: #b9241c;
  --success: #00b489; --success-bg: #ebf9f6; --success-border: #ccf0e7; --success-fg: #13725c;
  --warning: #ff8e1d; --warning-bg: #fff6e5; --warning-border: #ffe3b2; --warning-fg: #c2670c;
  --info: #027fff; --info-bg: #f0f7ff; --info-border: #cce5ff; --info-fg: #1d7bd8;
  --overlay: #00000099;
  --shadow-default: 0 1px 3px 0 rgba(0,0,0,.04);
  --shadow-card: 0 2px 8px 0 rgba(0,0,0,.02);
  --shadow-popover: 0 12px 24px -4px rgba(0,0,0,.06), 0 0 1px 0 rgba(0,0,0,.1);
  --shadow-modal: 0 12px 32px -4px rgba(0,0,0,.08), 0 0 1px 0 rgba(0,0,0,.1);
  --caller: #554f4c; --agent: #027fff; --heard: #8b5cf6;          /* transcript / timeline roles */
  color-scheme: light;
}
.dark {
  --primary-bg: #faf7f7; --primary-bg-hover: #f6f0ec; --primary-fg: #000000;
  --secondary-bg: #ffdcc61f; --secondary-bg-hover: #ffe4d326; --secondary-bg-pressed: #ffe9d52e;
  --tertiary-hover: #ffdbc917;
  --bg-default: #1d1d1c; --bg-medium: #161616; --bg-weak: #242321;
  --elevated: #242321; --elevated-medium: #2b2a29; --elevated-strong: #333130;
  --border: #ffe8dc38; --border-light: #ffdcc61f; --divider: #3e3b3a; --input: #ffe8dc38;
  --fill-weak: #ffdbb70f; --fill: #ffdbc917; --fill-medium: #ffdcc61f; --fill-strong: #ffe4d326;
  --text-title: #e5dcd9; --text-body: #dcd2ce; --text-subtitle: #d0c4c0; --text-desc: #ab9e9a;
  --text-helper: #877a76; --text-disabled: #615a57;
  --danger-bg: #450f0a; --danger-border: #7f251d; --danger-fg: #f76e66;
  --success-bg: #052e24; --success-border: #0f3e33; --success-fg: #33c3a0;
  --warning-bg: #432507; --warning-border: #7c4712; --warning-fg: #ffb246;
  --info-bg: #173654; --info-border: #1e548a; --info-fg: #9accff;
  --shadow-default: 0 1px 3px 0 rgba(0,0,0,.3);
  --shadow-popover: 0 12px 24px -4px rgba(0,0,0,.4), 0 0 1px 0 rgba(255,255,255,.12);
  --shadow-modal: 0 12px 32px -4px rgba(0,0,0,.5), 0 0 1px 0 rgba(255,255,255,.12);
  --caller: #c4b7b4; --agent: #3599ff; --heard: #a78bfa;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font-body); font-size: 14px; line-height: 20px; color: var(--text-body); background: var(--bg-default);
  -webkit-font-smoothing: antialiased; font-feature-settings: "salt" 1, "liga" 0; }
button, select, input, textarea { font: inherit; color: inherit; }
.mono, code, pre { font-family: var(--font-code); }
.desc { font-family: var(--font-description); color: var(--text-desc); }
.muted { font-family: var(--font-description); color: var(--text-desc); font-size: 12px; line-height: 16px; }
.hidden { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }
h2 { margin: 0; font: 500 16px/24px var(--font-heading); color: var(--text-title); }
h3 { margin: 0; font: 500 14px/20px var(--font-heading); color: var(--text-title); }
a { color: var(--info-fg); }

/* Fish Audio logo (platform-web components/icons/fish-audio.tsx, dark:invert) */
.fish-logo { width: 48px; height: 48px; flex: none; display: block; }
.dark .fish-logo { filter: invert(1); }

/* Icons (lucide paths, web/icons.js) */
.ic { width: 16px; height: 16px; flex: none; }

/* Button (platform-web Button: full radius, 1px reserved border, Onest 500) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid transparent; font-weight: 500; font-size: 14px; line-height: 20px; cursor: pointer;
  background: var(--secondary-bg); color: var(--text-title); transition: background-color .1s, color .1s, opacity .1s; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--secondary-bg-hover); }
.btn:active:not(:disabled) { background: var(--secondary-bg-pressed); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--primary-bg); color: var(--primary-fg); }
.btn.primary:hover:not(:disabled) { background: var(--primary-bg-hover); }
.btn.outline { background: transparent; border-color: var(--border); }
.btn.outline:hover:not(:disabled) { background: var(--fill-weak); }
.btn.ghost { background: transparent; color: var(--text-subtitle); }
.btn.ghost:hover:not(:disabled) { background: var(--tertiary-hover); color: var(--text-title); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { background: #f76e66; }
.btn.accent { background: var(--coral); color: #fff; }
.btn.accent:hover:not(:disabled) { background: #f78e6e; }
.btn.s32 { height: 32px; padding: 0 10px; } .btn.s24 { height: 24px; padding: 0 8px; font-size: 12px; line-height: 16px; }
.btn.s40 { height: 40px; padding: 0 16px; } .btn.s48 { height: 48px; padding: 0 22px; font-size: 16px; line-height: 24px; }
.btn.s48 svg { width: 20px; height: 20px; }
.btn.icon { padding: 0; width: 36px; } .btn.icon.s32 { width: 32px; } .btn.icon.s24 { width: 24px; }
.btn:disabled { opacity: .4; cursor: default; }

/* Segmented control */
.seg { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--fill); gap: 2px; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: var(--text-desc); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button svg { width: 14px; height: 14px; }
.seg button:hover:not(:disabled):not(.on) { color: var(--text-title); }
.seg button.on { background: var(--elevated-medium); color: var(--text-title); box-shadow: var(--shadow-default), 0 0 0 .5px var(--border-light); }
.seg button:disabled { cursor: default; opacity: .55; }
.seg.ask { box-shadow: 0 0 0 1.5px var(--coral); animation: ask 1.6s ease-in-out infinite; }
@keyframes ask { 0%, 100% { box-shadow: 0 0 0 1.5px var(--coral); } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--coral) 25%, transparent); } }

/* Select (native, platform-web look) */
select.sel { appearance: none; height: 36px; border-radius: 12px; border: 1px solid var(--input); background: var(--elevated);
  padding: 0 32px 0 12px; font-size: 14px; color: var(--text-title); cursor: pointer; min-width: 0;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-desc) 50%), linear-gradient(135deg, var(--text-desc) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select.sel:disabled { opacity: .5; cursor: default; }
select.sel option { background: var(--elevated); color: var(--text-title); }
.field { display: inline-flex; align-items: center; gap: 8px; }
.field > .lbl { color: var(--text-desc); font-size: 13px; }

/* Tag / pill */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 16px;
  font-weight: 500; background: var(--fill); color: var(--text-subtitle); white-space: nowrap; }
.tag svg { width: 12px; height: 12px; }
.tag.ok { background: var(--success-bg); color: var(--success-fg); } .tag.warn { background: var(--warning-bg); color: var(--warning-fg); }
.tag.bad { background: var(--danger-bg); color: var(--danger-fg); } .tag.info { background: var(--info-bg); color: var(--info-fg); }
.tag.coral { background: var(--coral-100); color: var(--coral-700); }
.dark .tag.coral { background: #4a2016; color: #f78e6e; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Switch (checkbox + .sw) */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-subtitle); cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw { width: 32px; height: 18px; border-radius: 9px; background: var(--fill-strong); position: relative; transition: background-color .15s; flex: none; }
.sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px #0003; transition: transform .15s; }
.switch input:checked + .sw { background: var(--primary-bg); } .switch input:checked + .sw::after { transform: translateX(14px); }
.dark .switch input:checked + .sw::after { background: #1d1d1c; }
.switch input:focus-visible + .sw { outline: 2px solid var(--info); outline-offset: 2px; }
.switch input:disabled + .sw { opacity: .5; } .switch.idle .sw { opacity: .55; }

/* Per-turn latency badge (web/latency.js) */
.lat { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; font-family: var(--font-code);
  font-size: 11px; line-height: 16px; font-variant-numeric: tabular-nums; background: var(--success-bg); color: var(--success-fg);
  white-space: nowrap; cursor: help; }
.lat.warn { background: var(--warning-bg); color: var(--warning-fg); } .lat.bad { background: var(--danger-bg); color: var(--danger-fg); }
.lat.ovl { background: color-mix(in srgb, var(--heard) 14%, transparent); color: var(--heard); } .lat.est { font-style: italic; }

/* Banner (busy / error / warn / info) */
.banner { display: flex; align-items: center; gap: 8px; margin: 0 12px 10px 0; padding: 10px 14px; border-radius: 14px; font-size: 13px;
  background: var(--warning-bg); color: var(--warning-fg); border: .5px solid var(--warning-border); }
.banner.error { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-border); }
.banner.info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-border); }

/* Scroll bars */
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--fill-strong) transparent; }
.fadein { animation: fadein .35s ease-out both; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
