:root {
  color-scheme: dark;
  --bg: #100f16;
  --sidebar: #13121a;
  --panel: #191821;
  --field: #121119;
  --line: #2b2837;
  --ink: #f3f0fa;
  --muted: #a5a0b4;
  --dim: #817b91;
  --accent: #b89cff;
  --accent-ink: #24143f;
  --mint: #7bd6b5;
  --radius: 17px;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.symbols, [hidden] { display: none !important; }
.ico { display: block; width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { width: 1px; height: 1px; padding: 0; position: absolute; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sidebar { width: 221px; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid #24212e; padding: 28px 18px 22px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px; width: fit-content; }
.brand-icon { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 13px; background: #b799ff; color: #261544; }
.brand-icon .ico { width: 24px; height: 24px; stroke-width: 1.8; }
.brand strong { display: block; font-size: 19px; font-weight: 700; line-height: 1.2; letter-spacing: .12em; }
.brand small { display: block; color: var(--muted); margin-top: 3px; font-size: 11px; letter-spacing: .035em; }
.navigation { display: grid; gap: 7px; margin-top: 42px; }
.navigation a { display: flex; align-items: center; gap: 12px; color: var(--muted); border: 1px solid transparent; border-radius: 10px; padding: 11px 13px; min-height: 43px; }
.navigation a:hover { background: #1c1926; color: var(--ink); }
.navigation a[aria-current="page"] { color: #d2bfff; background: #292039; border-color: #342748; font-weight: 600; }
.sidebar-foot { display: flex; align-items: center; gap: 9px; color: var(--dim); margin: auto 8px 0; padding-top: 19px; border-top: 1px solid #26232f; font-size: 12px; }
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.sidebar-foot .dot { width: 6px; height: 6px; }

.workspace { margin-left: 221px; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 73px; padding: 0 40px; border-bottom: 1px solid #24212e; gap: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: var(--dim); font-size: 13px; }
.breadcrumb .ico { width: 13px; height: 13px; }
.breadcrumb strong { color: #ded8eb; font-weight: 550; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.button.account-button { min-height: 38px; }
.wallet-link { display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 10px 0 12px; background: #1e192a; color: #d9c8ff; border: 1px solid #382d4a; border-radius: 9px; white-space: nowrap; font-size: 12px; }
.wallet-link:hover { background: #2a203b; }
.wallet-link strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.wallet-link .ico { width: 15px; height: 15px; }
.wallet-link .wallet-plus { margin-left: 3px; padding: 3px; width: 19px; height: 19px; background: #34274b; border-radius: 5px; }

.main { max-width: 1390px; margin: 0 auto; padding: 32px 40px 52px; }
.page-heading { margin-bottom: 25px; }
.page-heading h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); font-weight: 680; letter-spacing: -.055em; line-height: 1.25; }
.page-heading p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, 345px); gap: 20px; align-items: start; }
.studio-left { display: grid; gap: 20px; min-width: 0; }
.panel { min-width: 0; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.panel-heading h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 15px; font-weight: 650; line-height: 1.3; }
.heading-icon { display: inline-grid; place-items: center; width: 29px; height: 29px; border: 1px solid #382b4c; border-radius: 8px; background: #282037; color: #c9b0ff; }
.heading-icon .ico { width: 15px; height: 15px; }
.demo-label { white-space: nowrap; color: #d9c7ff; border: 1px solid #3b2e4f; background: #2b223a; border-radius: 999px; padding: 4px 9px; font-size: 11px; }
.quiet-label { color: var(--muted); font-size: 12px; }
.stage-panel { padding: 15px; }
.stage-panel > .panel-heading { padding: 0 1px; margin-bottom: 13px; }
.camera { position: relative; isolation: isolate; aspect-ratio: 1.86; max-height: 470px; display: grid; overflow: hidden; border-radius: 12px; border: 1px solid #352741; background: radial-gradient(ellipse at 55% 40%, #59417b, #1a142b 50%, #100d19 93%); }
.stage-image, .camera-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-image { display: block; object-fit: cover; object-position: center 26%; }
.camera-shade { background: linear-gradient(0deg, #0d0919ec, #0f0a1c35 29%, transparent 59%), linear-gradient(135deg, #100b2070, transparent 49%); pointer-events: none; }
.camera-state { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid #ffffff22; border-radius: 7px; background: #171024af; color: #f0e7ff; font-size: 11px; }
.camera-state .dot { width: 6px; height: 6px; background: #c4adff; }
.camera.active .camera-state .dot { background: var(--mint); }
.camera-caption { position: absolute; bottom: 18px; left: 17px; display: grid; gap: 3px; min-width: 0; max-width: 75%; color: #fff; }
.camera-caption strong { font-size: 22px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-caption span { color: #d9cce9; font-size: 11px; }
.wave { position: absolute; right: 17px; bottom: 21px; height: 24px; display: flex; align-items: center; gap: 4px; }
.wave i { display: block; width: 3px; height: 7px; border-radius: 4px; background: #d0b8ff; opacity: .8; }
.wave i:nth-child(2n) { height: 12px; }
.wave i:nth-child(3), .wave i:nth-child(5) { height: 20px; }
.wave i:nth-child(4) { height: 24px; }
.speaking .wave i { animation: wave .6s alternate infinite ease-in-out; }
.speaking .wave i:nth-child(2n) { animation-delay: -.35s; }
.speaking .wave i:nth-child(3n) { animation-delay: -.17s; }
@keyframes wave { from { transform: scaleY(.45); } to { transform: scaleY(1.1); } }

.stage-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; }
.session-clock, .control-buttons { display: flex; align-items: center; gap: 9px; }
.session-clock { padding-left: 2px; color: #b9b0cc; font-variant-numeric: tabular-nums; letter-spacing: .045em; font-size: 13px; }
.session-clock .ico { width: 16px; height: 16px; color: var(--dim); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; gap: 7px; padding: 0 14px; border: 1px solid #383345; border-radius: 8px; background: #24212e; color: var(--ink); font-weight: 600; font-size: 13px; white-space: nowrap; }
.button:hover { background: #2e293b; border-color: #4c415d; }
.button:active { transform: translateY(1px); }
.button .ico { width: 16px; height: 16px; }
.button.primary { border-color: transparent; background: var(--accent); color: var(--accent-ink); }
.button.primary:hover { background: #ceb9ff; }
.button.danger { border-color: #6a4351; background: #422936; color: #ffcfda; }
.button.danger:hover { background: #543140; }
.icon-button { padding: 0; width: 38px; }
.icon-button[aria-pressed="true"] { color: var(--dim); }

.settings { padding: 15px 17px 16px; }
.settings .panel-heading { margin-bottom: 17px; }
.field { display: grid; gap: 8px; margin-bottom: 17px; }
.field label { font-size: 12px; color: #ddd7ea; font-weight: 600; }
.upload-box { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px; border: 1px dashed #463951; border-radius: 10px; background: #1e1929; }
.upload-box.dragging { border-color: var(--accent); background: #332448; }
.upload-box > img { flex: none; width: 48px; height: 48px; object-fit: cover; border-radius: 7px; background: #352548; }
.upload-details { flex: 1; display: grid; gap: 4px; min-width: 0; }
.upload-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.upload-details span { color: var(--muted); font-size: 10px; }
.upload-button { flex: none; width: 33px; min-height: 33px; color: #e0cbff; background: #302340; border-color: #443354; }
.field input:not([type="file"]), .field select, .field textarea { width: 100%; border: 1px solid #302c3c; background: var(--field); color: var(--ink); border-radius: 8px; }
.field input:not([type="file"]), .field select { min-height: 39px; padding: 0 10px; font-size: 13px; }
.field select { padding-right: 8px; }
.textarea-wrap { position: relative; }
.field textarea { display: block; padding: 9px 10px 23px; min-height: 109px; line-height: 1.63; font-size: 13px; resize: vertical; }
.counter { position: absolute; right: 10px; bottom: 7px; color: var(--dim); font-size: 10px; pointer-events: none; }
.profile-save { width: 100%; border-color: #4b3b65; color: #dcc8ff; background: #2a2039; }
.profile-save:hover { background: #37284c; }
.form-note { margin: 11px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }

.conversation { padding: 13px 15px 15px; }
.messages { min-height: 42px; max-height: 225px; overflow-y: auto; padding: 5px 0 8px; display: grid; gap: 7px; }
.empty-chat { margin: 6px 0; color: var(--muted); font-size: 12px; align-self: center; }
.message { width: fit-content; max-width: 90%; display: grid; gap: 4px; padding: 8px 10px; border: 1px solid #32283f; border-radius: 9px; background: #221b2d; overflow-wrap: anywhere; }
.message.user { justify-self: end; background: #302346; border-color: #493561; }
.message strong { font-size: 10px; color: #c3a7ff; }
.message p { margin: 0; font-size: 13px; line-height: 1.5; }
.chat-form { display: flex; gap: 7px; align-items: center; min-height: 43px; padding: 4px; background: var(--field); border: 1px solid #312c3c; border-radius: 9px; }
.chat-form:focus-within { border-color: #8265b7; }
.chat-form input { flex: 1; min-width: 0; width: 100%; padding: 5px 9px; border: 0; outline: none; color: var(--ink); background: transparent; }
.chat-form input::placeholder { color: var(--dim); font-size: 13px; }
.send-button { display: grid; place-items: center; width: 33px; height: 33px; border: 0; border-radius: 6px; background: #35264b; color: #dac4ff; }
.send-button:hover { background: #50376e; }
.send-button .ico { width: 16px; height: 16px; }

.balance-panel { display: flex; align-items: center; justify-content: space-between; gap: 13px; padding: 24px; background: linear-gradient(125deg, #2c2142, #191821 80%); }
.balance-big { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.balance-big strong { color: #e6d6ff; font-size: 44px; letter-spacing: -.045em; font-variant-numeric: tabular-nums; line-height: 1; }
.balance-big span { color: #c9b4ee; font-size: 13px; }
.balance-side { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.balance-side strong { color: var(--ink); font-weight: 600; white-space: nowrap; }
.wallet-note { text-align: left; }
.redeem-panel { margin-top: 19px; padding: 15px 17px 17px; }
.redeem-form { display: flex; gap: 8px; margin-top: 12px; }
.redeem-form input { flex: 1; min-width: 0; padding: 0 10px; background: var(--field); color: var(--ink); border: 1px solid #302c3c; border-radius: 8px; }
.consent { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.consent input { margin: 2px 0 0; accent-color: var(--accent); }
.history { margin-top: 19px; padding: 15px 17px; }
.ledger { margin: 8px 0 0; padding: 0; list-style: none; }
.ledger li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 42px; padding: 6px 0; border-top: 1px solid var(--line); }
.ledger li span { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.ledger time { color: var(--muted); font-size: 11px; }
.ledger strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .credit { color: var(--mint); }
.ledger .debit { color: #e7cef6; }
.dialog { width: min(365px, calc(100% - 32px)); padding: 21px; color: var(--ink); background: var(--panel); border: 1px solid #493858; border-radius: var(--radius); box-shadow: 0 20px 70px #0008; }
.dialog::backdrop { background: #0c0818b9; backdrop-filter: blur(3px); }
.dialog h2 { margin: 0 0 10px; font-size: 18px; }
.dialog p { margin: 0; color: var(--muted); line-height: 1.6; }
.dialog .field { margin-top: 13px; margin-bottom: 12px; }
.dialog #auth-error { color: #ffd0dc; }
.auth-links { margin-top: 10px; }
.text-button { padding: 2px 0; border: 0; background: transparent; color: var(--accent); }
.text-button:hover { text-decoration: underline; }
.dialog-actions { margin-top: 19px; display: flex; justify-content: flex-end; gap: 8px; }
.notification { position: fixed; z-index: 3; bottom: 22px; right: 24px; max-width: min(385px, calc(100% - 48px)); padding: 11px 14px; border: 1px solid #59436e; border-radius: 10px; background: #2c203c; color: #eee2ff; box-shadow: 0 9px 28px #0005; line-height: 1.55; }

@media (min-width: 1450px) { .main { padding-left: 51px; padding-right: 51px; } }
@media (max-width: 1160px) {
  .sidebar { width: 181px; }
  .workspace { margin-left: 181px; }
  .topbar, .main { padding-left: 24px; padding-right: 24px; }
  .studio-grid { grid-template-columns: minmax(0, 1fr) minmax(275px, 305px); gap: 15px; }
  .studio-left { gap: 15px; }
}
@media (max-width: 920px) {
  .sidebar { position: static; width: auto; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border: 0; border-bottom: 1px solid #24212e; }
  .brand { padding: 0; }
  .brand-icon { width: 35px; height: 35px; border-radius: 10px; }
  .brand-icon .ico { width: 20px; height: 20px; }
  .brand strong { font-size: 16px; }
  .brand small { font-size: 9px; }
  .navigation { display: flex; margin: 0; }
  .navigation a { min-height: 36px; padding: 6px 8px; gap: 6px; font-size: 12px; }
  .navigation .ico { width: 15px; height: 15px; }
  .sidebar-foot { display: none; }
  .workspace { margin: 0; }
  .topbar { height: 55px; }
  .main { padding-top: 24px; }
}
@media (max-width: 650px) {
  .sidebar, .topbar, .main { padding-left: 13px; padding-right: 13px; }
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .stage-panel, .conversation { padding: 12px; }
  .page-heading { margin-bottom: 17px; }
  .page-heading p { font-size: 13px; }
  .camera { aspect-ratio: 1.5; }
  .camera-caption { bottom: 13px; }
  .wave { bottom: 14px; }
}
@media (max-width: 400px) {
  .breadcrumb > span, .breadcrumb > .ico { display: none; }
  .button.account-button { padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) { .speaking .wave i { animation: none; } }
