:root {
  --ink: #070a09;
  --surface: #101412;
  --surface-2: #171c19;
  --line: rgba(244, 242, 236, 0.13);
  --line-strong: rgba(244, 242, 236, 0.24);
  --text: #f4f2ec;
  --muted: #a4aaa5;
  --faint: #6f7671;
  --emerald: #45d483;
  --emerald-ink: #082515;
  --amber: #e4b762;
  --danger: #f07d74;
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body, #app { width: 100%; height: 100%; overflow: clip; background: var(--ink); }
body {
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  user-select: none;
}
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-app-region: no-drag; }
button { color: inherit; }
body { --portrait-stage-top: 80px; }

.login-screen {
  position: absolute; inset: 0; z-index: 25; overflow: hidden; color: var(--text); background: #050706;
}
.login-screen::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: url("login-background.png") center center / cover no-repeat;
}
.login-screen::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(4, 6, 5, .16) 0%, rgba(4, 6, 5, .04) 48%, rgba(4, 6, 5, .17) 100%);
}
.login-topbar {
  position: absolute; inset: 0 0 auto 0; height: 118px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 21px 0 clamp(24px, 4.5vw, 76px); -webkit-app-region: no-drag;
}
.login-brand { gap: 13px; }
.login-brand .brand-icon { width: 45px; height: 45px; }
.login-screen .login-brand strong { font-size: 25px; font-weight: 520; letter-spacing: .06em; }
.login-screen .login-brand small { margin: 0 0 2px 9px; display: inline; color: rgba(244, 242, 236, .48); font-size: 13px; letter-spacing: .08em; }
.login-brand > div { display: flex; align-items: flex-end; }
.login-titlebar-drag-region { align-self: stretch; flex: 1 1 auto; min-width: 24px; -webkit-app-region: drag; }
.window-controls.login-window-controls {
  position: absolute; z-index: 27; top: 39px; right: 21px; margin: 0;
  -webkit-app-region: no-drag !important;
}
.login-form {
  position: absolute; left: clamp(72px, 15.65vw, 262px); top: 50%; width: clamp(360px, 26.9vw, 450px);
  transform: translateY(-45.15%); -webkit-app-region: no-drag;
}
.login-intro { margin-bottom: 35px; }
.login-intro h1 { font-size: clamp(35px, 2.7vw, 45px); line-height: 1.12; font-weight: 440; letter-spacing: -.035em; }
.login-intro p { margin-top: 12px; color: rgba(244, 242, 236, .5); font-size: clamp(16px, 1.2vw, 20px); }
.login-field { --login-input-background: #121613; display: grid; gap: 9px; margin-bottom: 25px; color: rgba(244, 242, 236, .82); font-size: 16px; }
.login-field:focus-within { --login-input-background: #171c19; }
.login-field:first-of-type { margin-bottom: 32px; }
.login-field > input, .password-input-wrap {
  width: 100%; height: 59px; border: 1px solid rgba(244, 242, 236, .16); border-radius: 12px;
  background: var(--login-input-background); transition: border-color .18s, background .18s, box-shadow .18s;
}
.login-field > input, .password-input-wrap input {
  color: var(--text); font-size: 17px; user-select: text; outline: none; color-scheme: dark;
}
.login-form input:is(:autofill, :-webkit-autofill) {
  -webkit-text-fill-color: var(--text); caret-color: var(--text);
  box-shadow: inset 0 0 0 1000px var(--login-input-background);
}
.login-field > input:is(:autofill, :-webkit-autofill):focus {
  box-shadow: inset 0 0 0 1000px var(--login-input-background), 0 0 0 2px rgba(69, 212, 131, .08), 0 0 22px rgba(69, 212, 131, .08);
}
.login-field > input { padding: 0 19px; }
.login-field > input::placeholder, .password-input-wrap input::placeholder { color: rgba(164, 170, 165, .58); }
.login-field > input:focus {
  border-color: rgba(69, 212, 131, .72); background: var(--login-input-background);
  box-shadow: 0 0 0 2px rgba(69, 212, 131, .08), 0 0 22px rgba(69, 212, 131, .08);
}
.password-input-wrap { display: flex; align-items: center; overflow: hidden; }
.password-input-wrap:focus-within {
  border-color: rgba(69, 212, 131, .72); background: var(--login-input-background);
  box-shadow: 0 0 0 2px rgba(69, 212, 131, .08), 0 0 22px rgba(69, 212, 131, .08);
}
.password-input-wrap input { flex: 1; min-width: 0; align-self: stretch; padding: 0 8px 0 19px; border: 0; background: transparent; }
.password-input-wrap button {
  width: 44px; height: 44px; margin-right: 6px; flex: 0 0 44px; align-self: center; display: grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--faint); cursor: pointer;
  transition: color .16s, background .16s;
}
.password-input-wrap button:hover, .password-input-wrap button:focus-visible { color: var(--text); background: rgba(244, 242, 236, .07); outline: none; }
.password-input-wrap button:active { transform: scale(.94); }
.password-input-wrap button[aria-pressed="true"] { color: var(--emerald); background: rgba(69, 212, 131, .1); }
.password-visible-mark { display: none; }
.password-input-wrap button[aria-pressed="true"] .password-visible-mark { display: block; }
.password-input-wrap svg { width: 20px; height: 20px; pointer-events: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.login-assistance { display: flex; justify-content: flex-start; margin-top: -4px; }
.login-assistance button, .login-register button {
  padding: 0; border: 0; background: transparent; color: var(--emerald); cursor: pointer; font-size: 15px;
}
.login-assistance button:hover, .login-assistance button:focus-visible,
.login-register button:hover, .login-register button:focus-visible { color: #6ae09c; outline: none; text-decoration: underline; text-underline-offset: 4px; }
.login-error { min-height: 18px; margin: 8px 0 4px; color: var(--danger); font-size: 12px; line-height: 1.5; }
.login-error:empty { visibility: hidden; }
.login-submit {
  width: 100%; height: 62px; border: 0; border-radius: 11px; background: var(--emerald); color: var(--text);
  cursor: pointer; font-size: 19px; font-weight: 650; transition: background .18s, color .18s, transform .18s, opacity .18s, box-shadow .18s;
}
.login-submit:hover:not(:disabled), .login-submit:focus-visible:not(:disabled) { background: #61df96; outline: none; box-shadow: 0 0 0 3px rgba(69, 212, 131, .12); }
.login-submit:active:not(:disabled) { transform: translateY(1px); }
.login-submit:disabled { background: rgba(69, 212, 131, .3); color: rgba(244, 242, 236, .5); cursor: not-allowed; box-shadow: none; }
.login-submit[data-busy="true"] { opacity: .62; cursor: wait; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: rgba(244, 242, 236, .42); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: rgba(244, 242, 236, .12); }
.login-register { margin-top: 28px; color: rgba(244, 242, 236, .56); font-size: 16px; }
.login-register button { margin-left: 10px; }
.account-service-entry {
  position: absolute; top: calc(100% + 20px); right: 0; display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 0 4px 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px;
}
.account-service-entry svg { width: 15px; height: 15px; fill: var(--ink); stroke: currentColor; stroke-width: 1.5; }
.account-service-entry:hover, .account-service-entry:focus-visible { color: var(--text); }
.account-service-entry:focus-visible { outline: 2px solid var(--emerald); outline-offset: 5px; border-radius: 3px; }
.account-service-dialog {
  position: fixed; inset: 0; margin: auto; width: min(460px, calc(100vw - 40px)); max-height: calc(100dvh - 48px);
  padding: 28px; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface); color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5); color-scheme: dark; -webkit-app-region: no-drag;
}
.account-service-dialog[open] { animation: account-service-in .16s var(--ease); }
.account-service-dialog::backdrop { background: rgba(3, 5, 4, .72); }
.account-service-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.account-service-heading h2 { font-size: 22px; font-weight: 550; letter-spacing: -.02em; }
.account-service-close { width: 32px; height: 32px; display: grid; place-items: center; flex-shrink: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.account-service-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.account-service-dialog p { color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.account-service-field { display: grid; gap: 9px; margin-top: 26px; font-size: 13px; }
.account-service-field input { min-width: 0; width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--ink); color: var(--text); font-size: 14px; user-select: text; outline: none; }
.account-service-field input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(69, 212, 131, .1); }
.account-service-field input[aria-invalid="true"] { border-color: var(--danger); }
.account-service-dialog #account-service-note { margin-top: 9px; font-size: 12px; color: var(--muted); }
.account-service-dialog #account-service-status { min-height: 21px; margin-top: 12px; font-size: 12px; }
.account-service-dialog #account-service-status[data-error="true"] { color: var(--danger); }
.account-service-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.account-service-actions button { min-height: 38px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; font-size: 13px; }
.account-service-actions #account-service-default { margin-right: auto; padding-inline: 0; border-color: transparent; color: var(--muted); }
.account-service-actions #account-service-save { background: var(--emerald); color: var(--emerald-ink); border-color: transparent; font-weight: 600; }
.account-service-actions button:hover:not(:disabled), .account-service-close:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.account-service-actions #account-service-save:hover:not(:disabled) { background: #61df96; color: var(--emerald-ink); }
.account-service-actions button:focus-visible, .account-service-close:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
.account-service-actions button:disabled, .account-service-close:disabled, .account-service-entry:disabled { opacity: .45; cursor: default; }
.account-service-actions #account-service-save[data-busy="true"] { opacity: .7; cursor: wait; }
@keyframes account-service-in { from { opacity: 0; transform: translateY(5px); } }
@media (max-width: 480px) {
  .account-service-dialog { padding: 22px; }
  .account-service-actions { gap: 6px; }
  .account-service-actions button { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) { .account-service-dialog[open] { animation: none; } }
.login-screen.login-leaving { animation: login-leave .34s var(--ease) forwards; }
@keyframes login-leave { to { opacity: 0; transform: scale(1.012); } }

#app::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 76% 45%, rgba(69, 212, 131, 0.09), transparent 34%),
    linear-gradient(120deg, #050706 0%, #0b100d 60%, #050706 100%);
}
#stage { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; transition: opacity .7s var(--ease), filter .7s var(--ease); }
.idle-stage {
  position: absolute; z-index: 0; display: block; object-fit: fill; pointer-events: none;
  opacity: 0; transition: opacity 200ms ease; background: #070a09;
  will-change: opacity;
}
.idle-stage.visible { opacity: 1; transition-duration: 250ms; }
.companion-prelude {
  position: absolute; z-index: 2; top: 50%; right: clamp(54px, 9vw, 150px);
  width: clamp(310px, 36vw, 520px); aspect-ratio: 1; translate: 0 -48%;
  display: grid; place-items: center; pointer-events: none;
  opacity: 0; visibility: hidden; transform: scale(.94);
  transition: opacity .42s ease, transform .7s var(--ease), visibility 0s linear .7s;
}
.companion-preparing:not(.flowact-mode) #stage { opacity: 0; filter: blur(14px); }
.companion-preparing:not(.flowact-mode) .idle-stage { opacity: 0 !important; }
.companion-preparing:not(.flowact-mode) .companion-prelude {
  opacity: 1; visibility: visible; transform: scale(1);
  transition: opacity .34s ease, transform .7s var(--ease), visibility 0s;
}
.prelude-field {
  position: relative; width: 100%; height: 100%; display: grid; place-items: center;
  filter: drop-shadow(0 0 26px rgba(69, 212, 131, .15));
}
.prelude-field::before {
  content: ""; position: absolute; inset: 19%; border-radius: 50%;
  background: radial-gradient(circle, rgba(69, 212, 131, .1), rgba(69, 212, 131, .025) 43%, transparent 69%);
  animation: prelude-bloom 3s ease-in-out infinite;
}
.prelude-orbit { position: absolute; border-radius: 50%; }
.prelude-orbit::before, .prelude-orbit::after {
  content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: #78efaa; box-shadow: 0 0 15px rgba(120, 239, 170, .8);
}
.orbit-outer {
  inset: 7%; border: 1px solid rgba(69, 212, 131, .1); transform: rotate(-12deg);
  animation: prelude-orbit 11s linear infinite;
}
.orbit-outer::before { top: 21%; right: 4%; }
.orbit-outer::after { bottom: 13%; left: 12%; width: 3px; height: 3px; opacity: .56; }
.orbit-inner {
  inset: 17%; border: 1px dashed rgba(120, 239, 170, .16); transform: rotate(18deg);
  animation: prelude-orbit-reverse 8s linear infinite;
}
.orbit-inner::before { top: 4%; left: 34%; width: 4px; height: 4px; }
.orbit-inner::after { right: 3%; bottom: 28%; width: 2px; height: 2px; opacity: .7; }
.prelude-pulse {
  position: absolute; width: 13%; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgba(120, 239, 170, .45); background: rgba(69, 212, 131, .035);
  box-shadow: 0 0 34px rgba(69, 212, 131, .12), inset 0 0 24px rgba(69, 212, 131, .1);
  animation: prelude-pulse 2.4s var(--ease) infinite;
}
.prelude-portrait { position: absolute; width: 57%; height: 70%; overflow: visible; }
.prelude-trace {
  fill: none; stroke: url(#prelude-line); stroke-width: 1.2; stroke-linecap: round;
  stroke-dasharray: .16 .09; animation: prelude-draw 3.6s var(--ease) infinite;
}
.trace-shoulders { animation-delay: -.9s; }
.trace-center { stroke-width: .55; stroke-dasharray: .02 .06; opacity: .32; animation-duration: 2.8s; }
.prelude-nodes circle {
  fill: #78efaa; opacity: .26; transform-box: fill-box; transform-origin: center;
  animation: prelude-node 2.7s ease-in-out infinite;
}
.prelude-nodes circle:nth-child(3n + 1) { animation-delay: -.7s; }
.prelude-nodes circle:nth-child(3n + 2) { animation-delay: -1.4s; }
.prelude-scan {
  position: absolute; width: 47%; height: 1px; left: 26.5%; top: 25%;
  background: linear-gradient(90deg, transparent, rgba(120, 239, 170, .72), transparent);
  box-shadow: 0 0 16px rgba(69, 212, 131, .35);
  animation: prelude-scan 2.8s ease-in-out infinite;
}
@keyframes prelude-orbit { to { transform: rotate(348deg); } }
@keyframes prelude-orbit-reverse { to { transform: rotate(-342deg); } }
@keyframes prelude-bloom { 50% { opacity: .55; transform: scale(1.13); } }
@keyframes prelude-pulse { 50% { opacity: .36; transform: scale(1.65); } }
@keyframes prelude-draw { 0% { stroke-dashoffset: 1; opacity: .18; } 48%, 72% { stroke-dashoffset: 0; opacity: .8; } 100% { stroke-dashoffset: -1; opacity: .16; } }
@keyframes prelude-node { 50% { opacity: 1; transform: scale(1.55); } }
@keyframes prelude-scan { 0%, 100% { opacity: 0; transform: translateY(0); } 18% { opacity: .9; } 82% { opacity: .38; } 100% { transform: translateY(250px); } }
.flowact-stage {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; display: grid; place-items: center; background: #050706;
}
.flowact-stage.standby {
  background-color: #050706;
  background-image: linear-gradient(90deg, rgba(2, 4, 3, .38), rgba(2, 4, 3, .04)), var(--flowact-standby-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover, contain;
}
.flowact-stage:not(.standby) > div {
  width: min(100%, 480px) !important; height: 100% !important; max-height: 100%; overflow: hidden;
}
.flowact-stage canvas, .flowact-stage video {
  width: 100% !important; height: 100% !important; display: block; object-fit: contain; background: #050706;
}
.flowact-mode .conversation-copy { pointer-events: none; }
.flowact-mode .conversation-copy .user-turn,
.flowact-mode .conversation-copy .bot-name,
.flowact-mode .conversation-copy .reply-progress,
.flowact-mode .conversation-copy .wave { display: none !important; }
.flowact-mode .conversation-copy .subtitle { max-width: 420px; color: rgba(244, 242, 236, .68); font-size: clamp(18px, 2vw, 26px); }
.flowact-connecting .conversation-copy .subtitle { animation: companion-breathe 2.2s ease-in-out infinite; }
@keyframes companion-breathe {
  0%, 100% { opacity: .48; transform: translateY(0); }
  50% { opacity: .82; transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .flowact-connecting .conversation-copy .subtitle { animation: none; }
  .idle-stage { transition: none; }
  .prelude-field::before, .prelude-orbit, .prelude-pulse, .prelude-trace, .prelude-nodes circle, .prelude-scan { animation: none; }
  .prelude-trace { stroke-dashoffset: 0; opacity: .68; }
  .prelude-nodes circle { opacity: .7; }
  .prelude-scan { top: 50%; opacity: .35; }
}

.cloud-role-library { margin-bottom: 20px; }
.cloud-role-library p { font-size: 12px; line-height: 1.6; }
.cloud-role-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.cloud-role-row > div { min-width: 0; overflow-wrap: anywhere; }
.cloud-role-row small { display: block; margin-top: 5px; }
.cloud-role-row button { flex-shrink: 0; }
.cloud-role-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(90deg, rgba(5, 7, 6, 0.74) 0%, rgba(5, 7, 6, 0.2) 46%, rgba(5, 7, 6, 0.08) 100%);
}

.topbar {
  position: absolute; z-index: 6; inset: 0 0 auto 0; height: 72px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  -webkit-app-region: drag;
}
.brand-lockup { display: flex; align-items: center; gap: 11px; letter-spacing: .12em; }
.brand-lockup strong { display: block; font-size: 12px; font-weight: 650; }
.brand-lockup small { display: block; margin-top: 3px; color: var(--faint); font-size: 8px; letter-spacing: .18em; }
.brand-icon { width: 28px; height: 28px; object-fit: contain; filter: drop-shadow(0 0 7px rgba(69, 212, 131, .2)); }
.top-actions, .svc-status { display: flex; align-items: center; gap: 8px; }
.svc-status { padding-right: 7px; margin-right: 2px; border-right: 1px solid var(--line); }
.account-menu { position: relative; -webkit-app-region: no-drag; }
.account-trigger {
  min-width: 92px; height: 32px; display: flex; align-items: center; gap: 7px; padding: 0 9px 0 6px;
  border: 1px solid var(--line); border-radius: 9px; background: rgba(7, 10, 9, .7); color: var(--text); cursor: pointer;
  transition: border-color .16s, background .16s;
}
.account-trigger:hover, .account-trigger:focus-visible, .account-trigger[aria-expanded="true"] { border-color: rgba(69, 212, 131, .42); background: rgba(69, 212, 131, .08); outline: none; }
.account-avatar { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgba(69, 212, 131, .14); color: var(--emerald); }
.account-avatar svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; }
.account-trigger-copy { min-width: 0; text-align: left; line-height: 1; }
.account-trigger-copy strong { display: block; max-width: 86px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 600; }
.account-popover {
  position: absolute; z-index: 9; top: calc(100% + 10px); right: 0; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: 13px; background: #101412; box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
  transform-origin: top right; animation: account-popover-in .16s var(--ease); -webkit-app-region: no-drag;
}
@keyframes account-popover-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.account-popover button { padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--danger); cursor: pointer; white-space: nowrap; font-size: 11px; }
.account-popover button:hover, .account-popover button:focus-visible { background: rgba(240, 125, 116, .12); outline: none; }
.svc-item {
  height: 28px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--faint); font-size: 10px;
  background: rgba(7, 10, 9, .7); transition: color .2s, border-color .2s, background .2s;
}
.svc-item::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.svc-item.loading { color: var(--amber); }
.svc-item.ok { color: var(--emerald); border-color: rgba(69, 212, 131, .24); }
.svc-item.error { color: var(--danger); border-color: rgba(240, 125, 116, .28); }
button.svc-item { font-family: inherit; cursor: pointer; }
button.svc-item:hover, button.svc-item:focus-visible { color: var(--text); border-color: var(--line-strong); outline: none; }
.icon-button, .close-button {
  border: 1px solid var(--line); background: rgba(7, 10, 9, .7); cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, transform .18s;
}
.icon-button { height: 32px; padding: 0 12px; border-radius: 999px; color: var(--muted); font-size: 11px; }
.icon-button:hover, .icon-button:focus-visible { color: var(--text); border-color: var(--line-strong); background: rgba(244, 242, 236, .08); outline: none; }
.record-button[aria-pressed="true"] { color: var(--danger); border-color: rgba(240, 125, 116, .35); }
.icon-button[aria-expanded="true"] { color: var(--emerald); border-color: rgba(69, 212, 131, .35); background: rgba(69, 212, 131, .08); }
.record-button { display: inline-flex; align-items: center; gap: 7px; }
.record-button span { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px rgba(240, 125, 116, .1); }
.record-button b { font: inherit; }
.record-button[aria-pressed="true"] span { border-radius: 2px; animation: recording-pulse 1.15s ease-in-out infinite; }
.record-button[aria-pressed="true"] { background: rgba(240, 125, 116, .1); }
.record-button:disabled { opacity: .5; cursor: wait; }
@keyframes recording-pulse { 50% { opacity: .42; } }
.icon-only { width: 32px; padding: 0; display: grid; place-items: center; }
.icon-only svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.primary-quiet { color: var(--emerald); }
.flowact-settings { display: grid; gap: 14px; margin-bottom: 22px; padding: 16px; border: 1px solid rgba(228, 183, 98, .24); border-radius: 14px; background: rgba(228, 183, 98, .055); }
.flowact-notice strong { display: block; margin-bottom: 6px; color: var(--amber); font-size: 12px; }
.flowact-notice p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.authorization-ready { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid rgba(69, 212, 131, .22); border-radius: 12px; background: rgba(69, 212, 131, .065); }
.authorization-ready > span { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 50%; color: #07120c; background: var(--emerald); font-size: 12px; font-weight: 800; }
.authorization-ready strong, .authorization-ready small { display: block; }
.authorization-ready strong { color: var(--text); font-size: 12px; }
.authorization-ready small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.authorization-actions { display: flex; gap: 16px; }
.avatar-mode-group { margin-bottom: 18px; }
body[data-package-profile="cloud"] .avatar-mode-group label:has(input[value="local"]),
body[data-package-profile="cloud"] #classic-character-picker { display: none !important; }
.fullscreen-exit { display: none; }
.fullscreen-control.is-fullscreen .fullscreen-enter { display: none; }
.fullscreen-control.is-fullscreen .fullscreen-exit { display: block; }
.window-controls { display: flex; align-items: center; gap: 3px; margin-left: 2px; padding-left: 10px; border-left: 1px solid var(--line); }
.window-control {
  width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 9px;
  background: transparent; color: var(--faint); cursor: pointer; transition: color .16s, background .16s;
}
.window-control svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round;
}
.window-control svg, .window-control svg * {
  pointer-events: none;
  -webkit-app-region: no-drag;
}
.window-control:hover, .window-control:focus-visible { color: var(--text); background: rgba(244, 242, 236, .08); outline: none; }
.window-control:active { transform: scale(.92); }
.window-control.close-control:hover, .window-control.close-control:focus-visible { color: #fff; background: rgba(240, 125, 116, .78); }
.window-control:disabled { opacity: .34; cursor: default; background: transparent; }
.conversation-copy {
  position: absolute; z-index: 3; left: clamp(42px, 7vw, 110px); top: clamp(152px, 25vh, 270px); bottom: 150px;
  width: min(44vw, 600px); display: flex; flex-direction: column; justify-content: center;
}
.user-turn {
  width: min(100%, 520px); margin-bottom: 24px; padding-left: 14px;
  border-left: 2px solid rgba(69, 212, 131, .55);
}
.turn-label {
  display: block; margin-bottom: 6px; color: var(--emerald); font-size: 10px;
  font-weight: 700; letter-spacing: .18em;
}
.user-turn p {
  color: rgba(244, 242, 236, .72); font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.55; text-wrap: pretty; display: -webkit-box; overflow: hidden;
  -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
@keyframes turn-update { from { opacity: .35; transform: translateY(4px); } }
.bot-name { font-size: 11px; letter-spacing: .34em; color: rgba(244, 242, 236, .52); font-weight: 650; margin-bottom: 16px; }
.bot-name.cjk { letter-spacing: .14em; }
.subtitle {
  font-size: clamp(30px, 4.2vw, 54px); line-height: 1.18; letter-spacing: -.025em; font-weight: 530;
  text-wrap: balance; text-shadow: 0 4px 30px rgba(0, 0, 0, .5); min-height: 1.18em;
  transition: font-size .28s var(--ease), line-height .28s var(--ease);
}
.subtitle.long-reply {
  max-height: 5.44em; overflow: hidden; font-size: clamp(27px, 2.65vw, 34px); line-height: 1.36;
  letter-spacing: -.018em; text-wrap: pretty;
}
.subtitle.long-reply.reply-complete {
  min-height: 0; max-height: 10.2em; overflow-y: auto; padding-right: 8px;
  font-size: clamp(20px, 2vw, 27px); line-height: 1.52; text-wrap: pretty;
  scrollbar-width: thin; scrollbar-color: rgba(69, 212, 131, .32) transparent;
}
.subtitle.long-reply.reply-complete-dense {
  max-height: 11.8em; font-size: clamp(16px, 1.45vw, 20px); line-height: 1.58;
}
.reply-segment { display: block; color: rgba(244, 242, 236, .42); transition: color .22s ease, opacity .22s ease; }
.reply-segment.previous { color: rgba(244, 242, 236, .28); }
.reply-segment.current { color: var(--text); }
.subtitle.segment-change .reply-segment { animation: subtitle-step .28s var(--ease); }
@keyframes subtitle-step { from { opacity: .22; transform: translateY(6px); } }
.conversation-copy.rich-step-active {
  top: clamp(112px, 15vh, 158px); bottom: 112px; width: min(48vw, 680px); justify-content: flex-start;
}
.conversation-copy.rich-step-active .user-turn { margin-bottom: 18px; }
.conversation-copy.rich-step-active .bot-name { margin-bottom: 10px; }
.conversation-copy.rich-step-active .wave { display: none; }
.rich-step-view {
  display: flex; flex: 1; min-height: 0; width: 100%; max-width: 680px; flex-direction: column;
  animation: rich-step-in .28s var(--ease);
}
.rich-step-heading { flex: 0 0 auto; }
.rich-step-heading span {
  display: block; color: var(--emerald); font-size: 15px; font-weight: 720; letter-spacing: .02em;
}
.rich-step-heading h2 {
  margin-top: 5px; color: var(--text); font-size: clamp(22px, 2.4vw, 32px); line-height: 1.2;
  font-weight: 630; letter-spacing: -.025em; text-wrap: balance;
}
.rich-step-image {
  position: relative; flex: 1 1 0; min-height: 180px; max-height: 340px; width: 100%; margin-top: 14px;
  display: grid; place-items: center; overflow: hidden; padding: 0; border: 1px solid rgba(244, 242, 236, .12);
  border-radius: 8px; color: var(--muted); background: rgba(244, 242, 236, .045); cursor: zoom-in;
}
.rich-step-image img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; background: rgba(244, 242, 236, .025); }
.rich-step-image:disabled { cursor: default; }
.rich-step-image:not(:disabled):hover { border-color: rgba(69, 212, 131, .38); }
.rich-step-image:focus-visible { outline: 2px solid var(--emerald); outline-offset: 4px; }
.rich-step-navigation {
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 18px; flex: 0 0 auto;
  min-height: 62px; padding: 8px 0;
}
.rich-step-arrow {
  width: 48px; height: 48px; border: 1px solid var(--line-strong); border-radius: 50%;
  color: var(--text); background: rgba(7, 10, 9, .58); cursor: pointer; font-size: 21px;
  transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease;
}
.rich-step-arrow:hover, .rich-step-arrow:focus-visible {
  border-color: rgba(69, 212, 131, .46); color: var(--emerald); background: rgba(69, 212, 131, .07); outline: none;
}
.rich-step-arrow:active { transform: scale(.95); }
.rich-step-arrow:disabled { opacity: .26; cursor: default; color: var(--muted); background: transparent; border-color: var(--line); }
.rich-step-position { display: flex; align-items: center; justify-content: center; gap: 14px; color: rgba(244, 242, 236, .76); font-size: 13px; }
.rich-step-dots { display: inline-flex; align-items: center; gap: 8px; }
.rich-step-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(244, 242, 236, .22); }
.rich-step-dots i.active { background: var(--emerald); box-shadow: 0 0 0 3px rgba(69, 212, 131, .08); }
.rich-step-all {
  flex: 0 0 auto; align-self: stretch; display: inline-flex; align-items: center; gap: 10px; min-height: 34px;
  padding: 0; border: 0; border-top: 1px solid var(--line); color: rgba(244, 242, 236, .62); background: transparent;
  cursor: pointer; font-size: 12px;
}
.rich-step-all b { font-size: 18px; font-weight: 400; }
.rich-step-all:hover, .rich-step-all:focus-visible { color: var(--emerald); outline: none; }
@keyframes rich-step-in { from { opacity: .25; transform: translateY(7px); } }
.reply-progress { width: min(270px, 70%); margin-top: 22px; }
.reply-progress-track { display: block; width: 100%; height: 1px; overflow: hidden; background: rgba(244, 242, 236, .13); }
.reply-progress-track i { display: block; width: 0; height: 100%; background: var(--emerald); transition: width .34s var(--ease); }
.full-reply-trigger {
  display: inline-flex; align-items: center; gap: 14px; margin-top: 12px; padding: 0; border: 0; background: transparent;
  color: rgba(244, 242, 236, .42); font-size: 11px; cursor: pointer; transition: color .16s ease;
}
.full-reply-trigger b { color: rgba(244, 242, 236, .3); font: inherit; letter-spacing: .08em; }
.full-reply-trigger:hover, .full-reply-trigger:focus-visible { color: var(--emerald); outline: none; }
.full-reply-trigger:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.status { margin-top: 15px; color: var(--danger); font-size: 12px; min-height: 18px; }
.status:empty { display: none; }
.web-hosting .status { color: var(--muted); }
.connection-retry { margin-top: 12px; }
.connection-retry:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
.web-hosting .wave, .connection-unavailable .wave { display: none; }
.wave { height: 14px; margin-top: 22px; display: flex; gap: 7px; align-items: center; opacity: .24; transition: opacity .25s; }
.wave.on { opacity: 1; }
.wave span { width: 4px; height: 4px; border-radius: 50%; background: var(--emerald); animation: voice-pulse 1.25s ease-in-out infinite; }
.wave span:nth-child(2) { animation-delay: .08s; }.wave span:nth-child(3) { animation-delay: .16s; }
.wave span:nth-child(4) { animation-delay: .24s; }.wave span:nth-child(5) { animation-delay: .32s; }
.wave span:nth-child(6) { animation-delay: .4s; }.wave span:nth-child(7) { animation-delay: .48s; }.wave span:nth-child(8) { animation-delay: .56s; }
@keyframes voice-pulse { 0%, 100% { transform: scale(.7); opacity: .35; } 50% { transform: scale(1.65); opacity: 1; } }

.full-reply-panel {
  position: absolute; z-index: 8; left: clamp(42px, 7vw, 110px); top: 94px; bottom: 128px;
  width: min(560px, calc(50vw - 72px)); min-width: 360px; display: flex; flex-direction: column;
  padding: 28px 30px 30px; border: 1px solid var(--line); border-radius: 20px;
  background: rgba(11, 15, 13, .98); box-shadow: 0 32px 100px rgba(0, 0, 0, .5);
  animation: full-reply-in .3s var(--ease);
}
.full-reply-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.full-reply-panel h2 { margin-top: 7px; font-size: 21px; font-weight: 580; letter-spacing: -.02em; }
.full-reply-text {
  flex: 1; min-height: 0; margin-top: 22px; padding-right: 12px; overflow-y: auto; user-select: text;
  color: rgba(244, 242, 236, .84); font-size: 17px; line-height: 1.9; white-space: pre-wrap; text-wrap: pretty;
  scrollbar-color: #303832 transparent;
}
.full-reply-text:focus-visible { outline: 1px solid rgba(69, 212, 131, .35); outline-offset: 7px; border-radius: 4px; }
.rich-reply-image:focus-visible { outline: 2px solid var(--emerald); outline-offset: 4px; }
.full-reply-text.rich-reply { display: grid; align-content: start; gap: 18px; font-size: 15px; line-height: 1.75; }
.rich-reply p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rich-reply figure { margin: 0; }
.rich-reply-image { display: block; width: 100%; max-width: 440px; padding: 0; border: 0; border-radius: 10px; background: var(--surface); overflow: hidden; cursor: zoom-in; }
.rich-reply-image img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; }
.rich-reply-image:disabled { min-height: 110px; color: var(--muted); font-size: 12px; cursor: default; }
.rich-reply figcaption { margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.knowledge-image-viewer { position: absolute; z-index: 24; inset: 0; display: grid; place-items: center; padding: 72px; background: rgba(5, 8, 7, .97); }
.knowledge-image-viewer .close-button { position: absolute; top: 28px; right: 32px; }
.knowledge-image-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
@keyframes full-reply-in { from { opacity: 0; transform: translateY(10px) scale(.99); } }

.composer {
  position: absolute; z-index: 5; left: 50%; bottom: 48px; transform: translateX(-50%);
  width: min(660px, calc(100vw - 64px)); min-height: 58px; display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(12, 16, 14, .86); backdrop-filter: blur(14px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .24);
  transition: border-color .18s, box-shadow .18s;
}
.composer:focus-within { border-color: rgba(120, 239, 170, .55); box-shadow: 0 6px 24px rgba(0, 0, 0, .24), 0 0 0 2px rgba(69, 212, 131, .1); }
.composer[hidden] { display: none; }
.composer.microphone-only { width: auto; }
.composer.microphone-only #text-input, .composer.microphone-only #send-btn { display: none; }
.composer input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; color: #f4f2ec; outline: none; padding: 0 8px; font-size: 15px; user-select: text; }
.composer input::placeholder { color: #b4bcb6; }
.composer > button { height: 40px; border-radius: 10px; padding: 0 16px; border: 0; cursor: pointer; font-weight: 650; transition: color .16s, background .16s; }
#send-btn {
  width: 40px; padding: 0; flex: 0 0 40px; display: grid; place-items: center;
  color: #082515; background: #45d483;
  transition: color .16s, background .16s, opacity .16s;
}
#send-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#send-btn:not(:disabled):hover { background: #61df96; }
#send-btn:not(:disabled):focus-visible { outline: 2px solid #78efaa; outline-offset: 2px; }
#send-btn:not(:disabled):active { background: #37ba70; }
#send-btn:disabled { color: #89958d; background: transparent; opacity: 1; cursor: default; }
.composer .mic-control { background: transparent; color: #d1d8d2; }
.composer .mic-control:not(:disabled):is(:hover, :focus-visible) { background: rgba(255, 255, 255, .08); }
.composer .mic-control:focus-visible { outline: 2px solid #78efaa; outline-offset: 2px; }
.composer #ptt-btn.active { background: #45d483; color: #082515; }
.composer #ptt-btn.active:is(:hover, :focus-visible) { background: #61df96; }
.composer .mic-control:disabled { color: #89958d; cursor: default; }
.composer > .mic-input-toggle { width: 40px; padding: 0; display: inline-grid; place-items: center; flex: 0 0 40px; border-radius: 10px; }
.mic-input-toggle svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mic-input-toggle .mic-slash { display: none; }
.composer .mic-input-toggle[data-mic-state="muted"], .composer .mic-input-toggle[data-mic-state="off"] { color: #b4bcb6; }
.mic-input-toggle:is([data-mic-state="muted"], [data-mic-state="off"], [data-mic-state="error"]) .mic-slash { display: block; }
.composer .mic-input-toggle[data-mic-state="loading"] { color: var(--amber); }
.composer .mic-input-toggle[data-mic-state="error"] { position: relative; color: #ffb1a8; background: rgba(240, 125, 116, .1); }
.mic-input-toggle[data-mic-state="error"]::after { content: "!"; position: absolute; right: 3px; top: 2px; font-size: 10px; font-weight: 700; }
.composer .mic-input-toggle[data-mic-state="error"]:is(:hover, :focus-visible) { background: rgba(240, 125, 116, .2); }
@media (prefers-reduced-motion: reduce) {
  .composer, .composer > button { transition: none; }
}

.panel-scrim { position: absolute; inset: 0; z-index: 10; background: rgba(0, 0, 0, .35); }
.side-panel {
  position: absolute; z-index: 11; top: 12px; right: 12px; bottom: 12px; width: min(500px, calc(100vw - 24px));
  background: #0d110f; border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  box-shadow: -28px 0 90px rgba(0, 0, 0, .44); transform: translateX(calc(100% + 28px));
  visibility: hidden; transition: transform .42s var(--ease), visibility 0s .42s; display: flex; flex-direction: column;
}
.side-panel.open { transform: translateX(0); visibility: visible; transition-delay: 0s; }
.log-panel { z-index: 13; width: min(720px, calc(100vw - 24px)); }
.log-scrim { z-index: 12; }
.panel-heading { min-height: 112px; padding: 26px 28px 20px; display: flex; align-items: flex-start; justify-content: space-between; }
.panel-heading h2 { margin-top: 8px; font-size: 22px; letter-spacing: -.02em; font-weight: 580; }
.eyebrow { color: var(--emerald); font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.close-button { width: 34px; height: 34px; border-radius: 50%; color: var(--muted); font-size: 21px; line-height: 1; }
.panel-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 24px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-tabs button { border: 0; background: transparent; color: var(--faint); padding: 7px 12px; border-radius: 9px; cursor: pointer; font-size: 12px; }
.panel-tabs button.active { background: var(--surface-2); color: var(--text); }
.panel-content { flex: 1; min-height: 0; overflow-y: auto; padding: 0 28px 34px; scrollbar-color: #303832 transparent; scrollbar-gutter: stable; }
.tab-panel { display: none; padding-top: 26px; }
.tab-panel.active { display: block; animation: panel-content-in .28s var(--ease); }
@keyframes panel-content-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.section-intro { margin-bottom: 24px; }.section-intro h3 { font-size: 19px; font-weight: 580; }
.section-intro p, .field-note, .download-block p, .danger-zone p, .privacy-note p { color: var(--muted); font-size: 12px; line-height: 1.65; margin-top: 7px; }

.field { display: grid; gap: 8px; margin-bottom: 17px; color: var(--muted); font-size: 11px; }
.field input, .field textarea, .memory-form textarea, .memory-form select {
  width: 100%; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 12px; outline: none; resize: vertical; user-select: text; transition: border-color .18s, background .18s;
}
.field input:focus, .field textarea:focus, .memory-form textarea:focus, .memory-form select:focus { border-color: rgba(69, 212, 131, .62); background: var(--surface-2); }
.field small { color: var(--faint); }
.text-button { justify-self: start; color: var(--muted); border: 0; background: transparent; cursor: pointer; font-size: 10px; }.text-button:hover { color: var(--danger); }
.rights-row { display: flex; gap: 9px; align-items: flex-start; margin-top: 10px; color: var(--muted); font-size: 10px; line-height: 1.5; }.rights-row input { margin-top: 2px; accent-color: var(--emerald); }
.field select { width: 100%; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; outline: none; }
.audio-settings { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.voice-clone-settings { margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.018); }
.voice-prepare-row { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px; }
.voice-prepare-row .field-note { margin: 0; }
.voice-profile-editor { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.danger-text { color: #f08d8d; }
.range-field { display: grid; gap: 9px; margin: 16px 0; color: var(--muted); font-size: 11px; }
.range-field span { display: flex; justify-content: space-between; }.range-field output { color: var(--text); }
.range-field input { width: 100%; accent-color: var(--emerald); }
.compact-switch { margin-top: 17px; padding: 13px 0; }
.web-access-settings .compact-switch { margin-top: 0; }
.web-access-settings #web-access-toggle { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; }
.web-access-settings .knowledge-actions { justify-content: flex-start; flex-wrap: wrap; gap: 10px; }
.web-access-settings #web-access-details { margin-top: 20px; }
.web-access-settings #web-access-status { color: var(--amber); overflow-wrap: anywhere; }
.web-connection-help { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 10px; }
.web-connection-help summary { padding: 10px 0; color: var(--muted); font-size: 12px; cursor: pointer; }
.web-connection-help summary:hover { color: var(--text); }
.web-connection-help .knowledge-actions { margin-top: 12px; }
.web-connection-help .field-note { margin-top: 12px; }
.web-certificate-help { margin-top: 10px; }
.web-certificate-help .field { margin-top: 6px; }
.web-access-settings :is(summary, button, select, input):focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
.character-picker { margin-bottom: 19px; }
.fullbody-image-picker { margin: 17px 0; }
.picker-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.character-preview {
  width: 100%; aspect-ratio: 1; border-radius: 14px; border: 1px dashed var(--line-strong); overflow: hidden;
  display: grid; place-items: center; background: var(--surface); color: var(--muted); cursor: pointer;
}
.character-preview:hover { border-color: var(--emerald); }
.character-preview img { width: 100%; height: 100%; object-fit: contain; background: #080a09; }
.character-preview.fullbody-preview {
  width: min(100%, 240px); aspect-ratio: 9 / 16; margin-inline: auto;
  background: #111513;
}
.character-preview.fullbody-preview img {
  display: block; object-fit: contain; object-position: center;
}
.character-preview.dragging { border-color: var(--emerald); background: rgba(69, 212, 131, .08); }
.character-preview.dragging::after {
  content: attr(data-drop-label); position: absolute; inset: 0; display: grid; place-items: center;
  border-radius: inherit; color: var(--text); background: rgba(7, 10, 9, .84); font-size: 13px; font-weight: 600;
  pointer-events: none; animation: drop-target-in .16s ease-out;
}
.character-preview { position: relative; }
@keyframes drop-target-in { from { opacity: 0; } }
.choice-group { border: 0; margin: 8px 0 18px; display: grid; gap: 9px; }
.choice-group legend { color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.choice-group label { display: flex; align-items: flex-start; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); }
.choice-group label:has(input:checked) { border-color: rgba(69, 212, 131, .55); background: rgba(69, 212, 131, .07); }
.choice-group input { accent-color: var(--emerald); margin-top: 3px; }
.choice-group strong, .choice-group small { display: block; }.choice-group strong { font-size: 12px; }.choice-group small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.form-actions, .system-actions, .download-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 22px; }
.settings-footer {
  flex: 0 0 auto; min-height: 76px; padding: 14px 28px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: rgba(13, 17, 15, .97); box-shadow: 0 -18px 38px rgba(0, 0, 0, .16);
}
.settings-footer > span { color: var(--faint); font-size: 10px; line-height: 1.4; }
.settings-footer.dirty > span { color: var(--emerald); }
.settings-footer.busy > span { color: var(--muted); }
.settings-footer-actions { display: flex; justify-content: flex-end; gap: 9px; flex: 0 0 auto; }
.settings-footer .button { min-height: 38px; }
.button { min-height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font-size: 12px; font-weight: 650; }
.button.primary { background: var(--emerald); color: var(--emerald-ink); }
.button.primary:hover { background: #61df96; }
.button.secondary { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.button.danger { color: var(--danger); border-color: rgba(240, 125, 116, .28); background: transparent; }
.button:disabled { opacity: .38; cursor: not-allowed; }.button.wide { width: 100%; height: 48px; margin-top: 24px; }

.memory-form { padding-bottom: 20px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.memory-form select { appearance: auto; }.memory-form .button { justify-self: end; }
.memory-list { display: grid; gap: 9px; margin-top: 18px; }
.memory-item { border: 1px solid var(--line); border-radius: 12px; padding: 13px; background: var(--surface); }
.memory-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.memory-category { color: var(--emerald); font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.memory-actions { display: flex; gap: 4px; }.memory-actions button { border: 0; color: var(--faint); background: transparent; cursor: pointer; font-size: 11px; padding: 3px 5px; }
.memory-actions button:hover { color: var(--text); }.memory-item p { line-height: 1.55; user-select: text; }
.memory-edit { width: 100%; min-height: 72px; background: transparent; color: var(--text); border: 0; outline: none; resize: vertical; user-select: text; }
.memory-note, .memory-source { color: var(--muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.memory-note { margin: 12px 0; }
.memory-source { margin-top: 10px; user-select: text; }
.memory-source summary { cursor: pointer; }
.memory-source div { margin-top: 6px; }
.memory-page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.memory-page-heading .section-intro { margin-bottom: 20px; }
.memory-page-heading .section-intro p { max-width: 330px; }
.memory-refresh {
  flex: 0 0 auto; min-height: 32px; margin-top: -5px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px;
  color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; font-weight: 600;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.memory-refresh:not(:disabled):hover, .memory-refresh:not(:disabled):focus-visible {
  color: var(--text); background: rgba(244, 242, 236, .065); border-color: var(--line); outline: none;
}
.memory-refresh:disabled { color: var(--faint); cursor: wait; }
.memory-add { margin-top: 18px; border: 1px solid var(--line); border-radius: 13px; background: rgba(244, 242, 236, .018); overflow: hidden; }
.memory-add > summary {
  display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; column-gap: 10px; min-height: 58px; padding: 11px 14px;
  color: var(--text); cursor: pointer; list-style: none;
}
.memory-add > summary::-webkit-details-marker { display: none; }
.memory-add > summary > span { grid-row: 1 / span 2; color: var(--emerald); font-size: 20px; font-weight: 300; }
.memory-add > summary strong { font-size: 12px; font-weight: 620; }
.memory-add > summary small { color: var(--faint); font-size: 10px; line-height: 1.45; }
.memory-add > summary:hover, .memory-add > summary:focus-visible { background: rgba(69, 212, 131, .055); outline: none; }
.memory-add[open] > summary { border-bottom: 1px solid var(--line); background: rgba(69, 212, 131, .045); }
.memory-add > summary > span { transition: transform .18s var(--ease); }
.memory-add[open] > summary > span { transform: rotate(45deg); }
.memory-add .memory-form { padding: 16px 14px 14px; border-bottom: 0; animation: memory-form-in .2s var(--ease); }
@keyframes memory-form-in { from { opacity: .25; transform: translateY(-5px); } }
.memory-list-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-top: 25px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.memory-list-heading h4 { color: var(--text); font-size: 12px; font-weight: 620; }
.memory-list-heading h4 span { margin-left: 5px; color: var(--emerald); }
.memory-list-heading > span { color: var(--faint); font-size: 10px; }
.memory-list-heading + .memory-list { margin-top: 10px; }
.memory-empty { display: grid; justify-items: center; gap: 7px; padding: 34px 18px 27px; color: var(--muted); text-align: center; }
.memory-empty-mark { width: 34px; height: 34px; display: grid; place-items: center; margin-bottom: 2px; border: 1px solid rgba(69, 212, 131, .18); border-radius: 50%; color: var(--emerald); background: rgba(69, 212, 131, .055); font-size: 16px; }
.memory-empty strong { color: rgba(244, 242, 236, .8); font-size: 12px; font-weight: 600; }
.memory-empty p { max-width: 270px; color: var(--faint); font-size: 10px; line-height: 1.6; }
.memory-empty.is-loading { display: block; padding: 28px 10px; color: var(--faint); font-size: 11px; }
.agent-task-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-task-detail { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.agent-task-detail li { margin: 14px 0 14px 20px; line-height: 1.6; }
.agent-task-detail textarea { width: 100%; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); resize: vertical; user-select: text; }
.agent-task-detail textarea:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
.memory-meta { flex-wrap: wrap; gap: 8px; }
.memory-actions { flex-wrap: wrap; }
.memory-actions button:focus-visible, .memory-source summary:focus-visible, .memory-edit:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
.knowledge-settings { display: grid; gap: 16px; }
.knowledge-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.update-summary { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.update-summary #update-status { margin-top: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.update-summary #update-notes { white-space: pre-line; overflow-wrap: anywhere; }
.update-summary .knowledge-actions { justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.update-preference { margin-top: 24px; border-top: 1px solid var(--line); }
.knowledge-evidence { flex: 0 0 auto; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.knowledge-evidence strong { color: rgba(244, 242, 236, .72); }
.empty-state { color: var(--faint); padding: 34px 10px; text-align: center; font-size: 12px; }

.download-block, .privacy-note, .danger-zone { margin-top: 26px; padding: 17px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); }
.privacy-note p + p { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.privacy-note b { color: rgba(244, 242, 236, .82); font-weight: 580; }
.download-block h4, .danger-zone h4 { font-size: 12px; }.download-log { margin-top: 13px; max-height: 150px; overflow: auto; white-space: pre-wrap; color: var(--muted); font: 10px/1.5 Consolas, monospace; user-select: text; }
.log-heading { min-height: 104px; padding-bottom: 15px; }
.log-heading p { margin-top: 8px; color: var(--faint); font-size: 10px; }
.log-meta-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.log-meta-row p { margin: 0; }
.log-live-metric {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  color: var(--faint); font-size: 9px; letter-spacing: .04em;
}
.log-live-metric::before {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: "";
}
.log-live-metric.ok { color: rgba(69, 212, 131, .72); }
.log-live-metric.loading { color: rgba(226, 183, 82, .72); }
.log-live-metric.error { color: rgba(239, 104, 104, .78); }
.log-toolbar { display: flex; gap: 8px; padding: 0 28px 16px; border-bottom: 1px solid var(--line); }
.log-toolbar .button:last-child { margin-left: auto; }
.log-output {
  flex: 1; min-height: 0; overflow: auto; margin: 18px 20px 12px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 13px; background: #080b09; color: #bdc7c0;
  white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; outline: none;
  font: 11px/1.65 "Cascadia Mono", Consolas, monospace; scrollbar-color: #303832 transparent;
}
.log-output:focus-visible { border-color: rgba(69, 212, 131, .48); }
.log-output.empty { display: grid; place-items: center; color: var(--faint); text-align: center; }
.log-privacy { padding: 0 28px 20px; color: var(--faint); font-size: 10px; line-height: 1.5; }
.switch-row { display: flex; gap: 20px; justify-content: space-between; margin-top: 22px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.switch-row strong, .switch-row small { display: block; }.switch-row small { max-width: 320px; color: var(--muted); font-size: 10px; margin-top: 5px; line-height: 1.5; }.switch-row input { accent-color: var(--emerald); }
.policy-links { display: flex; gap: 16px; padding: 19px 0; }.policy-links button { color: var(--muted); font-size: 11px; border: 0; background: transparent; cursor: pointer; }.policy-links button:hover { color: var(--emerald); }
.danger-zone { border-color: rgba(240, 125, 116, .2); }.danger-zone .button { margin-top: 15px; }

.control-panel.document-open .panel-tabs { display: none; }
.control-panel.document-open .tab-panel { display: none; }
.control-panel.document-open .settings-footer { display: none; }
.document-view { min-height: 100%; padding-top: 10px; animation: document-in .26s var(--ease); }
.document-view[hidden] { display: none; }
.document-toolbar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; margin: 0 -4px 24px; padding: 7px 4px 11px; background: linear-gradient(#0d110f 78%, rgba(13, 17, 15, 0));
}
.document-back {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px 0 6px;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px;
  transition: color .18s, background .18s;
}
.document-back svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.document-back:hover, .document-back:focus-visible { color: var(--text); background: var(--surface-2); outline: none; }
.document-date { color: var(--faint); font-size: 9px; letter-spacing: .08em; }
.document-body { padding: 0 4px 40px; color: var(--muted); user-select: text; }
.document-body h1 { color: var(--text); font-size: 25px; line-height: 1.25; letter-spacing: -.025em; font-weight: 580; margin: 0 0 10px; }
.document-body h2 { color: var(--text); font-size: 15px; line-height: 1.4; font-weight: 600; margin: 30px 0 10px; padding-top: 2px; }
.document-body p { font-size: 12px; line-height: 1.85; margin: 10px 0; }
.document-body ul, .document-body ol { display: grid; gap: 8px; margin: 12px 0 18px; padding-left: 19px; }
.document-body li { padding-left: 3px; font-size: 12px; line-height: 1.7; }
.document-body li::marker { color: var(--emerald); }
.document-table-wrap { overflow-x: auto; margin: 16px 0 24px; border: 1px solid var(--line); border-radius: 11px; }
.document-body table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 10px; line-height: 1.55; }
.document-body th, .document-body td { padding: 10px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.document-body th { color: var(--text); background: var(--surface); font-weight: 600; }
.document-body tr:last-child td { border-bottom: 0; }
.document-body strong { color: var(--text); font-weight: 600; }
.document-empty { display: grid; place-items: center; min-height: 220px; color: var(--faint); font-size: 12px; text-align: center; }
@keyframes document-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

.compact { margin-top: 22px; }
.toast { position: absolute; z-index: 30; left: 50%; bottom: 124px; transform: translateX(-50%); color: var(--text); background: #171c19; border: 1px solid var(--line-strong); padding: 11px 16px; border-radius: 999px; box-shadow: 0 12px 42px rgba(0,0,0,.4); font-size: 12px; }
.toast.show { animation: toast-in .24s var(--ease); } @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 7px); } }
.account-logout-dialog { position: absolute; z-index: 31; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(3, 5, 4, .62); -webkit-app-region: no-drag; }
.account-logout-card { width: min(360px, 100%); padding: 24px; border: 1px solid var(--line-strong); border-radius: 18px; background: #101412; box-shadow: 0 24px 72px rgba(0, 0, 0, .52); animation: account-logout-in .18s var(--ease); }
@keyframes account-logout-in { from { opacity: 0; transform: translateY(7px) scale(.985); } }
.account-logout-card h2 { margin-top: 9px; font-size: 20px; letter-spacing: -.02em; }
.account-logout-card p { margin-top: 11px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.account-logout-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.account-logout-actions button { min-width: 72px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.account-logout-actions button:hover, .account-logout-actions button:focus-visible { border-color: var(--line-strong); color: var(--text); background: rgba(244, 242, 236, .07); outline: none; }
.account-logout-actions #account-logout-confirm { border-color: rgba(240, 125, 116, .45); color: #ffaaa4; }
.account-logout-actions #account-logout-confirm:hover, .account-logout-actions #account-logout-confirm:focus-visible { border-color: rgba(240, 125, 116, .72); background: rgba(240, 125, 116, .12); color: #fff; }
@media (prefers-reduced-motion: reduce) { .account-logout-card { animation: none; } }

@media (max-width: 980px) {
  .login-topbar { height: 88px; padding-inline: 24px; }
  .window-controls.login-window-controls { top: 24px; right: 24px; }
  .login-brand .brand-icon { width: 34px; height: 34px; }
  .login-screen .login-brand strong { font-size: 20px; }
  .login-screen .login-brand small { font-size: 10px; }
  .login-form { left: clamp(44px, 8vw, 78px); width: min(390px, calc(100vw - 88px)); transform: translateY(-43%); }
  .conversation-copy { left: 42px; width: min(42vw, 440px); top: 120px; bottom: 118px; }
  .conversation-copy.rich-step-active { top: 96px; bottom: 96px; width: min(48vw, 500px); }
  .rich-step-heading h2 { font-size: clamp(20px, 3vw, 27px); }
  .rich-step-image { max-height: 300px; }
  .user-turn { width: 100%; margin-bottom: 18px; }
  .subtitle { font-size: clamp(28px, 6vw, 45px); }
  .subtitle.long-reply { font-size: clamp(25px, 3.5vw, 31px); }
  .full-reply-panel { left: 42px; top: 82px; bottom: 108px; width: min(500px, calc(100vw - 84px)); min-width: 0; }
  .topbar { padding: 0 18px; }.brand-lockup small, .svc-status { display: none; }
  .flowact-mode .svc-status { display: flex; padding-right: 0; margin-right: 0; border-right: 0; }
  .flowact-mode #svc-server { display: none; }
  .account-trigger { min-width: 32px; width: 32px; padding: 0; justify-content: center; }
  .account-trigger-copy { display: none; }
  .icon-button { padding: 0 9px; }.record-button b { display: none; }.window-controls { padding-left: 7px; }
  .composer { bottom: 24px; }.side-panel { top: 6px; right: 6px; bottom: 6px; width: calc(100vw - 12px); }
  .companion-prelude { right: 2vw; width: min(42vw, 420px); }
}

@media (max-height: 650px) {
  .login-form { transform: translateY(-40%); }
  .login-intro { margin-bottom: 20px; }
  .login-field { margin-bottom: 15px; }
  .login-field > input, .password-input-wrap { height: 50px; }
  .login-submit { height: 52px; }
  .login-register { margin-top: 18px; }
  .conversation-copy { top: 88px; bottom: 104px; }
  .conversation-copy.rich-step-active { top: 82px; bottom: 86px; }
  .conversation-copy.rich-step-active .user-turn { margin-bottom: 10px; }
  .rich-step-heading h2 { margin-top: 3px; font-size: clamp(19px, 2.2vw, 25px); }
  .rich-step-image { min-height: 130px; max-height: 230px; margin-top: 9px; }
  .rich-step-navigation { min-height: 50px; }
  .rich-step-arrow { width: 40px; height: 40px; }
  .user-turn { margin-bottom: 14px; }
  .bot-name { margin-bottom: 10px; }
  .subtitle.long-reply { font-size: clamp(23px, 2.45vw, 29px); }
  .reply-progress { margin-top: 14px; }
  .wave { margin-top: 12px; }
  .full-reply-panel { top: 76px; bottom: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Role settings: current companion first, catalog on demand. */
.current-role { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 20px; align-items: center; padding-bottom: 22px; }
.current-role-portrait { height: 118px; overflow: hidden; border-radius: 12px; background: #171e1a; display: grid; place-items: center; }
.current-role-portrait img { width: 100%; height: 100%; object-fit: contain; }
.current-role-portrait > span { color: var(--emerald); font-size: 40px; }
.role-caption { color: var(--emerald); font-size: 11px; }
.current-role-copy { min-width: 0; }
.current-role-copy h3 { margin: 8px 0; font-size: 25px; line-height: 1.25; overflow-wrap: anywhere; }
.current-role-copy p { color: var(--muted); font-size: 12px; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; }
.role-library-disclosure { position: relative; border-block: 1px solid var(--line); margin-bottom: 24px; }
.role-library-disclosure > summary, .role-image-editor > summary { padding: 16px 0; color: var(--muted); font-size: 12px; cursor: pointer; }
#role-library-count { margin-left: 8px; color: var(--emerald); }
.role-library-disclosure > summary { padding-right: 72px; }
.role-library-heading { position: absolute; top: 5px; right: 0; display: flex; align-items: center; margin: 0; }
.role-library-heading h4 { font-size: 13px; font-weight: 600; }
.role-library-heading button { font-size: 12px; padding: 8px; }
#cloud-role-status { color: var(--muted); margin-bottom: 12px; }
#cloud-role-status:empty { display: none; }
#cloud-role-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cloud-role-row { display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #111713; gap: 14px; transition: border-color .16s ease; }
.cloud-role-row.is-current { border-color: #347b50; background: #132219; }
.cloud-role-row strong { font-size: 14px; line-height: 1.5; }
.cloud-role-row small { color: var(--muted); font-size: 11px; line-height: 1.6; }
.cloud-role-actions { justify-content: flex-start; }
.cloud-role-actions .button { min-height: 34px; padding: 7px 12px; font-size: 11px; }
.builtin-role-action { grid-column: 1 / -1; justify-self: start; }
.persona-section-title { margin: 24px 0 16px; font-size: 15px; font-weight: 600; }
.role-image-editor .character-preview { max-height: 240px; aspect-ratio: auto; min-height: 160px; }
.role-image-editor .character-preview img { max-height: 240px; }
[data-panel="persona"] .field > .button { justify-self: start; border: 0; padding: 2px 0; background: transparent; color: var(--muted); font-size: 11px; min-height: 24px; }
[data-panel="persona"] .field > .button:not(:disabled):hover { color: var(--emerald); }
[data-panel="system"] .audio-settings { border: 0; padding-top: 0; margin-top: 0; }
.role-library-disclosure summary:focus-visible, .role-image-editor summary:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; border-radius: 5px; }
@media (max-width: 420px) {
  .current-role { grid-template-columns: 76px minmax(0, 1fr); gap: 16px; }
  .current-role-portrait { height: 104px; }
  #cloud-role-list { grid-template-columns: 1fr; }
  .memory-list-heading > span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .cloud-role-row { transition: none; } }

/* Compact role choices; scene previews expand across the full row. */
#cloud-role-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.cloud-role-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 10px 12px; align-items: center; align-content: start; padding: 14px; background: #111713; }
.cloud-role-row.is-current { border-color: #347b50; background: #142019; }
.role-list-photo { width: 54px; height: 72px; border-radius: 8px; object-fit: cover; object-position: center 20%; background: #202c24; }
.role-photo-placeholder { display: grid; place-items: center; color: #a9cbb4; font-size: 23px; }
.role-list-copy { min-width: 0; }
.role-list-copy strong { overflow-wrap: anywhere; }
.role-list-copy small { display: block; margin-top: 5px; }
.cloud-role-actions { grid-column: 3; justify-content: flex-end; }
.cloud-role-actions .button { min-height: 38px; padding-inline: 10px; white-space: nowrap; }
.cloud-role-actions .button:disabled { opacity: 1; color: var(--muted); background: #141a16; }
.cloud-role-row.is-current .cloud-role-actions .button:disabled { color: var(--emerald); border-color: transparent; background: transparent; }
.cloud-role-actions .button:not(:disabled):is(:hover, :focus-visible) { background: #24372b; border-color: #538764; }
.cloud-role-actions .button:not(:disabled):active { background: #1b2b21; }
.cloud-role-actions .button:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
.role-runtime-note { grid-column: 1 / -1; color: var(--amber); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .cloud-role-row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; padding: 12px; }
  .role-list-photo { width: 44px; height: 60px; }
  .cloud-role-actions { grid-column: 3; }
  .cloud-role-actions .button { padding-inline: 8px; }
}

/* Portrait keeps the figure above a separate, scrollable conversation area. */
#screen-layout-btn { color: var(--muted); }
#screen-layout-btn:is(:hover, :focus-visible) { color: var(--emerald); }
#screen-layout-btn:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
.toolbar-icon, .recording-stop-entry { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; flex-shrink: 0; }
.toolbar-icon svg, .recording-stop-entry svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.toolbar-icon svg { width: 18px; height: 18px; stroke-width: 1.5; flex-shrink: 0; }
#screen-layout-btn svg { transform: rotate(90deg); transform-origin: center; }
#screen-layout-btn[aria-pressed="true"] svg { transform: none; }
#panel-btn { color: var(--muted); }
#panel-btn svg { width: 18px; height: 18px; stroke-width: 1.5; }
#panel-btn:is(:hover, :focus-visible, [aria-expanded="true"]) { color: var(--emerald); }
#panel-btn:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
.recording-stop-entry { color: var(--danger); border-color: rgba(240, 125, 116, .4); }
.recording-stop-entry svg { fill: currentColor; stroke: none; }
.recording-stop-entry:focus-visible { outline: 2px solid var(--danger); outline-offset: 3px; }
.recording-stop-entry:disabled { opacity: .6; cursor: wait; }
.tool-section { padding: 20px 0; border-top: 1px solid var(--line); }
.tool-section h4 { font-size: 15px; font-weight: 600; }
.tool-section > p { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.tool-section > button { margin-top: 16px; }
.tool-section .record-button b { display: inline; }
body[data-screen-layout="portrait"] .conversation-copy,
body[data-screen-layout="portrait"] .conversation-copy.rich-step-active {
  left: max(24px, calc((100vw - 660px) / 2)); right: auto; width: min(660px, calc(100vw - 48px));
  top: 59%; bottom: 102px; justify-content: flex-start; overflow-y: auto;
  padding: 14px 8px 8px 0; scrollbar-width: thin;
}
body[data-screen-layout="portrait"] .conversation-copy > * { flex-shrink: 0; }
body[data-screen-layout="portrait"] .user-turn { margin-bottom: 12px; }
body[data-screen-layout="portrait"] .bot-name { margin-bottom: 10px; }
body[data-screen-layout="portrait"] .subtitle { font-size: clamp(26px, 4vw, 38px); overflow-wrap: anywhere; }
body[data-screen-layout="portrait"] .subtitle.long-reply { font-size: clamp(20px, 3vw, 28px); }
body[data-screen-layout="portrait"] .subtitle.reply-complete { font-size: clamp(18px, 2.6vw, 24px); }
body[data-screen-layout="portrait"] .wave,
body[data-screen-layout="portrait"] .reply-progress { margin-top: 12px; }
body[data-screen-layout="portrait"] .composer { bottom: 24px; width: min(660px, calc(100vw - 32px)); }
body[data-screen-layout="portrait"] .composer.microphone-only { width: auto; }
body[data-screen-layout="landscape"][data-avatar-framing="fullbody"][data-avatar-scene="wide"] .flowact-stage { inset: 0; }
body[data-screen-layout="landscape"][data-avatar-scene="wide"] .flowact-stage:not(.standby) > div { max-width: none; max-height: none; }
body[data-screen-layout="landscape"][data-avatar-scene="wide"] .vignette {
  background: linear-gradient(90deg, rgba(7, 10, 9, .84), rgba(7, 10, 9, .72) 40%, rgba(7, 10, 9, .2) 56%, transparent 70%);
}
body[data-screen-layout="portrait"] .vignette {
  background: linear-gradient(180deg, rgba(5, 7, 6, .1) 0%, transparent 52%, #070a09 59%);
}
body[data-screen-layout="portrait"] .flowact-stage {
  inset: var(--portrait-stage-top) 16px calc(41% + 12px);
}
body[data-screen-layout="portrait"] .companion-prelude {
  top: var(--portrait-stage-top); bottom: calc(41% + 12px); right: 16px; left: 16px;
  width: auto; aspect-ratio: auto; translate: none;
}
body[data-screen-layout="portrait"] .prelude-field { width: min(100%, 38vh); height: auto; aspect-ratio: 1; }
body[data-screen-layout="portrait"] .full-reply-panel {
  left: max(16px, calc((100vw - 660px) / 2)); width: min(660px, calc(100vw - 32px));
  min-width: 0; top: calc(var(--portrait-stage-top) + 8px); bottom: 96px; padding: 22px;
}
body[data-screen-layout="portrait"] .rich-step-view { flex: 0 0 auto; }
body[data-screen-layout="portrait"] .rich-step-image { flex: none; height: 22vh; min-height: 130px; }
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .conversation-copy,
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .conversation-copy.rich-step-active {
  top: auto; bottom: 116px; max-height: min(32vh, 320px); padding: 16px;
  background: linear-gradient(180deg, rgba(7, 10, 9, .08), rgba(7, 10, 9, .28) 45%, rgba(7, 10, 9, .4)); border-radius: 12px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .65);
}
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .conversation-copy:has(.subtitle:empty):not(.rich-step-active) { background: transparent; }
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .conversation-copy .bot-name { color: #bfc7c1; }
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .vignette {
  background: linear-gradient(180deg, rgba(5, 7, 6, .18), transparent 18%, transparent 65%, rgba(5, 7, 6, .22));
}
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .flowact-stage { inset: 0; }
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .flowact-stage:not(.standby) > div { max-height: none; }
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .flowact-stage.standby { background-size: cover; }
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .topbar {
  background: linear-gradient(180deg, rgba(5, 7, 6, .92), rgba(5, 7, 6, .86) 80%, transparent);
}
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .companion-prelude { bottom: 108px; }
@media (max-width: 640px) {
  body { --portrait-stage-top: 80px; }
  .topbar { height: 116px; padding: 18px 16px 0; align-items: flex-start; }
  .top-actions { position: absolute; left: 16px; right: 16px; bottom: 12px; gap: 6px; }
  .top-actions .window-controls { position: absolute; right: 0; bottom: 51px; }
  .top-actions #update-ready-entry { position: absolute; left: 96px; bottom: 51px; max-width: calc(100% - 200px); font-size: 10px; }
  .top-actions .svc-status { display: none; }
  .top-actions .account-menu { margin-left: auto; }
  .login-form { left: 24px; width: calc(100vw - 48px); }
  .login-screen .login-brand small { display: none; }
  .composer > button { padding-inline: 10px; }
  .composer input { padding-inline: 4px; font-size: 14px; }
  body[data-screen-layout="landscape"] .conversation-copy { left: 20px; top: 128px; }
  body[data-screen-layout="landscape"] .full-reply-panel { left: 16px; width: calc(100vw - 32px); top: 124px; }
}

body[data-screen-layout="portrait"] .topbar {
  height: 72px; padding: 0 16px; align-items: center; gap: 16px;
}
body[data-screen-layout="portrait"] .topbar > .brand-lockup { flex-shrink: 0; gap: 8px; }
body[data-screen-layout="portrait"] .topbar .brand-lockup small { display: none; }
body[data-screen-layout="portrait"] .top-actions {
  position: static; margin-left: auto; gap: 6px; min-width: 0;
}
body[data-screen-layout="portrait"] .recording-stop-entry { order: 0; }
body[data-screen-layout="portrait"] #screen-layout-btn { order: 1; }
body[data-screen-layout="portrait"] #hide-ui-btn { order: 1; }
body[data-screen-layout="portrait"] #panel-btn { order: 2; }
body[data-screen-layout="portrait"] .account-menu { order: 3; margin-left: 0; }
body[data-screen-layout="portrait"] .account-trigger { width: auto; min-width: 0; padding: 0 8px 0 5px; }
body[data-screen-layout="portrait"] .account-trigger-copy { display: block; }
body[data-screen-layout="portrait"] .account-trigger-copy strong { max-width: 76px; }
body[data-screen-layout="portrait"] #update-ready-entry { position: static; max-width: none; width: 28px; padding: 0; font-size: 0; }
body[data-screen-layout="portrait"] #update-ready-entry::before { content: "↑"; font-size: 16px; }
body[data-screen-layout="portrait"] .top-actions > .window-controls { position: static; order: 4; padding-left: 6px; }
@media (max-width: 640px) {
  body[data-screen-layout="portrait"] .topbar { padding-inline: 12px; gap: 8px; }
  body[data-screen-layout="portrait"] .window-control { width: 28px; }
  body[data-screen-layout="portrait"] .top-actions { gap: 4px; }
}
@media (max-width: 420px) {
  body[data-screen-layout="portrait"] .account-trigger-copy strong { max-width: 44px; }
  body[data-screen-layout="portrait"][data-recording-state="recording"] .topbar > .brand-lockup,
  body[data-screen-layout="portrait"][data-recording-state="starting"] .topbar > .brand-lockup,
  body[data-screen-layout="portrait"][data-recording-state="stopping"] .topbar > .brand-lockup { display: none; }
}

/* Partner settings use the available width without scaling the media or type. */
#control-panel .panel-heading { min-height: 84px; align-items: center; padding: 20px 24px 16px; }
#control-panel .panel-heading h2 { margin: 0; font-size: 23px; font-weight: 650; }
#control-panel .close-button:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
#control-panel .panel-tabs { flex-wrap: nowrap; flex-shrink: 0; overflow-x: auto; margin-inline: 22px; scrollbar-width: thin; }
#control-panel .panel-tabs button { flex-shrink: 0; color: var(--muted); min-height: 36px; padding-inline: 11px; }
#control-panel .panel-tabs button.active { color: var(--text); background: #203128; }
#control-panel .panel-tabs button:focus-visible { outline: 2px solid var(--emerald); outline-offset: -2px; }
#control-panel .panel-content { padding: 0 24px 28px; }
#control-panel .tab-panel { padding-top: 22px; }
.role-library-heading .text-button { min-height: 38px; padding-inline: 10px; color: var(--muted); }
.role-library-heading .text-button:is(:hover, :focus-visible) { color: var(--emerald); }
.role-library-heading .text-button:focus-visible { outline: 2px solid var(--emerald); outline-offset: -2px; border-radius: 6px; }
.role-scene-picker { grid-column: 1 / -1; min-width: 0; border-top: 1px solid var(--line); }
.role-scene-picker > summary { display: flex; align-items: center; gap: 10px; min-height: 42px; padding-top: 8px; list-style: none; cursor: pointer; }
.role-scene-picker > summary::-webkit-details-marker { display: none; }
.scene-picker-label { color: var(--muted); font-size: 11px; flex: 0 0 auto; }
.scene-picker-value { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-picker-action { color: var(--emerald); font-size: 11px; flex: 0 0 auto; }
.role-scene-picker > summary::after { content: ""; width: 6px; height: 6px; margin: -3px 3px 0 2px; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); transform: rotate(45deg); transition: transform .16s ease; }
.role-scene-picker[open] > summary::after { transform: rotate(225deg); margin-top: 3px; }
.role-scene-picker > summary:is(:hover, :focus-visible) .scene-picker-value { color: var(--emerald); }
.role-scene-picker > summary:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; border-radius: 4px; }
.role-scene-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.role-scene-choice { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 5px; min-width: 0; padding: 8px 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #101713; color: var(--text); cursor: pointer; text-align: left; transition: border-color .16s ease, background .16s ease; }
.role-scene-choice.is-selected { border-color: var(--emerald); background: #1a2a20; }
.role-scene-choice:not(:disabled):is(:hover, :focus-visible) { border-color: #70bd8d; background: #24372b; }
.role-scene-choice:not(:disabled):active { background: #1b2b21; }
.role-scene-choice:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; }
.role-scene-choice.is-selected::after { content: "✓"; position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: var(--emerald-ink); background: var(--emerald); font-size: 12px; font-weight: 700; }
.role-scene-choice:disabled { cursor: default; color: var(--muted); }
.role-scene-preview { display: grid; place-items: center; height: clamp(132px, 20vh, 190px); overflow: hidden; border-radius: 6px; background: #090e0b; margin-bottom: 5px; }
.role-scene-cover { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.scene-preview-placeholder { color: var(--muted); font-size: 11px; }
.role-scene-name { font-size: 12px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.role-scene-choice .role-scene-state { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0; }
.role-scene-choice.is-default-choice { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px 14px; width: 100%; min-height: 54px; margin-top: 12px; padding: 12px 40px 12px 14px; }
.is-default-choice .role-scene-state { margin-left: auto; }
.role-scene-choice.is-default-choice.is-selected::after { top: calc(50% - 10px); right: 12px; }
@media (min-width: 900px) {
  .cloud-role-row.scenes-open { grid-column: 1 / -1; }
  .role-scene-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 420px) {
  #control-panel .panel-heading { padding-inline: 18px; }
  #control-panel .panel-tabs { margin-inline: 16px; }
  #control-panel .panel-content { padding-inline: 16px; }
  .role-scene-list { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); }
  .is-default-choice .role-scene-state { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .side-panel, #control-panel .tab-panel, .role-scene-choice, .role-scene-picker > summary::after { animation: none; transition: none; }
}

.presentation-entry { position: relative; }
.presentation-entry::after {
  content: attr(aria-label); position: absolute; top: calc(100% + 10px); right: 0;
  width: max-content; padding: 6px 9px; border-radius: 6px; background: #171c19; color: #fff;
  font-size: 12px; font-weight: 500; opacity: 0; visibility: hidden; pointer-events: none;
}
.presentation-entry:hover::after, .presentation-entry:focus-visible::after { opacity: 1; visibility: visible; }
body.presentation-only #app > [data-presentation-ui] { visibility: hidden; opacity: 0; pointer-events: none; }
#app > :is(.topbar, .conversation-copy, .composer, .vignette) {
  transition: opacity .24s ease, translate .24s var(--ease), visibility 0s,
    border-color .18s, box-shadow .18s;
}
body.presentation-only #app > :is(.topbar, .conversation-copy, .composer, .vignette) {
  transition: opacity .24s ease, translate .24s var(--ease), visibility 0s .24s,
    border-color .18s, box-shadow .18s;
}
body.presentation-only #app > .topbar { translate: 0 -8px; }
body.presentation-only #app > .conversation-copy { translate: 0 6px; }
body.presentation-only #app > .composer { translate: 0 10px; }
.presentation-restore {
  position: absolute; z-index: 32; top: 16px; right: 16px; display: inline-flex; align-items: center;
  gap: 7px; min-height: 40px; padding: 0 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,.22);
  color: #fff; background: rgba(7,10,9,.72); cursor: pointer; font-size: 12px; -webkit-app-region: no-drag;
  opacity: 1; visibility: visible; translate: 0 0;
  transition: opacity .16s ease, translate .16s var(--ease), visibility 0s;
}
.presentation-restore[hidden] {
  display: inline-flex !important; opacity: 0; visibility: hidden; translate: 0 -4px; pointer-events: none;
  transition: opacity .16s ease, translate .16s var(--ease), visibility 0s .16s;
}
.presentation-restore:hover { background: rgba(7,10,9,.86); }
.presentation-restore svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.presentation-restore:focus-visible, .presentation-entry:focus-visible { outline: 2px solid #78efaa; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  #app > :is(.topbar, .conversation-copy, .composer, .vignette), .presentation-restore {
    transition: none !important; translate: none !important;
  }
}

body[data-avatar-framing="fullbody"] .composer {
  width: min(600px, calc(100vw - 48px)); min-height: 54px; padding: 6px; gap: 6px;
}
body[data-avatar-framing="fullbody"] .composer.microphone-only { width: auto; }
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"] .composer { bottom: 18px; }
body[data-screen-layout="portrait"][data-avatar-framing="fullbody"].quiet-idle .conversation-copy { visibility: hidden; }
@media (max-width: 410px) {
  body[data-screen-layout="portrait"] .account-trigger-copy { display: none; }
}
@media (max-width: 360px) {
  body[data-screen-layout="portrait"] .topbar > .brand-lockup > div { display: none; }
}

/* Scene preparation stays beside the choice; the running scene remains available. */
.scene-preparation-notice { margin-top: 12px; padding: 12px 14px; border-left: 3px solid #78dba2; border-radius: 4px; background: #1a2a20; color: #e3f2e8; font-size: 12px; line-height: 1.65; }
.scene-preparation-notice[hidden], .scene-download-progress[hidden] { display: none; }
.scene-preparation-notice.has-error { border-color: #f0b979; background: #30251b; color: #ffe3c2; }
.role-scene-choice.is-preparing { border-color: #78dba2; background: #1a2a20; }
.role-scene-choice.is-preparing .role-scene-state { color: #b9e8cb; font-weight: 600; }
.role-scene-choice.has-error .role-scene-state { color: #f0b979; }
.scene-download-progress { display: block; width: 100%; height: 5px; margin-top: 5px; accent-color: #78dba2; border: 0; border-radius: 3px; overflow: hidden; }
.scene-download-progress::-webkit-progress-bar { background: #354b3e; }
.scene-download-progress::-webkit-progress-value { background: #78dba2; }

/* Landscape dialogue and input share a column, clear of the character stage. */
body[data-screen-layout="landscape"] {
  --landscape-copy-left: clamp(28px, 5vw, 110px);
  --landscape-copy-width: min(38vw, 600px);
}
body[data-screen-layout="landscape"] .topbar {
  height: 72px; padding: 0 28px; align-items: center;
  background: linear-gradient(180deg, rgba(7, 10, 9, .84), rgba(7, 10, 9, .5) 75%, transparent);
}
body[data-screen-layout="landscape"] .conversation-copy,
body[data-screen-layout="landscape"] .conversation-copy.rich-step-active {
  left: var(--landscape-copy-left); width: var(--landscape-copy-width);
  top: 104px; bottom: 132px; max-height: none; padding: 0 8px 0 0;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(164, 170, 165, .3) transparent;
  background: transparent; justify-content: safe center;
}
body[data-screen-layout="landscape"] .conversation-copy.rich-step-active { justify-content: flex-start; }
body[data-screen-layout="landscape"] .conversation-copy > * { flex-shrink: 0; }
body[data-screen-layout="landscape"] .user-turn { margin-bottom: 22px; }
body[data-screen-layout="landscape"] .bot-name { margin-bottom: 14px; }
body[data-screen-layout="landscape"] .subtitle { font-size: clamp(26px, 2.8vw, 38px); line-height: 1.4; overflow-wrap: anywhere; }
body[data-screen-layout="landscape"] .subtitle.long-reply { font-size: clamp(23px, 2.35vw, 32px); line-height: 1.48; }
body[data-screen-layout="landscape"] .subtitle.long-reply.reply-complete {
  font-size: clamp(20px, 1.9vw, 27px); line-height: 1.55;
  max-height: none; overflow: visible; padding-right: 0;
}
body[data-screen-layout="landscape"] .subtitle.long-reply.reply-complete-dense { font-size: clamp(17px, 1.5vw, 22px); }
body[data-screen-layout="landscape"] .composer {
  left: var(--landscape-copy-left); width: var(--landscape-copy-width);
  transform: none; bottom: 44px;
}
body[data-screen-layout="landscape"] .composer.microphone-only { width: auto; }
body[data-screen-layout="landscape"] .full-reply-panel {
  left: var(--landscape-copy-left); width: var(--landscape-copy-width);
  min-width: 0; top: 88px; bottom: 128px; padding: 22px;
}
body[data-screen-layout="landscape"] .companion-prelude {
  left: 48%; right: 4%; top: 84px; bottom: 112px; width: auto; aspect-ratio: auto; translate: none;
}
body[data-screen-layout="landscape"] .prelude-field { width: min(100%, 52vh); height: auto; aspect-ratio: 1; }
body[data-screen-layout="landscape"][data-avatar-framing="fullbody"] .flowact-stage {
  inset: 72px 8% 16px 44%;
}
body[data-screen-layout="landscape"] .vignette {
  background: linear-gradient(90deg, rgba(7, 10, 9, .85), rgba(7, 10, 9, .55) 38%, rgba(7, 10, 9, .08) 54%, transparent 72%);
}
@media (min-width: 761px) {
  body[data-screen-layout="landscape"] .account-trigger { width: auto; min-width: 88px; padding: 0 9px 0 6px; }
  body[data-screen-layout="landscape"] .account-trigger-copy { display: block; }
}
@media (max-width: 760px) {
  body[data-screen-layout="landscape"] { --landscape-copy-left: 20px; }
  body[data-screen-layout="landscape"] .topbar { padding-inline: 16px; }
  body[data-screen-layout="landscape"] .top-actions { position: static; gap: 5px; }
  body[data-screen-layout="landscape"] .top-actions .window-controls { position: static; }
  body[data-screen-layout="landscape"] .conversation-copy { top: 88px; bottom: 112px; }
  body[data-screen-layout="landscape"] .composer { bottom: 28px; padding: 6px; gap: 4px; }
  body[data-screen-layout="landscape"] .composer > button { padding-inline: 8px; }
  body[data-screen-layout="landscape"] .subtitle { font-size: 26px; }
  body[data-screen-layout="landscape"] .subtitle.long-reply { font-size: 21px; }
  body[data-screen-layout="landscape"] .full-reply-panel { top: 88px; bottom: 112px; padding: 16px; }
}
