/* Wave theme. The start ring, amber highlights, and cards follow the AmphionLive web demo. */
:root {
  --wave-amber: #60A5FA;
  --wave-hover: #1D4ED8;
  --wave-online: #E3F3EA;
  --wave-shadow: 0 1px 2px rgb(31 37 45 / 4%);
  --wave-mark: linear-gradient(90deg, var(--accent) 0 18%, transparent 18% 24%,
    var(--wave-amber) 24% 52%, transparent 52% 58%, var(--accent) 58% 70%, transparent 70%);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}
.app-header::after {
  content: '';
  position: absolute;
  inset-inline-start: max(32px, env(safe-area-inset-left));
  bottom: -1px;
  width: 120px;
  height: 2px;
  background: var(--wave-mark);
  pointer-events: none;
}
.app-brand { font-weight: 650; letter-spacing: .005em; }
.app-account, .account-actions { display: flex; align-items: center; gap: 10px; }
.app-account { min-width: 0; padding-inline-start: 12px; border-inline-start: 1px solid var(--line); }
.app:not([data-view="ready"]) .app-account { display: none; }
.app-account .avatar { width: 36px; height: 36px; background: var(--accent-soft); color: var(--accent-text); border: 0; }
.app-account .who-name { font-weight: 600; max-width: 18ch; }
.app-account .who-status { white-space: nowrap; }
.app-account .who-status:has(.dot[data-state="ok"]) { color: var(--online); }

.view-ready {
  max-width: 1184px;
  gap: 24px;
  padding: 28px max(32px, env(safe-area-inset-right)) 64px max(32px, env(safe-area-inset-left));
}
.ready-main { display: flex; flex-direction: column; gap: 28px; min-width: 0; container-type: inline-size; }
.ready-hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.ready-eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; color: var(--muted); font-size: 13px; letter-spacing: .04em; }
.wave-bars { display: inline-flex; align-items: center; gap: 2px; }
.wave-bars i { width: 3px; height: 6px; border-radius: 2px; background: var(--accent); }
.wave-bars i:nth-child(2) { height: 10px; }
.wave-bars i:nth-child(3) { height: 14px; }
.wave-bars i:nth-child(4) { height: 9px; background: var(--wave-amber); }
.wave-bars i:nth-child(5) { height: 5px; background: var(--wave-amber); }
.ready-hero h1 { margin: 0; font-size: 40px; font-weight: 700; line-height: 1.2; }
.ready-subtitle { margin: 8px 0 0; font-size: 16px; color: var(--muted); text-wrap: balance; }

.start-stage { display: grid; place-items: center; width: 320px; max-width: 100%; aspect-ratio: 1; margin-top: 4px; }
.start-stage > * { grid-area: 1 / 1; }
.start-ring { width: 100%; height: 100%; pointer-events: none; }
.start-ring rect { fill: var(--accent); opacity: .5; }
.start-ring g:nth-child(even) rect { fill: var(--wave-amber); opacity: .4; }
.start-ring g:nth-child(3n) rect { opacity: .28; }
.start-stage:has(.start:disabled) .start-ring rect { opacity: .18; }
.start {
  z-index: 1;
  width: 168px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  box-shadow: 0 0 0 16px var(--accent-soft), inset 0 1px rgb(255 255 255 / 25%), 0 14px 30px rgb(37 99 235 / 24%);
  font-size: 18px;
  font-weight: 700;
}
.start:not(:disabled):active { transform: scale(.97); }
.start:focus-visible { outline: 3px solid var(--accent); outline-offset: 18px; }
.start:disabled { opacity: .6; }
@media (hover: hover) {
  .start:not(:disabled):hover, .btn-primary:not(:disabled, [data-soon="true"]):hover { background: var(--wave-hover); }
}
.start-summary { margin: 2px 0 8px; color: var(--text-2); font-size: 14px; }
.start-area { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.start-area .notice { max-width: 640px; text-align: start; }

@keyframes wave-ring-breathe {
  0%, 100% { transform: scaleY(.55); }
  50% { transform: scaleY(1); }
}
@media (prefers-reduced-motion: no-preference) {
  .start { transition: background-color .15s, transform .15s; }
  .start-stage:not(:has(.start:disabled)) .start-ring rect {
    transform-box: fill-box;
    transform-origin: center bottom;
    animation: wave-ring-breathe 2.4s ease-in-out infinite;
  }
  .start-ring g:nth-child(6n + 2) rect { animation-delay: -.4s; }
  .start-ring g:nth-child(6n + 3) rect { animation-delay: -.8s; }
  .start-ring g:nth-child(6n + 4) rect { animation-delay: -1.2s; }
  .start-ring g:nth-child(6n + 5) rect { animation-delay: -1.6s; }
  .start-ring g:nth-child(6n) rect { animation-delay: -2s; }
}

.ready-scenes { display: flex; flex-direction: column; gap: 16px; }
.ready-scenes:not(:has(> :not([hidden]))) { display: none; }
.section-title { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: .02em; }
.scene-heading, .scene-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scene-description { flex: 1; margin: 0; color: var(--faint); font-size: 13px; }
.scene-nav .icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); }
.scene-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 176px;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-behavior: smooth;
  scroll-snap-type: inline proximity;
  scroll-padding-inline: 4px;
  scrollbar-width: thin;
  margin: -4px -4px 0;
  padding: 4px 4px 10px;
}
.scene-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
  padding: 0 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--wave-shadow);
  text-align: start;
  scroll-snap-align: start;
}
.scene-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  margin-bottom: 8px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--raised);
}
.scene-art:not(:has(img))::before { content: ''; width: 64px; height: 3px; background: var(--wave-mark); }
.scene-art img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.scene-badge {
  position: absolute;
  inset: 8px auto auto 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 0 0 1px rgb(31 37 45 / 8%);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 650;
}
.scene-title, .scene-subtitle { width: 100%; padding: 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-title { font-size: 14px; font-weight: 650; }
.scene-subtitle { color: var(--faint); font-size: 12.5px; }
.scene-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
.scene-card[aria-checked="true"] .scene-subtitle { color: var(--text-2); }
.scene-card[aria-checked="true"]::after {
  content: '✓';
  position: absolute;
  inset: 8px 8px auto auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
}

.ready-settings {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px 40px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--wave-shadow);
}
.ready-settings:has(.prompt-language-picker[hidden]) { grid-template-columns: minmax(0, 1fr); }
.ready-settings .voice-picker { align-items: stretch; min-width: 0; }
.ready-settings .voice-chips { justify-content: flex-start; }
.voice-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  height: auto;
  padding: 8px 16px 8px 12px;
  border-radius: 12px;
  text-align: start;
}
.voice-chips .chip::before {
  content: '';
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--muted);
  background: linear-gradient(currentColor, currentColor) 9px center / 3px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 13px center / 3px 14px no-repeat,
    linear-gradient(currentColor, currentColor) 17px center / 3px 18px no-repeat,
    linear-gradient(currentColor, currentColor) 21px center / 3px 10px no-repeat var(--raised);
}
.voice-chips .chip[data-voice="clone"]::before {
  background: radial-gradient(circle, currentColor 2px, transparent 3px 6px, currentColor 7px 8px, transparent 9px) var(--raised);
}
.voice-chips .chip[aria-checked="true"] { border-width: 1px; box-shadow: inset 0 0 0 1px var(--accent); }
.voice-chips .chip[aria-checked="true"]::before { background-color: var(--accent); color: var(--accent-ink); }
.prompt-language-picker { flex-direction: column; align-items: stretch; padding-inline-start: 40px; border-inline-start: 1px solid var(--line); }
.prompt-language-picker .input { max-width: 280px; height: 40px; border-radius: 8px; }
.clone-panel { padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--bg); }
.ready-preview { height: 460px; flex: none; border-radius: 16px; }

@media (min-width: 1100px) {
  .view-ready.with-preview {
    max-width: 1440px;
    display: grid;
    grid-template-columns: minmax(420px, 560px) minmax(0, 1fr);
    align-items: start;
    gap: 40px;
  }
  .view-ready.with-preview .ready-preview { position: sticky; top: 88px; height: calc(100dvh - 116px); }
}
@container (max-width: 640px) {
  .ready-settings { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; }
  .prompt-language-picker { padding: 16px 0 0; border-inline-start: 0; border-top: 1px solid var(--line); }
  .prompt-language-picker .input { max-width: none; }
  .scene-heading { flex-wrap: wrap; }
  .scene-description { order: 1; flex-basis: 100%; }
}

.view-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  align-items: center;
  gap: clamp(24px, 6vw, 88px);
  width: 100%;
  max-width: 1120px;
  min-height: calc(100dvh - 72px);
  padding: 48px 32px;
}
.login-intro { display: flex; flex-direction: column; gap: 20px; }
.login-intro .brand h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); }
.login-intro .brand::after { content: ''; width: 120px; height: 3px; background: var(--wave-mark); }
.login-title { margin: 0; font-size: 22px; }
.login-card { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--wave-shadow); }
:is(.card, .list, .agent-card, .memory-entry, .admin-entry, .control-section) { border-radius: 12px; }
:is(.card, .list, .control-section) { box-shadow: var(--wave-shadow); }
.control-section { padding: 16px; background: var(--surface); }
.navbar > h1.h1-18 { font-size: 24px; }
.sheet { border-radius: 16px 16px 0 0; }

.talk-heading { gap: 10px; }
.talk-heading h1 { font-size: 16px; font-weight: 650; }
.pill { height: 26px; padding: 0 10px; gap: 6px; border-radius: 13px; background: var(--raised); color: var(--text-2); font-weight: 600; }
.pill[data-state="listening"] { background: var(--wave-online); color: var(--online); }
.pill[data-state="speaking"] { background: var(--accent-soft); color: var(--accent-text); }
.pill:is([data-state="muted"], [data-state="ended"]) { background: #FBE9E8; color: var(--danger); }
.wave-card { padding: 14px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--wave-shadow); }
.wave-label { width: max-content; min-width: 36px; }
.transcript-heading h2, .task-panel-header h2 { color: var(--text); font-size: 14px; font-weight: 650; }
.cap:is(.bot, .user) { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: start; gap: 8px; }
.cap:is(.bot, .user) .cap-head { flex-wrap: wrap; gap: 4px; padding-top: 4px; }
.cap.user { padding-left: 0; border-left: 0; }
.cap.user:not(.unrecognized) .cap-text { justify-self: start; padding: 8px 14px; background: var(--raised); border-radius: 4px 14px 14px; }
.latest-caption { background: var(--accent-soft); color: var(--accent-text); border-radius: 14px; }
.task { border-radius: 12px; background: var(--surface); }
.text-row .textarea { border-radius: 12px; }
.controls :is(.round-64, .round-84) { width: 60px; height: 60px; }

@media (min-width: 760px) and (max-height: 860px) {
  .view-ready { padding-top: 16px; }
  .ready-main { gap: 18px; }
  .start-stage { margin: -22px 0 -26px; }
  .scene-art { aspect-ratio: 16 / 9; }
}
@media (max-width: 759px) {
  .app-header::after { inset-inline-start: max(20px, env(safe-area-inset-left)); width: 80px; }
  .app-header-end, .app-account, .account-actions { gap: 4px; }
  .app-account { padding-inline-start: 4px; }
  .app-account .who-text { display: none; }
  .app-account .avatar { width: 30px; height: 30px; }
  .app-account .voiceprint-chip span { display: none; }
  .view-login { grid-template-columns: minmax(0, 1fr); max-width: 510px; gap: 24px; align-content: start; min-height: calc(100dvh - 60px); padding: 28px 20px; }
  .view-ready { padding: 24px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
  .ready-main { gap: 24px; }
  .ready-hero h1 { font-size: 30px; }
  .ready-subtitle { font-size: 14px; }
  .start-stage { width: 272px; }
  .start { width: 148px; font-size: 16px; box-shadow: 0 0 0 12px var(--accent-soft), 0 12px 26px rgb(37 99 235 / 24%); }
  .scene-grid { grid-auto-columns: 148px; }
  .scene-nav { display: none; }
  .scene-title, .scene-subtitle { padding-inline: 10px; }
  .ready-preview { height: 70dvh; }
  .wave-card { padding: 10px 12px; }
}
@media (max-width: 759px) and (max-height: 650px) {
  .controls :is(.round-64, .round-84) { width: 48px; height: 48px; }
}
@media (max-width: 480px) {
  .app-brand > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-brand { min-width: 0; }
  .app-brand img { flex: none; }
  .app-brand :is(.brand-divider, .brand-product) { display: none; }
  .voice-chips .chip { width: 100%; }
}
@media (max-width: 379px) {
  .app-brand > span { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
}
