@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #0d0a0f;
  --panel: #151117;
  --panel-2: #1b151d;
  --line: rgba(255, 255, 255, .085);
  --text: #f8f3f7;
  --muted: #9e929e;
  --pink: #ff3d8d;
  --pink-2: #c51861;
  --pink-soft: rgba(255, 61, 141, .13);
  --green: #66e3ae;
  --radius: 22px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.noise { position: fixed; inset: 0; opacity: .024; pointer-events: none; z-index: 9; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E"); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 7px; color: #ad9eaa; font-size: .72rem; letter-spacing: .15em; font-weight: 700; }
.muted { color: var(--muted); }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 82px minmax(0, 1fr); }
.sidebar { position: relative; z-index: 8; padding: 22px 11px 16px; border-right: 1px solid var(--line); background: rgba(16,12,18,.84); backdrop-filter: blur(30px) saturate(130%); display: flex; flex-direction: column; min-height: 100dvh; }
.brand { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 0 27px; }
.brand-mark { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(145deg, #ff4f99, #ac114e); box-shadow: 0 10px 34px rgba(224, 25, 106, .3); font-family: Manrope, sans-serif; font-size: 1.35rem; font-weight: 800; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 1rem; }
.brand strong, .brand span { display: block; }
.brand strong { font-family: Manrope, sans-serif; font-size: 1.02rem; }
.brand span { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.brand > div:last-child { display: none; }
.main-nav { display: grid; gap: 5px; }
.nav-item { position: relative; min-height: 48px; padding: 0; border: 0; border-radius: 14px; background: transparent; display: flex; align-items: center; justify-content: center; gap: 12px; color: #9f949f; font-size: .9rem; font-weight: 600; cursor: pointer; text-align: left; transition: .2s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.045); }
.nav-item.active { color: #fff; background: linear-gradient(145deg, rgba(255,61,141,.2), rgba(255,255,255,.045)); box-shadow: inset 0 0 0 1px rgba(255,61,141,.16), 0 10px 26px rgba(0,0,0,.16); }
.nav-item.active svg { color: var(--pink); }
.nav-item > span:not(.count) { display: none; }
.nav-item .count { position: absolute; right: 3px; top: 3px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border-radius: 8px; color: #ffe7f1; background: #a91751; font-size: .58rem; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 9px; }
.system-card { display: none; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.system-card > span { display: block; padding: 4px 0 0 18px; color: var(--muted); font-size: .7rem; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: .75rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(102,227,174,.7); }
.nav-item.quiet { font-size: .8rem; }

.workspace { min-width: 0; min-height: 100dvh; display: grid; grid-template-rows: 82px minmax(0, 1fr); background: radial-gradient(circle at 18% 60%, rgba(117,20,60,.12), transparent 34%), #0f0c11; }
.topbar { position: relative; z-index: 3; display: flex; align-items: center; gap: 14px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(15,12,17,.82); backdrop-filter: blur(18px); }
.topbar h1 { margin: 0; font-family: Manrope, sans-serif; font-size: 1.25rem; }
.topbar .eyebrow { margin-bottom: 2px; font-size: .62rem; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.chat-toggle { position: relative; height: 38px; padding: 0 13px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; display: flex; align-items: center; gap: 8px; color: #efe5ec; background: rgba(255,255,255,.055); backdrop-filter: blur(18px); cursor: pointer; }
.chat-toggle:hover, .chat-toggle[aria-expanded="true"] { border-color: rgba(255,61,141,.28); background: rgba(255,61,141,.12); }
.chat-toggle span { font-size: .77rem; font-weight: 600; }
.chat-toggle i { position: absolute; right: -5px; top: -6px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; border: 2px solid #100c12; border-radius: 9px; color: #fff; background: var(--pink); font: 700 .59rem/1 DM Sans, sans-serif; }
.sound-toggle { height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); background: rgba(255,255,255,.03); cursor: pointer; }
.sound-toggle.active { color: #f1c4d6; border-color: rgba(255,61,141,.2); background: rgba(255,61,141,.08); }
.sound-toggle span { font-size: .77rem; font-weight: 600; }
.icon-button { width: 39px; height: 39px; padding: 0; border: 1px solid var(--line); border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.025); cursor: pointer; transition: .2s ease; }
.icon-button:hover { background: rgba(255,255,255,.075); border-color: rgba(255,255,255,.14); }
.icon-button:disabled { opacity: .32; cursor: not-allowed; }
.icon-button:disabled:hover { background: rgba(21,13,19,.5); border-color: var(--line); }
.mobile-menu { display: none; }

.view { display: none; min-height: 0; }
.view.active { display: grid; }
#chatView { position: relative; overflow: hidden; isolation: isolate; }
#chatView.active { display: block; }
.stage { position: absolute; inset: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 84%, rgba(255,30,116,.25), transparent 45%), radial-gradient(circle at 50% 35%, rgba(116,29,73,.11), transparent 38%), linear-gradient(180deg, #160d14, #0e0a0e 80%); }
.stage::before { content: ""; position: absolute; inset: 0; opacity: .35; background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, transparent, #000 35%, #000); }
.stage-glow { position: absolute; z-index: 0; width: 74%; aspect-ratio: 1; left: 13%; bottom: -20%; border-radius: 50%; border: 1px solid rgba(255,61,141,.18); box-shadow: 0 0 80px rgba(255,30,116,.14), inset 0 0 80px rgba(255,30,116,.11); animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.045); opacity: .7; } }
#live2dCanvas { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#live2dCanvas.dragging { cursor: grabbing; }
.stage.avatar-locked #live2dCanvas { cursor: default; touch-action: auto; }
.avatar-fallback { position: absolute; z-index: 1; left: 50%; bottom: -3%; width: min(85%, 620px); max-height: 94%; transform: translateX(-50%); object-fit: contain; object-position: center bottom; filter: drop-shadow(0 20px 35px rgba(0,0,0,.5)); mix-blend-mode: screen; }
.stage-topline { position: absolute; z-index: 2; top: 20px; left: 20px; right: 20px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.live-pill { height: 29px; padding: 0 10px; display: flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.1); border-radius: 99px; color: #efc8d8; background: rgba(17,10,15,.56); backdrop-filter: blur(12px); font-size: .67rem; letter-spacing: .12em; font-weight: 700; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 10px var(--pink); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.glass { background: rgba(17,10,15,.5); backdrop-filter: blur(10px); }
.model-controls { display: flex; gap: 7px; pointer-events: auto; }
.model-controls .icon-button { width: 37px; height: 37px; border-radius: 12px; background: rgba(21,13,19,.5); backdrop-filter: blur(18px) saturate(140%); }
.model-controls .model-lock.active { color: #ffd6e6; border-color: rgba(255,61,141,.42); background: rgba(255,61,141,.18); box-shadow: 0 0 22px rgba(255,61,141,.12); }
.emotion-card { position: absolute; z-index: 2; left: 20px; bottom: 21px; padding: 11px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(15,10,14,.72); backdrop-filter: blur(14px); }
.emotion-card > span { display: block; margin-bottom: 5px; color: #9f919c; font-size: .65rem; }
.emotion-card strong { display: flex; align-items: center; gap: 7px; font-size: .82rem; }
.emotion-card i { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.audio-wave { position: absolute; z-index: 2; right: 22px; bottom: 27px; height: 26px; display: flex; align-items: center; gap: 3px; }
.audio-wave i { width: 3px; height: 5px; border-radius: 4px; background: #e76c9e; animation: wave .85s ease-in-out infinite alternate; }
.audio-wave i:nth-child(2), .audio-wave i:nth-child(6) { animation-delay: -.3s; }
.audio-wave i:nth-child(3), .audio-wave i:nth-child(5) { animation-delay: -.55s; }
.audio-wave i:nth-child(4) { animation-delay: -.2s; }
.audio-wave.idle i { animation-play-state: paused; opacity: .35; }
@keyframes wave { from { height: 5px; } to { height: 25px; } }
.model-hint { position: absolute; z-index: 2; left: 50%; bottom: 100px; transform: translateX(-50%); padding: 8px 11px; display: flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.08); border-radius: 99px; color: rgba(238,227,234,.58); background: rgba(16,10,15,.38); backdrop-filter: blur(14px); font-size: .68rem; pointer-events: none; transition: opacity .3s; }
.model-hint svg { width: 15px; height: 15px; }
.model-hint.hidden { opacity: 0; }

.conversation { position: absolute; z-index: 5; top: 15px; right: 15px; bottom: 96px; width: min(440px, calc(100% - 30px)); min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); border: 1px solid rgba(255,255,255,.11); border-radius: 26px; opacity: 0; transform: translateX(calc(100% + 30px)) scale(.98); pointer-events: none; overflow: hidden; background: linear-gradient(145deg, rgba(35,28,36,.74), rgba(14,10,15,.66)); box-shadow: 0 28px 80px rgba(0,0,0,.38); backdrop-filter: blur(34px) saturate(145%); transition: transform .34s cubic-bezier(.2,.8,.2,1), opacity .25s ease; }
#chatView.chat-open .conversation { opacity: 1; transform: translateX(0) scale(1); pointer-events: auto; }
.conversation-head { min-height: 84px; padding: 22px 30px 14px; display: flex; align-items: center; justify-content: space-between; }
.conversation-head h2 { margin: 0; font: 700 1rem Manrope, sans-serif; }
.conversation-head .eyebrow { margin-bottom: 4px; font-size: .6rem; }
.conversation-actions { display: flex; gap: 7px; }
.messages { min-height: 0; padding: 12px 30px 30px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: rgba(255,255,255,.15) transparent; }
.message { max-width: 780px; margin: 0 auto 25px; display: flex; align-items: flex-start; gap: 11px; }
.message.user { justify-content: flex-end; }
.message-avatar { flex: 0 0 auto; width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(145deg, #ff4f99, #9f1148); box-shadow: 0 7px 19px rgba(212,29,101,.2); font-size: .7rem; font-weight: 800; }
.bubble { max-width: min(82%, 650px); }
.speaker { display: block; margin: 2px 0 7px; color: #af9da8; font-size: .61rem; letter-spacing: .08em; font-weight: 700; }
.speaker i { color: #5b4e57; font-style: normal; }
.bubble p { margin: 0; padding: 13px 15px; border: 1px solid rgba(255,255,255,.1); border-radius: 7px 19px 19px 19px; color: #f4edf2; background: linear-gradient(145deg, rgba(255,255,255,.105), rgba(255,255,255,.045)); box-shadow: inset 0 1px rgba(255,255,255,.06), 0 10px 28px rgba(0,0,0,.12); backdrop-filter: blur(22px) saturate(135%); line-height: 1.58; font-size: .92rem; white-space: pre-wrap; }
.message.user .bubble { text-align: right; }
.message.user .bubble p { border-color: rgba(255,113,171,.24); border-radius: 19px 7px 19px 19px; text-align: left; color: #fff; background: linear-gradient(135deg, rgba(212,34,107,.48), rgba(111,19,63,.38)); box-shadow: inset 0 1px rgba(255,255,255,.1), 0 12px 30px rgba(74,8,35,.2); }
.message.user .speaker { color: #c9829f; }
.message.loading .bubble p { width: 60px; min-height: 42px; display: flex; align-items: center; gap: 4px; }
.typing-dot { width: 5px; height: 5px; border-radius: 50%; background: #b9aab3; animation: typing 1s infinite alternate; }
.typing-dot:nth-child(2) { animation-delay: .2s; }.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typing { to { opacity: .25; transform: translateY(-3px); } }
.composer { position: absolute; z-index: 6; left: 50%; bottom: 21px; width: min(700px, calc(100% - 48px)); min-height: 60px; display: flex; align-items: flex-end; padding: 9px 10px 9px 17px; border: 1px solid rgba(255,255,255,.12); border-radius: 21px; transform: translateX(-50%); background: linear-gradient(145deg, rgba(44,36,45,.72), rgba(20,15,21,.68)); box-shadow: inset 0 1px rgba(255,255,255,.07), 0 18px 52px rgba(0,0,0,.34); backdrop-filter: blur(30px) saturate(150%); transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: rgba(255,61,141,.42); box-shadow: inset 0 1px rgba(255,255,255,.07), 0 0 0 3px rgba(255,61,141,.07), 0 18px 52px rgba(0,0,0,.34); }
.composer textarea { flex: 1; max-height: 140px; min-height: 40px; padding: 9px 8px 8px 0; border: 0; outline: 0; resize: none; color: #fff; background: transparent; line-height: 1.4; font-size: .9rem; }
.composer textarea::placeholder { color: #726873; }
.composer-actions { display: flex; gap: 7px; padding-bottom: 1px; }
.record-button, .send-button { width: 39px; height: 39px; padding: 0; border: 0; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.record-button { color: #b5a7b0; background: rgba(255,255,255,.055); }
.record-button.recording { color: #fff; background: #d5266f; animation: record 1.5s infinite; }
@keyframes record { 50% { box-shadow: 0 0 0 8px rgba(213,38,111,.12); } }
.send-button { background: linear-gradient(145deg, #f23a85, #bc155a); box-shadow: 0 8px 20px rgba(217,32,105,.24); }
.recording-label { position: absolute; left: 18px; top: -27px; padding: 4px 8px; border-radius: 7px; color: #ffc2da; background: #4a152c; font-size: .68rem; }

.panel-view { overflow-y: auto; padding: 48px clamp(24px, 5vw, 74px) 70px; align-content: start; }
.panel-heading { max-width: 720px; margin-bottom: 30px; }
.panel-heading h2 { margin: 0 0 9px; font: 700 clamp(1.6rem, 3vw, 2.25rem) Manrope, sans-serif; }
.panel-heading > p:last-child { margin: 0; color: var(--muted); line-height: 1.55; }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.memory-card { position: relative; min-height: 145px; padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(255,255,255,.035), rgba(255,255,255,.012)); }
.memory-card .memory-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #ff77ad; background: var(--pink-soft); }
.memory-card p { margin: 16px 34px 0 0; color: #ddd3da; line-height: 1.5; font-size: .88rem; }
.memory-card small { display: block; margin-top: 12px; color: #796e77; font-size: .68rem; }
.memory-card button { position: absolute; right: 12px; top: 12px; width: 31px; height: 31px; border: 0; border-radius: 9px; color: #817580; background: transparent; cursor: pointer; }
.memory-card button:hover { color: #ff91b9; background: rgba(255,61,141,.09); }
.empty-state { max-width: 460px; padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-state svg { width: 30px; height: 30px; color: var(--pink); }
.empty-state h3 { margin: 16px 0 7px; color: var(--text); }
.empty-state p { margin: 0; line-height: 1.55; }

.settings-grid { max-width: 1060px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-card { margin: 0; padding: 21px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.025); }
.settings-card legend { padding: 0 8px; margin-left: -8px; font: 700 1rem Manrope, sans-serif; }
.settings-card > label:not(.switch-row), .inline-fields label, .expression-grid label { display: grid; gap: 7px; margin-top: 16px; color: #baadb6; font-size: .78rem; font-weight: 600; }
.settings-card input:not([type="checkbox"]):not([type="range"]), .settings-card textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; outline: 0; padding: 10px 12px; color: #eee5eb; background: #100c11; font-size: .86rem; }
.settings-card textarea { resize: vertical; line-height: 1.5; }
.settings-card input:focus, .settings-card textarea:focus { border-color: rgba(255,61,141,.43) !important; box-shadow: 0 0 0 3px rgba(255,61,141,.06); }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-fields input[type="range"] { width: 100%; accent-color: var(--pink); }
.switch-row { margin: 16px 0 4px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-row > span { flex: 1; }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { font-size: .84rem; }.switch-row small { margin-top: 3px; color: var(--muted); font-size: .7rem; font-weight: 400; }
.switch-row input { position: absolute; opacity: 0; }
.switch-row i { position: relative; width: 43px; height: 24px; border-radius: 99px; background: #3d343d; transition: .2s; }
.switch-row i::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: #d7ced4; transition: .2s; }
.switch-row input:checked + i { background: var(--pink-2); }.switch-row input:checked + i::after { transform: translateX(19px); background: #fff; }
.expression-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field-note { margin: 12px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.settings-save { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding-top: 10px; }
.settings-save > span { color: var(--green); font-size: .78rem; }
.primary-button { min-height: 46px; padding: 0 18px; border: 0; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; color: #fff; background: linear-gradient(135deg, #ef3b84, #b91156); box-shadow: 0 12px 30px rgba(199,20,89,.23); font-weight: 700; cursor: pointer; }
.primary-button:hover { filter: brightness(1.07); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }

.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 50%, rgba(164,22,79,.17), transparent 38%), linear-gradient(145deg, #0b080c, #150c12); }
.login-card { width: min(100%, 410px); padding: 38px; border: 1px solid rgba(255,255,255,.095); border-radius: 26px; background: rgba(20,15,21,.88); box-shadow: 0 35px 90px rgba(0,0,0,.48); backdrop-filter: blur(20px); }
.login-card .brand-mark { margin-bottom: 30px; }
.login-card h1 { margin: 0 0 10px; font: 700 1.7rem Manrope, sans-serif; }
.login-card > .muted { margin: 0 0 28px; line-height: 1.5; }
.login-form label { display: block; margin-bottom: 8px; color: #b9aab4; font-size: .78rem; font-weight: 600; }
.password-row { display: flex; border: 1px solid var(--line); border-radius: 13px; background: #0e0a0e; }
.password-row:focus-within { border-color: rgba(255,61,141,.45); box-shadow: 0 0 0 3px rgba(255,61,141,.07); }
.password-row input { flex: 1; min-width: 0; height: 48px; padding: 0 13px; border: 0; outline: 0; color: #fff; background: transparent; }
.password-row .icon-button { align-self: center; border: 0; background: transparent; }
.login-form .primary-button { width: 100%; margin-top: 12px; }
.form-error { min-height: 18px; margin: 7px 0 0; color: #ff82ad; font-size: .75rem; }
.privacy-note { margin: 23px 0 0; display: flex; align-items: center; justify-content: center; gap: 7px; color: #786e77; font-size: .7rem; }
.privacy-note svg { width: 14px; height: 14px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 11px 15px; border: 1px solid var(--line); border-radius: 11px; opacity: 0; visibility: hidden; color: #f5ebf1; background: #241821; box-shadow: 0 14px 40px rgba(0,0,0,.4); font-size: .8rem; transition: .25s ease; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

@media (max-width: 960px) {
  .chat-toggle span { display: none; }
  .chat-toggle { width: 38px; padding: 0; justify-content: center; }
}

@media (max-width: 720px) {
  body { overflow: auto; }
  .app-shell { display: block; min-height: 100dvh; }
  .sidebar { position: fixed; z-index: 12; inset: 0 auto 0 0; width: min(82vw, 290px); padding: 24px 16px; transform: translateX(-102%); transition: transform .25s ease; box-shadow: 30px 0 70px rgba(0,0,0,.55); }
  .sidebar.open { transform: translateX(0); }
  .brand { justify-content: flex-start; padding-inline: 10px; }
  .brand > div:last-child, .nav-item > span:not(.count), .system-card { display: block; }
  .nav-item { justify-content: flex-start; padding: 0 12px; }
  .nav-item .count { position: static; margin-left: auto; display: grid; min-width: 21px; height: 21px; font-size: .7rem; }
  .workspace { min-height: 100dvh; grid-template-rows: 67px minmax(0, 1fr); }
  .topbar { position: sticky; top: 0; padding: 0 14px; }
  .mobile-menu { display: grid; }
  .topbar h1 { font-size: 1rem; }
  .sound-toggle { width: 38px; padding: 0; justify-content: center; }
  .sound-toggle span { display: none; }
  #chatView { display: none; }
  #chatView.active { display: block; }
  .stage { border: 0; }
  .avatar-fallback { width: min(65%, 360px); bottom: -8%; }
  .stage-topline { top: 12px; left: 12px; right: 12px; }
  .emotion-card { left: 12px; bottom: 12px; padding: 8px 10px; }
  .audio-wave { right: 14px; bottom: 15px; }
  .model-controls { gap: 5px; }
  .model-controls .icon-button { width: 34px; height: 34px; }
  .model-hint { display: none; }
  .conversation { top: auto; left: 9px; right: 9px; bottom: 82px; width: auto; height: min(60dvh, 570px); border-radius: 24px; transform: translateY(calc(100% + 100px)) scale(.98); }
  #chatView.chat-open .conversation { transform: translateY(0) scale(1); }
  .conversation-head { min-height: 67px; padding: 16px 16px 8px; }
  .messages { padding: 10px 15px 25px; }
  .message { margin-bottom: 19px; }
  .bubble { max-width: 87%; }
  .bubble p { font-size: .88rem; }
  .composer { position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); width: calc(100% - 18px); min-height: 57px; border-radius: 19px; }
  .panel-view { padding: 30px 17px 60px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-save { position: sticky; bottom: 0; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #0f0c11 28%); }
  .login-card { padding: 30px 23px; }
}

@media (max-width: 420px) {
  .inline-fields, .expression-grid { grid-template-columns: 1fr; }
  .settings-save .primary-button { width: 100%; }
  .settings-save > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
