/* Mochi Aurora Glass: visual layer only. Functionality remains in app.js. */
:root {
  --bg: #090d18;
  --bg-2: #10182a;
  --surface: rgba(20, 28, 47, .76);
  --surface-2: rgba(29, 39, 64, .86);
  --ink: #f4f7ff;
  --muted: #9ca9c3;
  --line: rgba(168, 187, 226, .18);
  --accent: #ff8c79;
  --accent-deep: #ffb09f;
  --accent-soft: rgba(255, 140, 121, .13);
  --mint: #65e0c0;
  --mint-soft: rgba(101, 224, 192, .12);
  --sky-soft: rgba(119, 179, 255, .12);
  --warn-soft: rgba(255, 195, 105, .13);
  --shadow: 0 24px 80px rgba(0, 0, 0, .28), 0 2px 10px rgba(0, 0, 0, .2);
  --radius: 22px;
  --radius-sm: 15px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

:root[data-theme="light"] {
  --bg: #eaf0f9;
  --bg-2: #f7f9fd;
  --surface: rgba(255, 255, 255, .72);
  --surface-2: rgba(255, 255, 255, .9);
  --ink: #172238;
  --muted: #61708b;
  --line: rgba(67, 91, 133, .16);
  --accent: #e96859;
  --accent-deep: #c94d42;
  --accent-soft: rgba(233, 104, 89, .1);
  --mint: #168f7a;
  --mint-soft: rgba(22, 143, 122, .1);
  --sky-soft: rgba(77, 144, 224, .1);
  --warn-soft: rgba(220, 154, 44, .12);
  --shadow: 0 24px 70px rgba(35, 55, 91, .14), 0 2px 10px rgba(35, 55, 91, .08);
}

html { background: var(--bg); }
body {
  font-family: Nunito, "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 520px at 8% -8%, rgba(255, 140, 121, .22), transparent 62%),
    radial-gradient(700px 500px at 105% 3%, rgba(100, 147, 255, .2), transparent 64%),
    radial-gradient(600px 400px at 70% 100%, rgba(87, 229, 196, .1), transparent 66%),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .3;
  background-image: linear-gradient(rgba(164, 188, 232, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(164, 188, 232, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}
.sky { z-index: 0; }
.orb { filter: blur(28px); opacity: .5; mix-blend-mode: screen; animation: aurora-drift 14s ease-in-out infinite alternate; }
.o1 { width: 270px; height: 270px; background: rgba(255, 125, 105, .17); top: 5%; left: 2%; }
.o2 { width: 220px; height: 220px; background: rgba(97, 227, 198, .13); top: 70%; right: 8%; animation-delay: -4s; }
.o3 { width: 170px; height: 170px; background: rgba(107, 160, 255, .14); top: 22%; right: 22%; animation-delay: -8s; }

.topbar { padding-top: 14px; }
.brand-mark, .btn.ghost, .commands-panel, .chat, .home-card, .wait-shell, .composer, .chat-wait, .chat-continue, .activity-card, .result-card, .docs-grid article, .docs-faq details, .wallet-status {
  background: linear-gradient(145deg, rgba(255,255,255,.105), rgba(255,255,255,.035));
  border-color: var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
}
.brand-mark { border-radius: 14px; transform: translateZ(0); box-shadow: 0 10px 30px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.18); }
.brand h1 { font-size: 1.18rem; letter-spacing: .01em; }
.tagline { letter-spacing: .08em; text-transform: uppercase; font-size: .62rem; }
.btn { border-radius: 13px; transition: transform .22s var(--ease), box-shadow .22s var(--ease), background .22s ease, border-color .22s ease; }
.btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.18); }
.btn:not(:disabled):active { transform: translateY(1px) scale(.98); }
.btn.ghost:hover { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.3); }
.btn.send { background: linear-gradient(135deg, var(--mint), #39bda8); color: #071b1d; box-shadow: 0 10px 28px rgba(72, 218, 185, .2); }
.count-badge, #command-count { box-shadow: 0 0 0 3px rgba(255, 140, 121, .12); }

.stage-wrap { gap: 16px; }
.companion { padding-top: 10px; }
.podium { padding: 16px 20px 12px; min-height: 170px; border: 1px solid var(--line); border-radius: 26px; background: radial-gradient(circle at 50% 25%, rgba(255,255,255,.12), transparent 52%), linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.025)); box-shadow: var(--shadow); }
.podium::after { content: ""; width: 116px; height: 16px; border-radius: 50%; background: rgba(80, 232, 198, .12); filter: blur(12px); position: absolute; margin-top: 116px; }
.mochi { filter: drop-shadow(0 18px 20px rgba(0,0,0,.2)); }
.mochi-body { box-shadow: inset -10px -12px 18px rgba(180, 70, 70, .24), inset 10px 8px 14px rgba(255, 255, 255, .6), 12px 15px 0 rgba(255, 140, 121, .12), 0 20px 34px rgba(255, 119, 96, .16); }
.mood-label { color: var(--accent-deep); letter-spacing: .03em; }
.commands-panel { border-radius: var(--radius); padding: 18px; }
.panel-head h2 { font-size: .86rem; text-transform: uppercase; letter-spacing: .08em; }
.panel-hint { color: var(--muted); }
.command-list li { border-color: var(--line); background: rgba(255,255,255,.045); border-radius: 12px; }

.chat { border-radius: 26px; padding: 18px; border: 1px solid var(--line); min-height: 0; }
.messages { padding: 10px 8px 16px; }
.bubble { border: 1px solid var(--line); box-shadow: 0 16px 34px rgba(0,0,0,.14), inset 0 1px rgba(255,255,255,.08); backdrop-filter: blur(16px); animation: bubble-in .4s var(--ease) both; }
.bubble.user { background: linear-gradient(135deg, rgba(255, 140, 121, .22), rgba(255, 177, 142, .08)); border-color: rgba(255, 151, 130, .28); }
.bubble.assistant { background: linear-gradient(135deg, rgba(101, 224, 192, .12), rgba(108, 143, 255, .07)); }
.typing-bubble { background: rgba(255,255,255,.06); border-color: var(--line); }
.composer { border: 1px solid var(--line); border-radius: 20px; padding: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.1); }
.composer-row textarea, .history-search input, .profile-form input, .profile-form textarea, .custom-task input, .ask-form input { background: rgba(3, 8, 19, .3); border-color: var(--line); color: var(--ink); border-radius: 14px; }
.composer-row textarea:focus, .history-search input:focus, .profile-form input:focus, .profile-form textarea:focus, .custom-task input:focus, .ask-form input:focus { border-color: rgba(101,224,192,.7); box-shadow: 0 0 0 4px rgba(101,224,192,.11); }
.attach-menu { background: var(--surface-2); border-color: var(--line); box-shadow: var(--shadow); }
.chat-wait { border: 1px solid rgba(101,224,192,.22); }
.chat-wait-steps li.is-active { color: var(--mint); }

.layer { background: rgba(5, 9, 18, .48); backdrop-filter: blur(10px); cursor: default; opacity: 1; transition: opacity .2s ease, background .2s ease; }
.layer::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 4%, rgba(125, 164, 255, .09), transparent 54%); }
.layer > .home-card, .layer > .wait-shell { position: relative; z-index: 1; cursor: default; animation: panel-enter .28s var(--ease) both; }
.layer > .home-card::after, .layer > .wait-shell::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 1px rgba(255,255,255,.12); }
@keyframes panel-enter { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (min-width: 900px) { .layer { cursor: pointer; } }

.home-card, .wait-shell { border: 1px solid var(--line); border-radius: 28px; }
.home-card h2, .wait-shell h2 { letter-spacing: -.025em; }
.kicker { color: var(--accent-deep); letter-spacing: .15em; font-size: .65rem; }
.task-grid { gap: 12px; }
.task-pick, .theme-options .btn { background: rgba(255,255,255,.045); border-color: var(--line); transition: transform .22s var(--ease), border-color .22s ease, background .22s ease; }
.task-pick:hover, .task-pick.on, .theme-options [aria-pressed="true"] { transform: translateY(-3px); border-color: rgba(101,224,192,.58); background: rgba(101,224,192,.1); }
.bar { background: rgba(255,255,255,.1); border: 1px solid var(--line); }
#progress-fill { background: linear-gradient(90deg, var(--mint), #78b9ff, var(--accent)); box-shadow: 0 0 20px rgba(101,224,192,.4); }
.timeline li.is-done { color: var(--mint); }
.profile-avatar { box-shadow: 0 18px 40px rgba(0,0,0,.24), 0 0 0 5px rgba(255,255,255,.06); }
.lightbox { background: rgba(4, 7, 14, .86); backdrop-filter: blur(18px); }
.toast { background: rgba(18, 25, 42, .92); border-color: rgba(255,255,255,.16); box-shadow: var(--shadow); }

/* Shared page language for every secondary surface. */
.layer { padding: clamp(18px, 4vw, 52px) var(--safe-r) var(--safe-b) var(--safe-l); }
.layer > .home-card, .layer > .wait-shell { width: min(100%, 980px); margin-inline: auto; }
.home-card { padding: clamp(20px, 4vw, 38px); }
.home-sub, .settings-note, .profile-empty p, .docs-section p, .docs-intro p { max-width: 68ch; }
.home-card > h2, .home-card > .home-sub, .task-card > h2, .task-card > .home-sub { position: relative; z-index: 1; }
.home-card h2 { font-size: clamp(1.55rem, 3vw, 2.35rem); line-height: 1.05; }
.settings-card, .profile-card, .documentation-card { overflow: auto; max-height: min(86dvh, 900px); }
.settings-head, .profile-head, .history-header { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.settings-group, .docs-section { border-top-color: var(--line); }
.settings-group:first-of-type { margin-top: 22px; }
.settings-group > .kicker, .docs-section > .kicker { margin-bottom: 7px; }
.task-card { position: relative; overflow: hidden; }
.task-card::before, .settings-card::before, .profile-card::before, .documentation-card::before { content: ""; position: absolute; width: 240px; height: 240px; right: -100px; top: -120px; border-radius: 50%; background: rgba(101, 224, 192, .12); filter: blur(24px); pointer-events: none; }
.task-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.task-pick { min-height: 108px; border-radius: 17px; padding: 16px; box-shadow: inset 0 1px rgba(255,255,255,.06); }
.task-pick strong { color: var(--ink); }
.task-pick small { color: var(--muted); line-height: 1.4; }
.custom-task { margin-top: 18px; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.custom-task input { margin-top: 7px; min-height: 48px; }
.task-card > .btn { margin-top: 14px; }
.wait-shell { padding: clamp(20px, 4vw, 40px); }
.wait-head { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.wait-grid { gap: 18px; }
.wait-progress, .wait-activity { border-radius: 20px; background: rgba(255,255,255,.035); border: 1px solid var(--line); padding: 18px; }
.activity-card { box-shadow: none; }
.history-search { display: block; margin: 20px 0 14px; }
.history-search input { min-height: 48px; padding-inline: 15px; }
.history-list { gap: 10px; }
.history-list li { border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.045); box-shadow: 0 10px 25px rgba(0,0,0,.1); transition: transform .22s var(--ease), border-color .22s ease, background .22s ease; }
.history-list li:hover { transform: translateX(3px); border-color: rgba(101,224,192,.45); background: rgba(101,224,192,.075); }
.history-list li.empty-cmd:hover { transform: none; }
.stat-row { gap: 10px; }
.stat-row > * { border-color: var(--line); background: rgba(255,255,255,.045); border-radius: 14px; }
.profile-summary { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.045); }
.profile-form { padding-top: 20px; border-top: 1px solid var(--line); }
.profile-form label { color: var(--muted); font-size: .78rem; letter-spacing: .03em; text-transform: uppercase; }
.profile-form input, .profile-form textarea { min-height: 46px; padding: 12px 14px; }
.profile-form textarea { min-height: 108px; resize: vertical; }
.profile-actions { padding-top: 8px; }
.docs-intro { background: linear-gradient(135deg, rgba(101,224,192,.11), rgba(108,143,255,.08)); border-color: rgba(101,224,192,.22); }
.docs-flow { padding: 10px 0; }
.docs-flow span { background: rgba(255,255,255,.06); border-color: var(--line); }
.docs-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.docs-grid article { min-height: 130px; transition: transform .22s var(--ease), border-color .22s ease; }
.docs-grid article:hover { transform: translateY(-3px); border-color: rgba(101,224,192,.42); }
.docs-faq details[open] { border-color: rgba(101,224,192,.42); background: rgba(101,224,192,.07); }
.confirm-backdrop { background: rgba(4, 7, 14, .72); backdrop-filter: blur(14px); }
.confirm-modal { background: linear-gradient(145deg, rgba(29,39,64,.96), rgba(13,19,35,.98)); border-color: var(--line); box-shadow: 0 28px 90px rgba(0,0,0,.45); border-radius: 24px; }
.confirm-actions { gap: 10px; }

@keyframes aurora-drift { from { transform: translate3d(-8px, 4px, 0) scale(.96); } to { transform: translate3d(12px, -12px, 0) scale(1.08); } }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Shared interaction polish. */
button, a, .task-pick, summary { -webkit-tap-highlight-color: transparent; }
button, a, .task-pick, summary { transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s ease, background-color .16s ease, color .16s ease; }
button:not(:disabled):active, .task-pick:active, summary:active { transform: translateY(1px) scale(.985); }
.messages, .command-list, .history-list, .layer, .settings-card, .profile-card, .documentation-card { scrollbar-width: thin; scrollbar-color: rgba(156, 169, 195, .38) transparent; }
.messages::-webkit-scrollbar, .command-list::-webkit-scrollbar, .history-list::-webkit-scrollbar, .layer::-webkit-scrollbar { width: 7px; }
.messages::-webkit-scrollbar-thumb, .command-list::-webkit-scrollbar-thumb, .history-list::-webkit-scrollbar-thumb, .layer::-webkit-scrollbar-thumb { background: rgba(156, 169, 195, .32); border-radius: 999px; }

@media (max-width: 560px) and (max-height: 560px) {
  .stage-wrap { gap: 3px; }
  .companion { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .podium { min-height: 72px; max-height: 86px; flex-direction: row; gap: 8px; justify-content: flex-start; }
  .mochi { transform: scale(.5); margin: -25px -14px -25px -22px; }
  .commands-panel { max-height: 86px; }
  .chat { border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .orb { animation: none; }
}
@media (max-width: 560px) {
  .messages { scroll-behavior: smooth; }
  .topbar, .stage-wrap { contain: layout style; }
}

/* Final production polish: keep motion purposeful and content resilient. */
:where(button, a, input, textarea, select, summary, [role="button"]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--mint) 68%, transparent);
  outline-offset: 3px;
}
:where(input, textarea, select) { caret-color: var(--accent-deep); }
:where(input, textarea, select):disabled { cursor: not-allowed; opacity: .62; }
:where(button, a, summary, [role="button"]):disabled { cursor: not-allowed; }
.messages { contain: layout paint; overscroll-behavior: contain; }
.bubble, .message-content, .history-list li, .command-list li, .docs-grid article { overflow-wrap: anywhere; word-break: break-word; }
.bubble img, .attachment-preview img, #lightbox-content img { display: block; max-width: 100%; height: auto; }
.layer, .home-card, .wait-shell, .confirm-modal { isolation: isolate; }
.layer > .home-card, .layer > .wait-shell { will-change: transform, opacity; }
.task-pick, .docs-grid article, .history-list li, .command-list li { transform: translateZ(0); }
@media (hover: hover) and (pointer: fine) {
  .history-list li:not(.empty-cmd):hover, .docs-grid article:hover, .task-pick:hover { will-change: transform; }
}
@media (prefers-reduced-motion: reduce) {
  .layer > .home-card, .layer > .wait-shell, .bubble-in, .bubble { animation: none !important; }
  .messages { scroll-behavior: auto; }
}


:root[data-theme="light"] .composer-row textarea,
:root[data-theme="light"] .history-search input,
:root[data-theme="light"] .profile-form input,
:root[data-theme="light"] .profile-form textarea,
:root[data-theme="light"] .custom-task input,
:root[data-theme="light"] .ask-form input { background: rgba(255,255,255,.72); }
:root[data-theme="light"] .confirm-modal { background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(235,241,251,.98)); }

@media (max-width: 899px) {
  .layer { align-items: flex-start; overflow: auto; }
  .layer > .home-card, .layer > .wait-shell { margin-block: 8px 22px; }
  .wait-grid { grid-template-columns: 1fr; }
  .topbar { padding-inline: 14px; }
  .stage-wrap { padding-inline: 14px; }
  .chat { border-radius: 22px; padding: 10px; }
  .podium { min-height: 138px; padding: 8px 14px; }
  .mochi { transform: scale(.86); transform-origin: center bottom; margin-bottom: -8px; }
}
@media (max-width: 560px) {
  .layer { padding-top: 12px; }
  .home-card { padding: 18px; }
  .home-card h2 { font-size: 1.55rem; }
  .task-grid { grid-template-columns: 1fr 1fr; }
  .task-pick { min-height: 94px; padding: 12px; }
  .history-header { align-items: flex-start; }
  .profile-summary { align-items: flex-start; padding: 14px; }
  .docs-grid { grid-template-columns: 1fr; }
  .docs-grid article { min-height: auto; }
  body::before { opacity: .16; background-size: 34px 34px; }
  .home-card, .wait-shell { border-radius: 22px; }
  .messages { padding-inline: 2px; }
  .bubble { max-width: 92%; }
  .composer { border-radius: 17px; }
}

/* Final readability pass: Chat's type and control rhythm, shared everywhere. */
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body, button, input, textarea { font-family: Nunito, "Segoe UI", sans-serif; }
body { color: var(--ink); line-height: 1.5; }
.topbar, .stage-wrap, .layer { isolation: isolate; }
.top-actions { gap: 8px; }
.top-actions .btn, .header-actions .btn { min-height: 40px; font-size: .82rem; font-weight: 800; letter-spacing: .01em; }
.btn { min-height: 44px; padding: 10px 16px; font-weight: 800; letter-spacing: .01em; }
.btn.tiny { min-height: 36px; padding: 8px 12px; font-size: .78rem; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, details:focus-visible, .task-pick:focus-visible { outline: 3px solid rgba(101,224,192,.55); outline-offset: 3px; }
.brand-copy h1, .home-card h2, .wait-shell h2, .confirm-modal h2 { font-weight: 800; }
.brand-copy h1 { letter-spacing: -.025em; }
.home-card h2, .wait-shell h2 { max-width: 24ch; }
.home-sub, .wait-task, .settings-note, .panel-hint, .docs-intro p, .docs-section p, .profile-empty p, .task-pick small, .current-step, .wait-meta, .mood-label { font-size: .92rem; line-height: 1.6; }
.kicker, .stage-label, .chat-wait-kicker, .custom-task, .profile-form label { font-weight: 800; }
.kicker { line-height: 1.3; }
.home-card, .wait-shell { background: linear-gradient(145deg, rgba(255,255,255,.095), rgba(255,255,255,.035)); }
.settings-group, .docs-section, .profile-form { padding-top: 22px; margin-top: 22px; }
.settings-group:first-of-type, .docs-section:first-of-type { margin-top: 20px; }
.settings-group h3, .docs-section h3, .docs-grid h4 { color: var(--ink); font-weight: 800; letter-spacing: -.01em; }
.settings-group h3, .docs-section h3 { font-size: 1.05rem; }
.docs-grid article, .docs-faq details, .history-list li, .profile-summary, .stat-row > *, .task-pick, .wait-progress, .wait-activity { box-shadow: 0 12px 28px rgba(0,0,0,.12), inset 0 1px rgba(255,255,255,.055); }
.docs-grid article p, .docs-faq details p { font-size: .88rem; line-height: 1.58; }
.profile-form { gap: 14px; }
.profile-form label { gap: 7px; }
.profile-form input, .profile-form textarea, .custom-task input, .ask-form input, .history-search input { font-size: .94rem; line-height: 1.45; }
.profile-form input::placeholder, .profile-form textarea::placeholder, .custom-task input::placeholder, .ask-form input::placeholder, .history-search input::placeholder, .composer-row textarea::placeholder { color: color-mix(in srgb, var(--muted) 86%, transparent); opacity: 1; }
.history-list li, .command-list li { padding: 13px 15px; }
.history-list li strong, .command-list li strong { font-weight: 800; }
.status, .autopilot-pill, .count-badge, #command-count { font-weight: 800; }
.confirm-modal { width: min(100% - 32px, 470px); padding: clamp(22px, 5vw, 34px); }
.confirm-modal p:not(.kicker) { color: var(--muted); font-size: .95rem; line-height: 1.6; }
.lightbox-content img, #lightbox-content img { box-shadow: 0 24px 80px rgba(0,0,0,.4); }

:root[data-theme="light"] .home-card,
:root[data-theme="light"] .wait-shell,
:root[data-theme="light"] .docs-grid article,
:root[data-theme="light"] .docs-faq details,
:root[data-theme="light"] .history-list li,
:root[data-theme="light"] .profile-summary,
:root[data-theme="light"] .task-pick,
:root[data-theme="light"] .wait-progress,
:root[data-theme="light"] .wait-activity { background: rgba(255,255,255,.78); box-shadow: 0 14px 34px rgba(35,55,91,.08), inset 0 1px rgba(255,255,255,.8); }
:root[data-theme="light"] .panel-hint,
:root[data-theme="light"] .home-sub,
:root[data-theme="light"] .settings-note,
:root[data-theme="light"] .docs-section p,
:root[data-theme="light"] .docs-intro p,
:root[data-theme="light"] .profile-empty p { color: #566782; }

@media (max-width: 899px) {
  .top-actions .btn { min-height: 42px; }
  .home-card h2, .wait-shell h2 { max-width: 32ch; }
}
@media (max-width: 560px) {
  :root { --mobile-control: 44px; }
  html, body { height: var(--vvh, 100dvh); max-height: var(--vvh, 100dvh); overflow: hidden; }
  body { min-height: 0; padding-bottom: 0; }
  .topbar { flex: 0 0 auto; }
  .stage-wrap { flex: 1 1 auto; height: auto; min-height: 0; overflow: hidden; }
  .companion { flex: 0 0 auto; }
  .chat { flex: 1 1 auto; min-height: 0; height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto auto auto auto; }
  .messages { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
  .composer { flex: 0 0 auto; }

  body { min-height: 0; height: var(--vvh, 100dvh); }
  .topbar { flex: 0 0 auto; }
  .stage-wrap { min-height: 0; gap: 5px; padding-bottom: max(6px, var(--safe-b)); }
  .companion { min-height: 0; }
  .podium { min-height: 104px; max-height: 142px; padding: 0 12px 3px; }
  .mochi { transform: scale(.74); margin-block: -18px -17px; }
  .mood-label { margin: 0; font-size: .72rem; }
  .commands-panel { max-height: min(18dvh, 138px); overflow: auto; padding: 12px; }
  .commands-panel .panel-hint { display: none; }
  .command-list { max-height: 72px; overflow: auto; }
  .chat { min-height: min(0px, calc(100dvh - 160px)); border-radius: 18px; }
  .messages { scroll-padding-bottom: 16px; -webkit-overflow-scrolling: touch; }
  .composer { position: relative; z-index: 2; padding: 7px; padding-bottom: max(7px, var(--safe-b)); }
  .composer-row > .icon-attach, .composer-row > .mic-button, .composer-row > #send-btn { min-width: var(--mobile-control); min-height: var(--mobile-control); }
  .attach-menu { bottom: calc(100% + 8px); }
  .home-sub, .wait-task, .settings-note, .panel-hint, .docs-intro p, .docs-section p, .profile-empty p, .task-pick small, .current-step, .wait-meta, .mood-label { font-size: .88rem; }
  .home-card h2, .wait-shell h2 { font-size: 1.55rem; line-height: 1.12; }
  .btn { min-height: 46px; }
  .top-actions .btn { min-height: 40px; padding-inline: 12px; }
  .profile-actions, .confirm-actions, .home-actions { gap: 9px; }
}
