:root {
  color-scheme: light;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #192925;
  background: #f3f6f4;
  --ink: #192925;
  --muted: #526761;
  --line: #d6e2db;
  --green: #0a6650;
  --dark-green: #064a3b;
  --soft-green: #e6f3ec;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100vh; margin: 0; }
h1, h2, p { margin: 0; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 2px solid #178970; outline-offset: 3px; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner, .workspace { width: min(1220px, calc(100% - 48px)); margin-inline: auto; }
.topbar-inner { min-height: 64px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.brand { font-size: .96rem; font-weight: 700; }
.connection { display: inline-flex; gap: 7px; align-items: center; font-size: .81rem; font-weight: 650; color: var(--muted); }
.connection::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #80928b; }
.connection[data-state="online"] { color: var(--dark-green); }
.connection[data-state="online"]::before { background: #178665; }
.connection[data-state="connecting"]::before, .connection[data-state="reconnecting"]::before { background: #aa6d13; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, .64fr); align-items: start; gap: 18px; padding-block: 27px 36px; }
.studio, .chat { min-width: 0; }
.stage { position: relative; min-height: 310px; height: clamp(360px, 58vh, 620px); display: grid; place-items: center; overflow: hidden; border-radius: 15px; background: #102b27; color: #f6fcf8; }
.stage::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 48% 31%, #216454 0%, #102b27 65%); }
.stage-cover { z-index: 3; display: grid; justify-items: center; gap: 12px; text-align: center; padding: 20px; }
.stage:has(.avatar-media:not([hidden])) .stage-cover { align-self: end; margin: 0 12px 16px; background: #102522e8; border-radius: 12px; }
.stage:has(.avatar-media:not([hidden])) .signal { display: none; }
.stage-cover h1 { font-size: clamp(1.65rem, 3.5vw, 2.4rem); line-height: 1.15; letter-spacing: -.04em; }
.stage-cover p { color: #d2e9df; font-size: .9rem; line-height: 1.5; }
.stage-cover .stage-button { margin-top: 6px; }
.signal { display: flex; align-items: center; justify-content: center; gap: 5px; width: 78px; height: 78px; border-radius: 24px; background: #ffffff14; border: 1px solid #ffffff2b; margin-bottom: 7px; }
.signal i { height: 16px; width: 4px; border-radius: 3px; background: #cbf5e4; }
.signal i:nth-child(2), .signal i:nth-child(4) { height: 26px; }
.signal i:nth-child(3) { height: 38px; }
#video, .avatar-media { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #102522; }
.avatar-media { z-index: 2; }
.sound-button { position: absolute; z-index: 4; right: 13px; bottom: 13px; background: #fff; color: var(--dark-green); border-color: #b2cfc3; }

.stage-button, .sound-button, .primary, .control-button, .quiet, .danger { padding: 8px 13px; min-height: 42px; border-radius: 8px; border: 1px solid transparent; font-size: .86rem; font-weight: 690; white-space: nowrap; }
.stage-button { padding-inline: 23px; color: #15352a; background: #d9f6e8; }
.stage-button:hover:not(:disabled), .sound-button:hover { background: #beebd6; }
.primary { color: #fff; background: var(--green); }
.primary:hover:not(:disabled) { background: var(--dark-green); }
.control-button { background: #fff; color: var(--dark-green); border-color: #aac7ba; }
.control-button[aria-pressed="true"] { background: var(--soft-green); }
.control-button:hover:not(:disabled), .quiet:hover:not(:disabled) { background: var(--soft-green); }
.quiet { color: var(--dark-green); background: transparent; }
.danger { color: #a03633; background: transparent; }
.danger:hover:not(:disabled) { background: #fceae8; }
.studio-controls { margin-top: 12px; border-radius: 12px; padding: 9px 10px; border: 1px solid var(--line); background: #fff; display: flex; justify-content: space-between; gap: 7px; flex-wrap: wrap; }
.mic-group, .session-actions { display: flex; gap: 7px; align-items: center; min-width: 0; }
.status-text { color: var(--muted); font-size: .81rem; }
.notice { padding: 8px 10px; margin-top: 9px; background: var(--soft-green); color: var(--dark-green); border-radius: 8px; font-size: .83rem; line-height: 1.45; }
.notice[data-kind="error"] { background: #ffefed; color: #972c28; }

.chat { display: grid; grid-template-rows: auto minmax(195px, 1fr) auto; min-height: calc(clamp(360px, 58vh, 620px) + 66px); border: 1px solid var(--line); background: #fff; overflow: hidden; border-radius: 13px; }
.chat-heading { padding: 14px 15px; border-bottom: 1px solid var(--line); }
.chat-heading h2 { font-size: .99rem; }
.transcript { max-height: 59vh; min-height: 195px; overflow: auto; padding: 13px 14px; }
.empty-message { color: var(--muted); line-height: 1.55; font-size: .87rem; padding: 6px 3px; }
.message-row { display: grid; justify-items: start; gap: 5px; margin-bottom: 11px; }
.message-row[data-role="user"] { justify-items: end; }
.speaker { font-size: .75rem; color: var(--muted); }
.bubble { max-width: 91%; padding: 8px 10px; border-radius: 9px; background: #f0f4f2; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .87rem; line-height: 1.55; }
[data-role="user"] .bubble { background: #dcf0e6; }
.composer { display: grid; grid-template-columns: minmax(0,1fr) max-content; align-items: center; gap: 8px; padding: 11px; border-top: 1px solid var(--line); }
.composer textarea { width: 100%; border: 1px solid #b9ccc3; border-radius: 8px; color: var(--ink); background: #fff; padding: 8px 10px; font-size: .9rem; line-height: 1.4; resize: vertical; }
.composer textarea::placeholder { color: #5e726b; }
.composer textarea:disabled { background: #f6f8f7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0,1fr); gap: 12px; padding-top: 13px; }
  .stage { height: clamp(278px, 48vh, 390px); min-height: 278px; }
  .chat { min-height: 310px; }
  .transcript { max-height: 42vh; }
}

@media (max-width: 460px) {
  .topbar-inner, .workspace { width: calc(100% - 22px); }
  .topbar-inner { min-height: 51px; }
  .studio-controls { padding: 5px; }
  .studio-controls button { padding-inline: 7px; }
  .control-button { font-size: .8rem; }
  .status-text { font-size: .72rem; }
}
