/*
 * Oruk Voice Chat — self-contained styles.
 *
 * Theme tokens mirror the oruk developer portal (the /account shell) so this
 * app reads as part of the same family, but nothing here depends on the parent
 * site: it is a standalone, framework-free web app.
 */

:root {
  color-scheme: light;
  --background: oklch(0.985 0.001 285);
  --foreground: oklch(0.21 0.01 285);
  --card: oklch(1 0 0);
  --muted: oklch(0.955 0.003 285);
  --muted-foreground: oklch(0.48 0.012 285);
  --primary: oklch(0.52 0.12 160);
  --primary-foreground: oklch(0.985 0.005 160);
  --secondary: oklch(0.955 0.003 285);
  --accent: oklch(0.94 0.04 160);
  --border: oklch(0.21 0.01 285 / 10%);
  --border-strong: oklch(0.21 0.01 285 / 16%);
  --ring: oklch(0.55 0.12 160);
  --destructive: oklch(0.55 0.19 25);
  --radius: 0.75rem;
  --sidebar-w: 16rem;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

/* Light is the default (the :root above). Dark is opt-in via a data attribute
   set from Settings, not from the OS — so the app always opens light. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: oklch(0.17 0.01 285);
  --foreground: oklch(0.96 0.003 285);
  --card: oklch(0.21 0.012 285);
  --muted: oklch(0.25 0.012 285);
  --muted-foreground: oklch(0.68 0.012 285);
  --primary: oklch(0.7 0.13 162);
  --primary-foreground: oklch(0.19 0.03 160);
  --secondary: oklch(0.26 0.012 285);
  --accent: oklch(0.3 0.04 160);
  --border: oklch(1 0 0 / 10%);
  --border-strong: oklch(1 0 0 / 16%);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Layout ---------- */

.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: color-mix(in oklab, var(--card) 55%, var(--background));
  padding: 0.75rem;
}

.sidebar-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.25rem 0.25rem 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--foreground);
  padding: 0.25rem;
}
.brand-mark {
  height: 1.4rem;
  width: auto;
}
.brand-name {
  font-size: 1.05rem;
  font-weight: 600;
}
.brand-sub {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-top: 0.15rem;
}

.new-chat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) - 0.15rem);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.new-chat:hover {
  background: var(--secondary);
  border-color: var(--ring);
}
.new-chat-icon {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--primary);
}

/* Playground nav item (top of sidebar). */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: none;
  border-radius: calc(var(--radius) - 0.25rem);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.nav-item[data-active="true"] {
  background: color-mix(in oklab, var(--primary) 12%, transparent);
  color: var(--primary);
}
.nav-item svg {
  flex-shrink: 0;
}

.sessions-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding: 0.25rem 0.5rem 0.35rem;
  margin-top: 0.25rem;
}

.conversations {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.25rem 0;
  margin: 0 -0.25rem;
}

.convo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 0.5rem 0 0.75rem;
  margin: 0 0.25rem;
  border-radius: calc(var(--radius) - 0.25rem);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  border: none;
  background: transparent;
  text-align: left;
  width: calc(100% - 0.5rem);
  transition: background 0.15s, color 0.15s;
}
.convo:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.convo[data-active="true"] {
  background: color-mix(in oklab, var(--primary) 12%, transparent);
  color: var(--primary);
}
.convo-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.convo-del {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  border-radius: 0.4rem;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.convo:hover .convo-del {
  opacity: 1;
}
.convo-del:hover {
  background: color-mix(in oklab, var(--destructive) 14%, transparent);
  color: var(--destructive);
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.foot-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.25rem;
}
.foot-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--primary);
}
.foot-note {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
.foot-clear {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.72rem;
  padding: 0.15rem 0.25rem;
  border-radius: 0.35rem;
}
.foot-clear:hover {
  color: var(--destructive);
}

/* Settings: dark-mode toggle in the bottom-left. */
.foot-setting {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  height: 2.5rem;
  padding: 0 0.5rem 0 0.6rem;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius) - 0.25rem);
  color: var(--muted-foreground);
  font-size: 0.82rem;
  transition: background 0.15s, color 0.15s;
}
.foot-setting:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.foot-setting .foot-setting-icon {
  display: grid;
  place-items: center;
}
.foot-setting .foot-setting-label {
  flex: 1;
  text-align: left;
}
/* Track + knob switch, reflecting the current theme. */
.switch {
  flex-shrink: 0;
  width: 2.1rem;
  height: 1.15rem;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.18s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.2);
  transition: transform 0.18s;
}
:root[data-theme="dark"] .switch {
  background: var(--primary);
}
:root[data-theme="dark"] .switch::after {
  transform: translateX(0.95rem);
}

/* ---------- Main column ---------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  height: 3.25rem;
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 92%, transparent);
  backdrop-filter: blur(8px);
}
.topbar-title {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted-foreground);
}

.chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- View switching (playground vs. session) ---------- */

.playground,
.chat {
  display: none;
}
.app[data-view="playground"] .playground {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.app[data-view="chat"] .chat {
  display: flex;
}

/* ---------- Playground ---------- */

.pg-inner {
  max-width: 60rem;
  margin-inline: auto;
  padding: 3.5rem 1.5rem 3rem;
}
.pg-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 0.6rem;
}
.pg-title {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
.pg-sub {
  max-width: 42rem;
  color: var(--muted-foreground);
  line-height: 1.65;
  margin: 0 0 2rem;
}
.pg-sub strong {
  color: var(--foreground);
  font-weight: 600;
}
#pgModelName {
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.pg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.9rem;
}
.pg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.1rem 1.1rem 1.2rem;
  text-align: left;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.2s;
}
.pg-card:hover {
  transform: translateY(-2px);
  border-color: var(--ring);
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.08);
}
.pg-card[data-featured="true"] {
  border-color: color-mix(in oklab, var(--primary) 45%, var(--border-strong));
  background: linear-gradient(
    160deg,
    color-mix(in oklab, var(--primary) 10%, var(--card)),
    var(--card) 55%
  );
}
.pg-card-icon {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 0.6rem;
  background: color-mix(in oklab, var(--primary) 16%, transparent);
  color: var(--primary);
}
.pg-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.pg-card p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted-foreground);
  margin: 0;
}
.pg-card-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.pg-card-cta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}
.pg-chip {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
}
.pg-note {
  margin: 2rem 0 0;
  font-size: 0.72rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

/* ---------- Run settings panel ---------- */

.settings {
  width: 19rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: color-mix(in oklab, var(--card) 55%, var(--background));
}
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.25rem;
  padding: 0 0.75rem 0 1.1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}
.settings-close {
  display: none;
}
.settings-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.set-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.set-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.model-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.model-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) - 0.15rem);
  background: var(--card);
  color: var(--foreground);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.model-item:hover {
  border-color: var(--ring);
}
.model-item[data-active="true"] {
  border-color: var(--primary);
  background: color-mix(in oklab, var(--primary) 10%, var(--card));
}
.model-item-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.model-item-name {
  font-size: 0.88rem;
  font-weight: 600;
}
.model-item-tag {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  border: 1px solid color-mix(in oklab, var(--primary) 40%, transparent);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
}

/* Coming-soon model: a disabled, dimmed tile with a neutral pill. */
.model-item.soon {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--muted);
}
.model-item.soon:hover {
  border-color: var(--border-strong);
}
.model-item-pill {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  background: var(--secondary);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}
.model-item-check {
  margin-left: auto;
  color: var(--primary);
  opacity: 0;
}
.model-item[data-active="true"] .model-item-check {
  opacity: 1;
}
.model-item-desc {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted-foreground);
}
.set-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--foreground);
  cursor: pointer;
}
.set-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}
.set-note {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted-foreground);
  margin: 0;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

/* ---------- Messages ---------- */

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem 1rem 1rem;
}
.messages-inner,
.empty,
.msg-row {
  max-width: 46rem;
  margin-inline: auto;
}

.empty {
  height: 100%;
  min-height: 24rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  padding: 2rem 1rem;
}
.empty-mark {
  height: 3rem;
  width: auto;
  opacity: 0.9;
}
.empty-title {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0.25rem 0 0;
}
.empty-sub {
  max-width: 32rem;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin: 0;
}

.msg-row {
  display: flex;
  margin-bottom: 1rem;
}
.msg-row[data-role="user"] {
  justify-content: flex-end;
}
.msg-row[data-role="assistant"] {
  justify-content: flex-start;
}

.bubble {
  max-width: 85%;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  line-height: 1.55;
  font-size: 0.95rem;
  animation: bubble-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* User bubble — the transcription. */
.bubble.user {
  background: var(--primary);
  color: var(--primary-foreground);
  border-bottom-right-radius: 0.35rem;
}
.bubble.user.pending {
  background: var(--muted);
  color: var(--muted-foreground);
  font-style: italic;
}

/* Assistant bubble — the emotion read. */
.bubble.assistant {
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 0.35rem;
  /* Give the emotion bars room: without a floor the flexible bar column
     collapses to nothing and the fills have no track to fill. */
  min-width: min(24rem, 100%);
  max-width: 90%;
  padding: 0.9rem 1rem;
}
.bubble.assistant.error {
  border-color: color-mix(in oklab, var(--destructive) 40%, var(--border));
  color: var(--destructive);
}

.assistant-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 0.7rem;
}
.assistant-head .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--primary);
}

/* Emotion bars. */
.emotions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.emotion {
  display: grid;
  grid-template-columns: 6.5rem 1fr 2.5rem;
  align-items: center;
  gap: 0.6rem;
}
.emotion-label {
  font-size: 0.82rem;
  text-transform: capitalize;
}
.emotion-track {
  height: 0.5rem;
  border-radius: 999px;
  /* Background is set inline to a hard gradient stop (fill vs. muted). */
  background: var(--muted);
}
.emotion-score {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Multi-segment "moments". */
.overall-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-top: 0.9rem;
  margin-bottom: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.moments-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.7rem;
  margin-bottom: 0.75rem;
}
.moments-count {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.moments-arc {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
}
.shift-tag {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  border: 1px solid color-mix(in oklab, var(--primary) 40%, transparent);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}
.arc-emotion {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-transform: capitalize;
}
.arc-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.arc-arrow {
  color: var(--muted-foreground);
}

/* Tinted, hoverable transcript. */
.phrases-caption {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}
.phrases {
  line-height: 2.05;
  font-size: 0.95rem;
}
.phrase {
  position: relative;
  border-radius: 0.3rem;
  padding: 0.1rem 0.28rem;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  cursor: default;
  outline: none;
}
.phrase[tabindex="0"]:hover,
.phrase[tabindex="0"]:focus-visible {
  box-shadow: 0 0 0 1.5px var(--ring);
}
.phrase-tip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.4rem;
  display: flex;
  gap: 0.3rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s;
  z-index: 5;
}
.phrase:hover .phrase-tip,
.phrase:focus .phrase-tip {
  opacity: 1;
}
.tip-chip {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  padding: 0.14rem 0.45rem;
  border-radius: 0.35rem;
  color: oklch(0.23 0.015 285);
  text-transform: lowercase;
  box-shadow: 0 2px 8px oklch(0 0 0 / 0.18);
}
.tip-chip.tip-style {
  background: oklch(0.84 0.13 178);
}

.styles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.style-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 70%, transparent);
  color: var(--foreground);
  text-transform: lowercase;
}

/* thinking dots */
.thinking {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.2rem 0;
}
.thinking span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--muted-foreground);
  opacity: 0.6;
  animation: blink 1.2s infinite ease-in-out both;
}
.thinking span:nth-child(2) {
  animation-delay: 0.2s;
}
.thinking span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 0.9;
    transform: translateY(-2px);
  }
}

/* ---------- Composer ---------- */

.composer {
  border-top: 1px solid var(--border);
  padding: 1rem;
  background: color-mix(in oklab, var(--background) 96%, transparent);
}
.composer-inner {
  max-width: 46rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.composer-text {
  display: flex;
  flex-direction: column;
}
.composer-hint {
  font-size: 0.9rem;
  color: var(--muted-foreground);
}
.composer-timer {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}
.composer-foot {
  max-width: 46rem;
  margin: 0.75rem auto 0;
  font-size: 0.72rem;
  color: var(--muted-foreground);
  text-align: center;
}

.record-btn {
  position: relative;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--card);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.05);
}
.record-btn:hover {
  transform: translateY(-1px);
}
.record-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.record-glyph {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--primary);
  transition: all 0.2s ease;
}
/* recording → square stop + pulse */
.record-btn[data-state="recording"] .record-glyph {
  border-radius: 0.25rem;
  background: var(--destructive);
}
.record-btn[data-state="recording"] {
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--destructive) 18%, transparent);
}
.record-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--destructive);
  opacity: 0;
}
.record-btn[data-state="recording"] .record-ring {
  animation: record-pulse 1.4s ease-out infinite;
}
@keyframes record-pulse {
  0% {
    opacity: 0.5;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}
/* analyzing → spinner glyph */
.record-btn[data-state="analyzing"] .record-glyph {
  border-radius: 50%;
  background: transparent;
  border: 2px solid color-mix(in oklab, var(--primary) 35%, transparent);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Mobile ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.4);
  z-index: 30;
}

/* Below desktop, the run-settings panel collapses to a right-side drawer that
   the topbar's settings button opens. */
@media (max-width: 1024px) {
  .topbar {
    display: flex;
  }
  .settings {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 45;
    width: min(20rem, 85vw);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 40px oklch(0 0 0 / 0.15);
  }
  .app[data-settings="open"] .settings {
    transform: translateX(0);
  }
  .settings-close {
    display: grid;
  }
}
/* In the mid range the sidebar is still a static column, so the hamburger is
   unnecessary — only the settings button belongs in the topbar. */
@media (min-width: 821px) and (max-width: 1024px) {
  #menuBtn {
    display: none;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 40px oklch(0 0 0 / 0.15);
  }
  .sidebar[data-open="true"] {
    transform: translateX(0);
  }
  .topbar {
    display: flex;
  }
  .pg-inner {
    padding: 2rem 1.25rem 2.5rem;
  }
  .pg-title {
    font-size: 1.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
