/* Apple-inspired interface layer. Original house tokens adapted from the
   supplied Apple Design Guide. Kevin's artwork and scene mechanics stay local. */
:root,
html[data-palette="galaxy"] {
  --ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pixel: var(--ui);
  --canvas: #f7f6fa;
  --surface: #fff;
  --surface-muted: #f0eef5;
  --ink: #24212c;
  --muted: #696472;
  --accent: #6c4ca4;
  --accent-hover: #583889;
  --accent-soft: #eee7f7;
  --on-accent: #fff;
  --border: #e2dfe9;
  --control-border: #aaa3b5;
  --glass: rgba(255,255,255,.94);
  --paper: var(--surface-muted);
  --paper-deep: var(--border);
  --cream: var(--surface);
  --green: var(--ink);
  --green-2: var(--accent);
  --mint: #c6b4e4;
  --lime: #f0c76a;
  --amber: #e0a849;
  --amber-ink: #775215;
  --red: #b33f52;
  --line: var(--control-border);
  --soft-text: var(--muted);
  --shadow: #d4cedc;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
html[data-palette="autumn"] {
  --canvas: #f7f5f2;
  --surface: #fff;
  --surface-muted: #f3efea;
  --ink: #292622;
  --muted: #70685f;
  --accent: #a34d2f;
  --accent-hover: #863c24;
  --accent-soft: #f6e9e1;
  --border: #e5dfd7;
  --control-border: #a99e91;
  --mint: #dcc5ac;
  --lime: #f2cb72;
  --amber: #d99a37;
  --red: #b03e36;
  --shadow: #d5cfc7;
}
html[data-palette="moonlight"] {
  --canvas: #171b24;
  --surface: #222833;
  --surface-muted: #2b3340;
  --ink: #f4f5f7;
  --muted: #b6c0ce;
  --accent: #9adbe3;
  --accent-hover: #b6ebf0;
  --accent-soft: #33464e;
  --on-accent: #18292f;
  --border: #3b4553;
  --control-border: #7d8d9f;
  --glass: rgba(34,40,51,.95);
  --mint: #a3cbd2;
  --lime: #d0e8e8;
  --amber: #d8b574;
  --amber-ink: #ebca91;
  --red: #ff9b9e;
  --shadow: #11151e;
  color-scheme: dark;
}
html, body { background: var(--canvas); }
body { font: 400 1rem/1.5 var(--ui); -webkit-font-smoothing: antialiased; }
button, input, textarea, summary { font-family: var(--ui); -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
svg { stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { font-family: var(--ui); letter-spacing: -.025em; }
.page-shell { width: min(1280px, calc(100% - 80px)); min-height: 100vh; margin: 0 auto; overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
main { padding: 0; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 1000; padding: 12px 20px; color: var(--on-accent); background: var(--accent); border-radius: 12px; }
.skip-link:focus { top: 12px; }
.utility-bar { min-height: 100px; flex-wrap: nowrap; gap: 24px; padding: 22px 0; border: 0; border-bottom: 1px solid var(--border); color: var(--ink); background: transparent; }
.brand-lockup { color: var(--ink); gap: 12px; min-width: 0; flex-shrink: 1; }
.brand-lockup > span:last-child { min-width: 0; }
.brand-mark { width: 48px; height: 48px; border: 0; border-radius: 15px; background: var(--accent-soft); box-shadow: none; overflow: hidden; }
.brand-mark img { width: 58px; height: 58px; transform: translateY(7px); }
.brand-lockup strong { font: 650 1.1rem/1.25 var(--ui); letter-spacing: -.025em; overflow-wrap: anywhere; }
.brand-lockup small { display: block; color: var(--muted); font: 500 .75rem/1.3 var(--ui); letter-spacing: .02em; }
.header-tools { width: auto; gap: 12px; min-width: 0; flex-shrink: 0; }
.icon-button, .appearance-menu summary { min-width: 44px; width: 44px; height: 44px; min-height: 44px; border: 1px solid var(--border); border-radius: 50%; color: var(--ink); background: var(--surface); box-shadow: none; }
.icon-button svg { width: 19px; height: 19px; }
.sound-toggle[aria-pressed="false"] { color: var(--muted); }
.sound-toggle[data-playing="true"]::after { background: var(--accent); box-shadow: 0 0 0 3px var(--surface); }
.appearance-menu { position: relative; z-index: 30; }
.appearance-menu summary { display: flex; align-items: center; justify-content: center; gap: 8px; width: auto; padding: 0 14px; border-radius: 24px; font-size: .8125rem; font-weight: 550; list-style: none; cursor: pointer; }
.appearance-menu summary::-webkit-details-marker { display: none; }
.appearance-menu summary svg { width: 18px; height: 18px; }
.appearance-panel { position: absolute; top: calc(100% + 12px); right: 0; width: 320px; max-height: calc(100dvh - 100px); overflow-y: auto; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 16px 48px #0002; }
.appearance-panel > strong { font-size: 1.0625rem; font-weight: 650; }
.appearance-panel > p { margin: 4px 0 16px; color: var(--muted); font-size: .8125rem; }
.palette-picker { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,4.5rem),1fr)); gap: 6px; padding: 0; background: transparent; }
.palette-picker button span { display: block; }
.palette-picker button { display: flex; flex-direction: column; gap: 8px; width: 100%; height: auto; min-height: 76px; padding: 10px 3px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); background: var(--surface); font: 500 .75rem/1.3 var(--ui); }
.palette-picker button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border: 2px solid var(--accent); padding: 9px 2px; box-shadow: none; }
.palette-swatch { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px #0001; }
.swatch-autumn { background: linear-gradient(135deg,#fff 0 50%,#b96843 50%); }
.swatch-galaxy { background: linear-gradient(135deg,#eee7f7 0 50%,#7855a8 50%); }
.swatch-moonlight { background: linear-gradient(135deg,#222833 0 50%,#9adbe3 50%); }
.effects-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); cursor: pointer; }
.effects-option span { display: grid; gap: 4px; }
.effects-option strong { font-size: .875rem; font-weight: 600; }
.effects-option small { color: var(--muted); font-size: .75rem; line-height: 1.5; }
.effects-option input { appearance: none; flex: 0 0 44px; width: 44px; height: 28px; margin: 8px 0; border: 1px solid var(--control-border); border-radius: 999px; background: var(--surface-muted); cursor: pointer; }
.effects-option input::before { content: ""; display: block; width: 20px; height: 20px; margin: 3px; background: var(--muted); border-radius: 50%; transition: transform 160ms var(--ease); }
.effects-option input:checked { background: var(--accent); border-color: var(--accent); }
.effects-option input:checked::before { transform: translateX(16px); background: var(--on-accent); }
.visitor-card { grid-template-columns: auto minmax(0,1fr) auto; min-width: 0; max-width: 310px; gap: 10px; padding: 0 0 0 18px; border-left: 1px solid var(--border); border-radius: 0; color: var(--ink); background: transparent; }
.visitor-card > svg { width: 18px; height: 18px; color: var(--accent); }
.visitor-copy { min-width: 0; }
.visitor-copy strong { display: block; max-width: 144px; color: var(--ink); font: 600 .8125rem/1.4 var(--ui); letter-spacing: 0; }
.visitor-copy span { color: var(--muted); font: 400 .6875rem/1.4 var(--ui); letter-spacing: .01em; }
.visitor-card .relationship-meter { display: none; }
.visitor-card .visitor-edit { min-width: 44px; min-height: 44px; height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--ink); background: var(--surface); }
.visitor-card .visitor-edit span { font: 600 .75rem/1.3 var(--ui); letter-spacing: 0; text-transform: lowercase; }
.visitor-edit span::first-letter { text-transform: uppercase; }
.welcome-row { display: flex; justify-content: space-between; align-items: center; gap: 32px; padding: 36px 0 28px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font: 600 .6875rem/1.4 var(--ui); letter-spacing: .12em; text-transform: uppercase; }
.welcome-copy h1 { margin: 0 0 10px; font: 620 clamp(1.9rem,2.65vw,2.65rem)/1.12 var(--ui); letter-spacing: -.045em; }
.welcome-copy > p:last-child { margin: 0; color: var(--muted); font-size: .9375rem; line-height: 1.5; }
.status-bar { flex: 0 1 330px; min-width: 0; min-height: 66px; margin: 0; padding: 10px 12px; gap: 10px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.status-bar.status-attention { background: var(--surface); }
.status-bar.status-urgent { color: var(--ink); background: var(--surface); border-color: var(--red); }
.alert-icon { width: 30px; height: 30px; color: var(--accent); background: var(--accent-soft); border-radius: 50%; }
.status-urgent .alert-icon { color: var(--red); }
.alert-copy strong { color: var(--ink); font: 600 .8125rem/1.4 var(--ui); letter-spacing: 0; }
.alert-copy > span, .status-urgent .alert-copy > span { display: block; color: var(--muted); font: 400 .75rem/1.5 var(--ui); }
.visits-today { font-size: .75rem; }
.welcome-row .visits-today { display: none; }
.care-alert-action { color: var(--accent); background: var(--accent-soft); border: 0; }
.habitat-card { grid-template-columns: minmax(0,1fr) 300px; grid-template-rows: auto 1fr auto; overflow: hidden; border: 1px solid var(--border); border-radius: 26px; background: var(--surface); box-shadow: 0 8px 30px #1c171207; }
.room-toolbar { grid-column: 1; grid-row: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--surface); }
.room-toolbar .scene-label { position: static; display: flex; align-items: center; justify-content: flex-start; width: auto; height: auto; gap: 8px; padding: 0; color: var(--ink); border: 0; border-radius: 0; background: transparent; font: 600 .8125rem/1.3 var(--ui); letter-spacing: -.01em; white-space: normal; }
.room-toolbar #sceneName { display: inline; }
.scene-label .status-light { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: #648c64; box-shadow: none; }
.room-toolbar .environment-picker { position: static; display: flex; gap: 2px; padding: 4px; border: 0; border-radius: 16px; background: var(--surface-muted); box-shadow: none; backdrop-filter: none; }
.environment-picker button { display: flex; flex-direction: column; justify-content: center; gap: 3px; width: 3.25rem; height: auto; min-width: 44px; min-height: 3rem; padding: 5px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; }
.environment-picker button span { font: 500 .625rem/1.3 var(--ui); }
.environment-picker button svg { width: 18px; height: 18px; }
.environment-picker button[aria-pressed="true"] { color: var(--accent); background: var(--surface); box-shadow: 0 1px 5px #0001; }
.pet-stage { grid-column: 1; grid-row: 2; min-height: 465px; aspect-ratio: 1.5; border: 0; overflow: hidden; }
.care-sidebar { grid-column: 2; grid-row: 1 / 4; min-width: 0; padding: 28px 24px 20px; border-left: 1px solid var(--border); }
.care-sidebar-heading h2 { margin: 0 0 24px; font: 650 1.1875rem/1.35 var(--ui); letter-spacing: -.025em; }
#meterList { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 0 0 26px; background: transparent; }
#meterList .meter-row { grid-template-columns: 20px 1fr auto; grid-template-rows: auto 4px; align-items: center; gap: 6px 8px; color: var(--ink); text-align: left; }
#meterList .meter-icon { grid-column: 1; grid-row: 1; color: var(--muted); }
#meterList .meter-icon svg { width: 17px; height: 17px; }
#meterList .meter-label { grid-column: 2; grid-row: 1; color: var(--muted); font: 450 .8125rem/1.4 var(--ui); }
#meterList .meter-value { grid-column: 3; grid-row: 1; color: var(--ink); font: 600 .8125rem/1.4 var(--ui); }
#meterList .meter-track { grid-column: 2 / 4; grid-row: 2; height: 4px; margin: 0; background: var(--surface-muted); }
.meter-fill { background: var(--accent); }
.meter-fill.low { background: var(--red); }
.care-console { padding: 0; background: transparent; }
.care-console-head { min-height: 48px; margin: 0 0 14px; padding: 20px 0 0; border-top: 1px solid var(--border); }
.care-console-title { font: 600 .9375rem/1.4 var(--ui); letter-spacing: -.01em; color: var(--ink); }
.care-console-title svg { display: none; }
.care-console .kb-balance { gap: 5px; padding: 5px 8px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: .75rem; }
.kb-balance svg { width: 14px; height: 14px; }
.care-console .kb-balance small { color: inherit; font-size: .625rem; }
#actionGrid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
#actionGrid .action-button { min-height: 65px; gap: 6px; padding: 10px 8px; border: 1px solid var(--border); border-radius: 14px; color: var(--ink); background: var(--surface); font: 550 .8125rem/1.3 var(--ui); transition: transform 100ms var(--ease), background 160ms var(--ease); }
#actionGrid .action-button svg { width: 21px; height: 21px; color: var(--accent); }
#actionGrid .action-button.primary, #actionGrid .action-button.nap-ready { color: var(--on-accent); background: var(--accent); border-color: var(--accent); box-shadow: none; }
#actionGrid .action-button.primary svg, #actionGrid .action-button.nap-ready svg { color: inherit; }
#actionGrid .action-button:disabled { opacity: .45; }
.care-console .system-message { min-height: 20px; margin: 14px 0 0; color: var(--muted); font: 400 .75rem/1.5 var(--ui); overflow-wrap: anywhere; }
.mystery-launch { grid-column: 1; grid-row: 3; width: 100%; min-height: 92px; margin: 0; padding: 20px 24px; gap: 14px; border: 0; border-top: 1px solid var(--border); border-radius: 0; color: var(--ink); background: var(--surface); }
.mystery-launch > svg { width: 36px; height: 36px; padding: 9px; color: var(--accent); background: var(--accent-soft); border-radius: 12px; }
.mystery-launch .case-label { margin: 0; color: var(--muted); font: 550 .625rem/1.4 var(--ui); letter-spacing: .1em; }
.mystery-launch strong { font: 600 .9375rem/1.4 var(--ui); letter-spacing: -.01em; }
.mystery-launch small { font: 450 .6875rem/1.3 var(--ui); letter-spacing: .02em; }
.mystery-launch .case-action { color: var(--accent); font: 550 .8125rem/1.4 var(--ui); }
.case-action::after { content: "›"; margin-left: 8px; font-size: 1.1rem; }
.cat-readout { right: 16px; bottom: 16px; left: 16px; min-height: 66px; padding: 10px 12px 10px 16px; gap: 12px; border: 1px solid #ffffff38; border-radius: 18px; color: #fff; background: #292723; box-shadow: 0 5px 24px #0002; backdrop-filter: none; }
.cat-readout h2 { margin: 0 0 3px; color: #fff; font: 650 1.125rem/1.25 var(--ui); letter-spacing: -.025em; }
.cat-readout .mood-value { color: #e1ddd7; font: 400 .75rem/1.4 var(--ui); }
.chat-launch { min-height: 44px; max-width: 65%; padding: 10px 16px; gap: 8px; border: 0; border-radius: 999px; color: #2c261c; background: #f4d58e; box-shadow: none; }
.chat-launch span { font: 600 .8125rem/1.3 var(--ui); }
.chat-launch svg { width: 18px; height: 18px; }
.pet-bowls { bottom: 94px; }
.bowl-value { padding: 4px 6px; color: #322c25; background: #fff7e5; border: 0; box-shadow: 0 2px 6px #0001; border-radius: 999px; font: 600 .625rem/1.3 var(--ui); }
.kevin-thought { max-width: min(300px,calc(100% - 32px)); padding: 13px 16px; color: #292622; border-width: 1px; border-color: #bfb7ad; border-radius: 18px; background: #fffdf8; box-shadow: 0 8px 24px #0002; font: 450 .875rem/1.5 var(--ui); overflow-wrap: anywhere; }
.kevin-thought::before { border-top-color: #bfb7ad; }
.kevin-thought::after { border-top-color: #fffdf8; }
.kevin-thought.thought-pop { animation: apple-thought-in 220ms var(--ease); }
.kevin-thought.thought-exit { animation: apple-thought-out 220ms ease forwards; }
@keyframes apple-thought-in { from { opacity: 0; transform: translateX(-50%) translateY(5px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes apple-thought-out { to { opacity: 0; transform: translateX(-50%) translateY(-4px); } }
.module-deck { margin-top: 34px; }
.module-section-heading { display: flex; align-items: baseline; gap: 16px; margin: 0 0 14px; }
.module-section-heading h2 { margin: 0; font: 650 1.25rem/1.4 var(--ui); letter-spacing: -.025em; }
.module-section-heading p { margin: 0; color: var(--muted); font-size: .8125rem; }
.module-tabs { gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.module-tabs button { min-height: 50px; gap: 10px; border: 0; border-radius: 12px; color: var(--muted); font: 550 .875rem/1.4 var(--ui); }
.module-tabs button svg { width: 19px; height: 19px; }
.module-tabs button[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); border: 0; }
.module-panel { margin-top: 12px; padding: 28px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: none; }
.module-heading { gap: 12px; margin-bottom: 24px; }
.module-heading > svg { width: 24px; height: 24px; color: var(--accent); }
.module-heading > div { min-width: 0; }
.module-heading span { font: 550 .6875rem/1.5 var(--ui); color: var(--muted); letter-spacing: .08em; }
.module-heading h2 { font: 650 1.35rem/1.35 var(--ui); letter-spacing: -.025em; }
.module-heading > b, .module-heading > p { font-size: .875rem; }
.poll-option { min-height: 70px; border: 1px solid var(--control-border); border-radius: 14px; background: var(--surface-muted); font: 500 .875rem/1.5 var(--ui); }
.poll-fill { background: var(--accent-soft); }
.poll-total { font-size: .8125rem; }
.shop-grid { gap: 12px; }
.shop-item { padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-muted); }
.shop-item h3 { font: 600 .9375rem/1.4 var(--ui); letter-spacing: -.015em; }
.shop-item p { color: var(--muted); font: 400 .8125rem/1.5 var(--ui); }
.shop-item button { min-height: 44px; border: 1px solid var(--control-border); border-radius: 10px; color: var(--accent); background: var(--surface); box-shadow: none; font: 600 .8125rem/1.4 var(--ui); }
.shop-item button:disabled { opacity: .55; }
.achievement { padding: 14px; gap: 10px; border-bottom: 1px solid var(--border); }
.achievement strong { font: 600 .875rem/1.4 var(--ui); }
.achievement small { color: var(--muted); font: 400 .75rem/1.5 var(--ui); }
.achievement-progress { font-size: .75rem; }
.achievement-mark { color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 50%; }
.career-body { padding: 20px; border-radius: 16px; background: var(--surface-muted); }
.career-body p { font-size: .875rem; line-height: 1.6; }
.badge-photo { background: var(--accent-soft); }
.activity-log li { padding: 14px 0; border-color: var(--border); font-size: .875rem; line-height: 1.5; }
.activity-log time { font-size: .75rem; }
footer { min-height: 80px; margin-top: 24px; padding: 24px 0 max(24px,env(safe-area-inset-bottom)); border: 0; color: var(--muted); background: transparent; font: 400 .75rem/1.5 var(--ui); }
footer span { gap: 8px; }
footer span strong { color: var(--muted); font-weight: 550; }
footer span small { display: inline; padding-left: 8px; border-color: var(--border); font-size: .6875rem; }
.toast { max-width: min(440px,calc(100% - 32px)); padding: 14px 20px; border: 1px solid var(--border); border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: 0 8px 32px #0002; font: 500 .875rem/1.5 var(--ui); }
.system-dialog { max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border); border-radius: 24px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 100px #0004; }
.system-dialog::backdrop { background: #16191e66; backdrop-filter: blur(5px); }
.dialog-head { min-height: 68px; gap: 10px; padding: 12px 16px 12px 24px; color: var(--ink); background: var(--surface); border-bottom: 1px solid var(--border); font: 600 .875rem/1.4 var(--ui); letter-spacing: -.01em; }
.dialog-head > span { min-width: 0; overflow-wrap: anywhere; }
.dialog-head button { flex-shrink: 0; width: 44px; height: 44px; min-height: 44px; border: 0; border-radius: 50%; color: var(--muted); background: var(--surface-muted); }
.dialog-head button svg { width: 18px; height: 18px; }
.dialog-body { padding: 28px; }
.dialog-body h2 { color: var(--ink); font: 650 1.65rem/1.2 var(--ui); letter-spacing: -.035em; }
.dialog-body p { color: var(--muted); font-size: .9375rem; line-height: 1.6; }
.dialog-button, .equipment-option { min-height: 48px; padding: 12px 20px; border: 0; border-radius: 12px; color: var(--on-accent); background: var(--accent); box-shadow: none; font: 600 .9375rem/1.4 var(--ui); }
.equipment-option { color: var(--ink); background: var(--surface-muted); border: 1px solid var(--border); }
.equipment-option.active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.visitor-dialog { width: 460px; }
.visitor-dialog form { max-height: calc(100dvh - 34px); }
.visitor-dialog .dialog-body { padding: 26px 30px; }
.visitor-dialog .visitor-dialog-hero img { width: 96px; height: 96px; }
.visitor-dialog .visitor-dialog-hero h2 { font: 650 1.75rem/1.2 var(--ui); letter-spacing: -.035em; }
.visitor-dialog .visitor-dialog-hero p { font-weight: 400; font-size: .875rem; }
.visitor-dialog input:not([type="checkbox"]), .account-password { color: var(--ink); background: var(--surface); border: 1px solid var(--control-border); border-radius: 12px; }
.visitor-dialog .account-password input { border: 0; background: transparent; }
.account-password button { color: var(--accent); }
.visitor-dialog .visitor-field { font-weight: 550; }
.account-tabs { gap: 4px; padding: 4px; border-radius: 13px; background: var(--surface-muted); }
.account-tabs button { border-radius: 9px; font-weight: 550; }
.account-tabs button[aria-pressed="true"] { background: var(--surface); }
.account-text-button { color: var(--accent); font-weight: 500; }
.visitor-dialog .visitor-skip { color: var(--muted); background: transparent; border: 0; box-shadow: none; border-radius: 12px; }
.visitor-dialog .visitor-permission { border: 0; padding: 0; }
.visitor-dialog .visitor-consent { color: var(--ink); line-height: 1.5; }
.visitor-dialog input[type="checkbox"] { accent-color: var(--accent); }
.visitor-dialog .visitor-privacy { color: var(--muted); }
.account-email, #accountRecoveryCode { background: var(--surface-muted); color: var(--ink); border-radius: 12px; }
.account-secondary { border-color: var(--control-border); border-radius: 12px; }
.chat-dialog { width: 580px; overflow-y: auto; }
.chat-dialog[open] { display: flex; flex-direction: column; }
.chat-dialog > * { flex-shrink: 0; }
.dialog-head .notebook-open { width: auto; padding: 10px 12px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font: 500 .75rem/1.4 var(--ui); }
.chat-status { padding: 10px 24px; border: 0; background: var(--surface); font: 450 .625rem/1.4 var(--ui); }
.chat-status strong { color: var(--muted); font: 550 .6875rem/1.4 var(--ui); }
.chat-status .status-light { width: 6px; height: 6px; background: #649b75; border-radius: 50%; box-shadow: none; }
.chat-take { padding: 14px 24px; border-color: var(--border); background: var(--accent-soft); }
.chat-take span { color: var(--accent); font-size: .625rem; }
.chat-take p { font: 450 .8125rem/1.5 var(--ui); }
.chat-messages { flex: 1 1 auto; min-height: 160px; max-height: 40dvh; gap: 18px; padding: 24px; background: var(--surface-muted); }
.chat-message { max-width: 88%; gap: 6px; }
.chat-message span { font: 500 .625rem/1.4 var(--ui); }
.chat-message p { padding: 12px 16px; border: 0; border-radius: 18px 18px 18px 5px; color: var(--ink); background: var(--surface); box-shadow: none; font: 400 .9375rem/1.55 var(--ui); overflow-wrap: anywhere; }
.chat-message.user p { color: var(--on-accent); background: var(--accent); border-radius: 18px 18px 5px 18px; }
.chat-prompts { flex-wrap: wrap; gap: 6px; padding: 14px 20px 4px; overflow: visible; }
.chat-prompts button { min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); font: 500 .75rem/1.4 var(--ui); }
.chat-form { grid-template-columns: minmax(0,1fr) 48px; padding: 12px 20px; gap: 8px; }
.chat-form input { min-height: 48px; padding: 12px 14px; border: 1px solid var(--control-border); border-radius: 14px; color: var(--ink); background: var(--surface); font: 400 1rem/1.4 var(--ui); }
.chat-form button { min-height: 48px; color: var(--on-accent); background: var(--accent); border-radius: 14px; }
.chat-privacy { padding: 0 24px 20px; color: var(--muted); font: 400 .6875rem/1.5 var(--ui); text-align: left; }
.chat-sleep-gate { padding: 12px 24px; border: 0; background: var(--accent-soft); font: 450 .8125rem/1.5 var(--ui); }
.chat-sleep-gate button { min-height: 44px; padding: 10px 14px; border: 0; border-radius: 999px; color: var(--on-accent); background: var(--accent); font: 600 .8125rem/1.4 var(--ui); }
.notebook-dialog, .mystery-dialog { overflow-y: auto; }
.notebook-body, .mystery-content { padding: 28px; font-size: .9375rem; line-height: 1.65; }
.notebook-body textarea { padding: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--control-border); border-radius: 14px; }
.notebook-body button { border: 1px solid var(--border); border-radius: 12px; color: var(--accent); background: var(--accent-soft); }
.notebook-body section { border-color: var(--border); }
.mystery-clues li { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-muted); }
.mystery-choices button { border: 1px solid var(--control-border); border-radius: 12px; background: var(--surface); font-weight: 500; }
.mystery-choices button.correct-choice { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.mystery-reveal { border-color: var(--accent); border-radius: 0 12px 12px 0; background: var(--accent-soft); }
.mischief-skip { min-width: 60px; min-height: 44px; border-radius: 999px; font-family: var(--ui); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cat-readout { background: rgba(35,33,30,.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
}
@media (hover:hover) and (pointer:fine) {
  .icon-button:hover, .appearance-menu summary:hover, .visitor-card .visitor-edit:hover { color: var(--accent); border-color: var(--control-border); background: var(--surface-muted); }
  #actionGrid .action-button:hover:not(:disabled) { color: var(--ink); border-color: var(--control-border); background: var(--surface-muted); outline: none; transform: translateY(-1px); }
  #actionGrid .action-button.primary:hover:not(:disabled), #actionGrid .action-button.nap-ready:hover:not(:disabled) { color: var(--on-accent); background: var(--accent-hover); border-color: var(--accent-hover); }
  .module-tabs button:hover, .environment-picker button:hover, .palette-picker button:hover { color: var(--accent); background: var(--accent-soft); }
  .chat-launch:hover { background: #ffe2a4; outline: none; transform: none; }
  .mystery-launch:hover { background: var(--surface-muted); }
}
:is(button,a,input,select,textarea,summary,[tabindex]):focus-visible,
#actionGrid .action-button:focus-visible:not(:disabled), .visitor-dialog button:focus-visible,
.visitor-dialog input:focus-visible, .mystery-dialog button:focus-visible,
.module-tabs button:focus-visible, .environment-picker button:focus-visible,
.palette-picker button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.pet-stage :is(button,[tabindex]):focus-visible { outline-color: #ffda84; }
#actionGrid .action-button:focus-visible:not(:disabled) { color: var(--ink); background: var(--surface-muted); }
#actionGrid .action-button.primary:focus-visible:not(:disabled), #actionGrid .action-button.nap-ready:focus-visible:not(:disabled) { color: var(--on-accent); background: var(--accent); }
#actionGrid .action-button:active:not(:disabled), .module-tabs button:active { transform: scale(.975); }
@media (max-width:1100px) {
  .page-shell { width: calc(100% - 48px); }
  .visitor-card > svg { display: none; }
  .visitor-card { grid-template-columns: minmax(0,1fr) auto; }
  .visitor-copy strong { max-width: 100px; }
  .habitat-card { grid-template-columns: minmax(0,1fr) 270px; }
  .care-sidebar { padding: 24px 18px 18px; }
  .room-toolbar { flex-wrap: wrap; padding: 14px 16px; gap: 10px; }
  .room-toolbar .environment-picker { margin-left: auto; }
  .pet-stage { min-height: 470px; }
  .status-bar { flex-basis: 290px; }
}
@media (max-width:840px) {
  .page-shell { width: calc(100% - 40px); }
  .visitor-copy { display: none; }
  .visitor-card { grid-template-columns: auto; padding-left: 12px; }
  .welcome-row { display: block; padding: 28px 0 22px; }
  .welcome-copy h1 { font-size: 2rem; }
  .status-bar { margin-top: 18px; min-height: 60px; }
  .habitat-card { grid-template-columns: minmax(0,1fr); grid-template-rows: auto auto auto auto; border-radius: 22px; }
  .room-toolbar { grid-row: 1; }
  .pet-stage { grid-row: 2; min-height: 440px; aspect-ratio: 1.4; }
  .care-sidebar { grid-column: 1; grid-row: 3; padding: 22px 20px 12px; border-left: 0; border-top: 1px solid var(--border); }
  .care-sidebar-heading { display: none; }
  #meterList { grid-template-columns: repeat(auto-fit,minmax(min(100%,2.6rem),1fr)); gap: 12px; padding: 0 0 22px; }
  #meterList .meter-row { grid-template-columns: minmax(0,1fr); grid-template-rows: 18px auto auto 4px; text-align: center; gap: 5px; }
  #meterList .meter-icon { grid-column: 1; grid-row: 1; }
  #meterList .meter-label { grid-column: 1; grid-row: 2; }
  #meterList .meter-value { grid-column: 1; grid-row: 3; }
  #meterList .meter-track { grid-column: 1; grid-row: 4; }
  #actionGrid { grid-template-columns: repeat(auto-fit,minmax(min(100%,4rem),1fr)); }
  #actionGrid .action-button { min-height: 68px; }
  .mystery-launch { grid-row: 4; padding: 20px; }
  .room-toolbar { flex-wrap: nowrap; }
  .shop-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width:600px) {
  .page-shell { width: calc(100% - 32px); }
  .utility-bar { min-height: 80px; padding: 16px 0; gap: 10px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 13px; }
  .brand-mark img { width: 50px; height: 50px; }
  .brand-lockup strong { font-size: .9375rem; }
  .brand-lockup small { font-size: .625rem; }
  .header-tools { gap: 5px; }
  .appearance-menu summary { width: 44px; padding: 0; }
  .appearance-menu summary > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .appearance-panel { position: fixed; top: 76px; right: 16px; width: min(320px,calc(100vw - 32px)); }
  .visitor-card { border: 0; padding: 0; }
  .visitor-card .visitor-edit { padding: 0; width: 44px; }
  .visitor-card .visitor-edit span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .visitor-card .visitor-edit svg { width: 18px; height: 18px; }
  .welcome-row { padding: 26px 0 20px; }
  .welcome-copy .eyebrow { font-size: .625rem; }
  .welcome-copy h1 { font-size: clamp(1.65rem,7vw,2.1rem); }
  .welcome-copy > p:last-child { font-size: .8125rem; }
  .status-bar { padding: 9px 10px; gap: 9px; border-radius: 16px; }
  .alert-copy > span { font-size: .75rem; }
  .room-toolbar { flex-wrap: wrap; padding: 16px 12px 12px; gap: 12px; }
  .room-toolbar .scene-label { width: 100%; padding-left: 4px; }
  .room-toolbar .environment-picker { width: 100%; margin: 0; display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,2.75rem),1fr)); }
  .environment-picker button { width: 100%; min-width: 0; height: auto; min-height: 3rem; }
  .environment-picker button span { font-size: .625rem; }
  .pet-stage { min-height: 410px; aspect-ratio: auto; }
  .cat-readout { left: 10px; right: 10px; bottom: 10px; gap: 10px; min-height: 62px; padding: 10px 10px 10px 12px; border-radius: 16px; }
  .cat-readout h2 { font-size: 1rem; }
  .cat-readout .mood-value { font-size: .6875rem; }
  .chat-launch { max-width: 52%; padding: 10px 12px; gap: 6px; }
  .chat-launch span { font-size: .75rem; }
  .chat-launch svg { width: 16px; height: 16px; }
  .pet-bowls { bottom: 86px; }
  .bowl-value { font-size: .5625rem; }
  .kevin-thought { max-width: min(250px,calc(100% - 24px)); padding: 10px 13px; font-size: .8125rem; }
  .care-sidebar { padding: 22px 14px 10px; }
  #meterList { gap: 10px; }
  #meterList .meter-label, #meterList .meter-value { font-size: .75rem; }
  #actionGrid .action-button { min-height: 65px; font-size: .75rem; border-radius: 12px; }
  .care-console-head { margin-bottom: 12px; padding-top: 16px; }
  .care-console .system-message { margin-top: 12px; }
  .mystery-launch { min-height: 92px; padding: 18px 16px; gap: 12px; }
  .mystery-launch .case-action { display: none; }
  .mystery-launch strong { font-size: .875rem; }
  .module-deck { margin-top: 28px; }
  .module-section-heading { display: block; margin-bottom: 14px; }
  .module-section-heading h2 { font-size: 1.125rem; }
  .module-section-heading p { margin-top: 4px; font-size: .75rem; }
  .module-tabs { grid-template-columns: repeat(auto-fit,minmax(min(100%,4rem),1fr)); gap: 3px; padding: 5px; }
  .module-tabs button { min-width: 0; min-height: 64px; flex-direction: column; gap: 6px; padding: 8px 3px; font-size: .625rem; }
  .module-tabs button svg { width: 20px; height: 20px; }
  .module-panel { padding: 20px 16px; }
  .module-heading h2 { font-size: 1.125rem; }
  .poll-options, .records-grid { grid-template-columns: 1fr; }
  .shop-item { padding: 14px; }
  .shop-item h3 { font-size: .875rem; }
  footer { margin-top: 12px; gap: 10px; flex-wrap: wrap; font-size: .6875rem; }
  footer span small { font-size: .625rem; }
  .system-dialog { max-width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 22px; }
  .visitor-dialog form { max-height: calc(100dvh - 22px); }
  .visitor-dialog .dialog-body, .notebook-body, .mystery-content { padding: 22px; }
  .dialog-head { padding: 12px 14px 12px 20px; gap: 8px; font-size: .8125rem; }
  .dialog-head .notebook-open { padding: 8px 10px; font-size: .6875rem; }
  .chat-messages { padding: 18px; min-height: 120px; max-height: 38dvh; }
  .chat-message p { font-size: .875rem; }
  .chat-status, .chat-take, .chat-sleep-gate { padding-inline: 20px; }
  .chat-prompts { padding-inline: 16px; }
  .chat-prompts button { font-size: .6875rem; padding: 8px 10px; }
  .chat-form { padding-inline: 16px; }
  .chat-privacy { padding-inline: 20px; font-size: .625rem; }
}
@media (max-width:360px) {
  .page-shell { width: calc(100% - 24px); }
  .brand-mark { display: none; }
  .pet-stage { min-height: 400px; }
  .chat-launch svg { display: none; }
  .chat-launch { padding-inline: 10px; }
  #actionGrid { gap: 6px; }
  .module-tabs button { font-size: .5625rem; }
}
@media (max-height:650px) {
  .system-dialog { overflow-y: auto; }
  .chat-messages { min-height: 100px; max-height: 32dvh; }
  .chat-privacy { padding-bottom: 12px; }
}
html[data-effects="reduced"] *, html[data-effects="reduced"] *::before, html[data-effects="reduced"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
html[data-effects="reduced"] .cat-readout { background: #292723; backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-effects="reduced"] .system-dialog::backdrop { backdrop-filter: none; }
html[data-effects="reduced"] .kevin-thought.thought-pop { transform: translateX(-50%); }
html[data-effects="reduced"] #actionGrid .action-button:active { transform: none; }
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .kevin-thought.thought-pop, .kevin-thought.thought-exit { animation: none; }
  #actionGrid .action-button, .effects-option input::before { transition: none; }
}
@media (prefers-reduced-transparency:reduce), (prefers-contrast:more) {
  .cat-readout { background: #292723; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .system-dialog::backdrop { backdrop-filter: none; }
  .habitat-card, .module-tabs, .module-panel, #actionGrid .action-button { border-color: var(--control-border); }
}
@media (forced-colors:active) {
  .page-shell, .habitat-card, .care-sidebar, .system-dialog, .appearance-panel, .module-panel { color: CanvasText; background: Canvas; border: 1px solid CanvasText; }
  button, .icon-button, .appearance-menu summary, #actionGrid .action-button { border: 1px solid ButtonText; color: ButtonText; background: ButtonFace; }
  :is(button,a,input,textarea,summary):focus-visible { outline-color: Highlight; }
  .meter-fill { background: Highlight; }
}

/* Focused room layout: the scene leads; supporting controls open on demand. */
.utility-bar { min-height: 84px; padding: 18px 0; margin-bottom: 16px; border: 0; gap: 20px; }
.brand-lockup { gap: 10px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.brand-mark img { width: 50px; height: 50px; }
.brand-lockup h1 { margin: 0; font: 650 1.0625rem/1.25 var(--ui); letter-spacing: -.025em; }
.header-tools { gap: 8px; }
.appearance-menu summary { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.appearance-menu summary svg { width: 21px; height: 21px; }
.visitor-card { display: block; width: auto; max-width: none; padding: 0; border: 0; }
.visitor-card .visitor-edit { gap: 8px; width: auto; padding: 0 14px; border-color: var(--border); background: var(--surface); }
.visitor-card .visitor-edit svg { display: block; width: 18px; height: 18px; }
.appearance-panel { width: 340px; padding: 24px; border-radius: 20px; max-height: calc(100dvh - 100px); }
.appearance-panel h2 { margin: 0 0 22px; font: 650 1.25rem/1.25 var(--ui); letter-spacing: -.025em; }
.settings-section + .settings-section { margin-top: 24px; }
.settings-section h3 { margin: 0 0 12px; font: 600 .8125rem/1.5 var(--ui); letter-spacing: 0; }
.settings-section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.settings-section-heading #sceneName { color: var(--muted); font-size: .6875rem; }
.appearance-panel .environment-picker { position: static; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.appearance-panel .environment-picker button { width: 100%; min-height: 46px; height: auto; padding: 10px; flex-direction: row; justify-content: flex-start; gap: 8px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); background: var(--surface); }
.appearance-panel .environment-picker button span { font: 500 .75rem/1.4 var(--ui); }
.appearance-panel .environment-picker button[data-environment="auto"] { grid-column: 1 / -1; }
.appearance-panel .environment-picker button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); box-shadow: none; }
.appearance-panel .palette-picker button { min-height: 68px; }
.settings-option, .effects-option { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.settings-option > span, .effects-option > span { display: grid; gap: 3px; }
.settings-option strong, .effects-option strong { font-size: .8125rem; font-weight: 600; }
.settings-option small, .effects-option small { color: var(--muted); font-size: .75rem; }
.settings-option .sound-toggle { flex-shrink: 0; color: var(--muted); background: var(--surface-muted); border: 0; }
.settings-option .sound-toggle[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.settings-option .sound-toggle[data-playing="true"]::after { display: none; }
.habitat-card { grid-template-columns: minmax(0,1fr); grid-template-rows: auto auto; border-radius: 24px; box-shadow: none; }
.pet-stage { grid-column: 1; grid-row: 1; width: 100%; min-width: 0; max-width: 100%; min-height: 0; height: clamp(380px,48vw,600px); aspect-ratio: auto; }
.care-sidebar { grid-column: 1; grid-row: 2; padding: 20px 24px 8px; border-left: 0; border-top: 1px solid var(--border); }
.pet-stage .scene-chat { position: absolute; z-index: 80; top: 16px; right: 16px; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; max-width: none; padding: 0; border: 1px solid #ffffff80; border-radius: 50%; color: #292622; background: #fffdf8ed; box-shadow: 0 2px 8px #0002; }
.pet-stage .scene-chat svg { display: block; width: 20px; height: 20px; }
.pet-stage .scene-chat::after { top: 2px; right: 2px; width: 6px; height: 6px; border: 1px solid #fffdf8; background: var(--accent); box-shadow: none; }
.pet-stage .scene-chat:focus-visible { outline: 3px solid #292622; outline-offset: 3px; }
#actionGrid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
#actionGrid .action-button { min-height: 68px; padding: 12px 8px; border-color: transparent; border-radius: 12px; background: var(--surface-muted); font-size: .8125rem; }
#actionGrid .action-button.primary, #actionGrid .action-button.nap-ready { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.care-disclosure { min-width: 0; }
.care-disclosure > summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 12px 0; color: var(--muted); font: 500 .8125rem/1.5 var(--ui); cursor: pointer; list-style: none; }
.care-disclosure > summary::-webkit-details-marker { display: none; }
.care-disclosure > summary > svg { width: 14px; height: 14px; flex-shrink: 0; margin-left: auto; transition: transform 160ms var(--ease); }
.care-disclosure[open] > summary > svg { transform: rotate(90deg); }
.wellbeing { margin-top: 16px; border-top: 1px solid var(--border); }
.care-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.care-status-dot[data-status="attention"] { background: var(--amber-ink); }
.care-status-dot[data-status="urgent"] { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb,var(--red) 12%,transparent); }
.wellbeing-body { padding: 8px 0 0; }
#meterList.scene-wellbeing { --wellbeing-ink: #35332f; position: absolute; z-index: 80; top: 16px; left: 16px; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); width: min(280px,calc(100% - 88px)); gap: 8px; margin: 0; padding: 8px 10px; border: 1px solid #ffffff80; border-radius: 16px; color: var(--wellbeing-ink); background: linear-gradient(135deg,#fffdf8d6,#fffdf8a8); box-shadow: 0 4px 18px #19212a14, inset 0 1px 0 #ffffff6b; backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); }
#meterList .meter-row { --meter-color: #946037; position: relative; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: 24px 3px; justify-items: center; align-items: center; gap: 5px; min-width: 0; padding: 0; border: 0; border-radius: 10px; text-align: center; }
#meterList [data-meter="affection"] { --meter-color: #aa4b73; }
#meterList [data-meter="enrichment"] { --meter-color: #477d5c; }
#meterList [data-meter="energy"] { --meter-color: #7761a5; }
#meterList [data-meter="hydration"] { --meter-color: #387eac; }
#meterList .meter-icon { position: relative; grid-column: 1; grid-row: 1; width: 24px; height: 24px; border-radius: 8px; color: var(--meter-color); background: color-mix(in srgb,var(--meter-color) 12%,transparent); }
#meterList .meter-icon svg { width: 16px; height: 16px; fill: color-mix(in srgb,var(--meter-color) 12%,transparent); stroke-width: 1.65; }
#meterList .meter-label { display: none; }
#meterList .meter-track { grid-column: 1; grid-row: 2; width: 100%; height: 3px; margin: 1px 0 0; padding: 0; border: 0; border-radius: 4px; background: color-mix(in srgb,var(--meter-color) 18%,transparent); }
#meterList .meter-fill { height: 100%; border-radius: inherit; background: var(--meter-color); transition: width 280ms var(--ease); }
#meterList .meter-warning { position: absolute; top: -3px; right: -3px; display: none; place-items: center; width: 12px; height: 12px; border: 1px solid #fffdf8; border-radius: 50%; color: #fff; background: #a93632; font: 750 9px/1 var(--ui); }
#meterList .meter-row.is-low { --meter-color: #a93632; }
#meterList .is-low .meter-warning { display: grid; }
#meterList .meter-detail { position: absolute; z-index: 1; top: calc(100% + 19px); left: 50%; display: none; align-items: center; gap: 8px; width: max-content; padding: 8px 10px; border: 1px solid #d6d1c9; border-radius: 10px; color: #35332f; background: #fffdf8; box-shadow: 0 3px 12px #0002; font: 500 .75rem/1.4 var(--ui); white-space: nowrap; transform: translateX(-50%); }
#meterList .meter-value { color: inherit; font: 650 .75rem/1.4 var(--ui); font-variant-numeric: tabular-nums; }
#meterList .meter-row:first-child .meter-detail { left: 0; transform: none; }
#meterList .meter-row:last-child .meter-detail { right: 0; left: auto; transform: none; }
#meterList .meter-row:focus { outline: 2px solid var(--wellbeing-ink); outline-offset: 5px; }
#meterList .meter-row:focus .meter-detail { display: flex; }
html[data-palette="moonlight"] #meterList.scene-wellbeing { --wellbeing-ink: #f2f4f7; border-color: #ffffff38; background: linear-gradient(135deg,#232c3bd6,#18212fb8); box-shadow: 0 4px 18px #0002, inset 0 1px 0 #ffffff12; }
html[data-palette="moonlight"] #meterList [data-meter="hunger"] { --meter-color: #edbc8f; }
html[data-palette="moonlight"] #meterList [data-meter="affection"] { --meter-color: #eca5bf; }
html[data-palette="moonlight"] #meterList [data-meter="enrichment"] { --meter-color: #9ed4ae; }
html[data-palette="moonlight"] #meterList [data-meter="energy"] { --meter-color: #c5b5ed; }
html[data-palette="moonlight"] #meterList [data-meter="hydration"] { --meter-color: #9acde9; }
html[data-palette="moonlight"] #meterList .meter-row.is-low { --meter-color: #ffaaa3; }
.wellbeing .status-bar { min-height: 0; margin: 0; padding: 12px 0 0; gap: 8px; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; }
.wellbeing .alert-icon, .wellbeing .visits-today { display: none; }
.wellbeing .alert-copy { flex: 1; min-width: 0; }
.wellbeing .alert-copy strong { font-size: .75rem; }
.wellbeing .alert-copy > span { font-size: .6875rem; }
.wellbeing .care-alert-action { flex-shrink: 0; width: 44px; height: 44px; }
.care-console .system-message { min-height: 0; margin: 12px 0 0; font-size: .75rem; }
.care-console .system-message:empty { display: none; }
.pet-stage .bowl-gauge, .pet-stage .bowl-value, .pet-stage .tree-level-lights, .pet-stage .fx-caption { display: none; }
.pet-stage .pet-bowls { bottom: 28px; }
#petStage > .kevin-thought { max-width: min(280px,calc(100% - 32px)); padding: 10px 14px; border-color: #bfb7ad; border-radius: 16px; color: #292622; background: #fffdf8; box-shadow: 0 3px 12px #0001; font: 450 .8125rem/1.45 var(--ui); }
#petStage > .kevin-thought::before { border-top-color: #bfb7ad; }
#petStage > .kevin-thought::after { border-top-color: #fffdf8; }
#petStage > .kevin-thought.tail-up::before { border-bottom-color: #bfb7ad; }
#petStage > .kevin-thought.tail-up::after { border-bottom-color: #fffdf8; }
.module-deck { margin-top: 24px; }
#dailyMysterySlot { margin-bottom: 12px; }
#dailyMysterySlot .mystery-launch { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 76px; margin: 0; padding: 16px 20px; gap: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
#dailyMysterySlot .mystery-launch > svg { width: 20px; height: 20px; padding: 0; flex-shrink: 0; color: var(--muted); background: transparent; border-radius: 0; }
#dailyMysterySlot .case-label { margin-bottom: 2px; color: var(--muted); font: 450 .6875rem/1.4 var(--ui); letter-spacing: 0; }
#dailyMysterySlot .mystery-launch strong { font: 550 .875rem/1.4 var(--ui); }
#dailyMysterySlot .mystery-launch small { display: none; }
#dailyMysterySlot .case-action { font-size: .75rem; }
.module-tabs { padding: 0; gap: 8px; border: 0; border-radius: 0; background: transparent; }
.module-tabs button { min-height: 48px; padding: 10px 12px; gap: 8px; border: 0; border-radius: 12px; color: var(--muted); font: 500 .8125rem/1.5 var(--ui); }
.module-tabs button svg { width: 18px; height: 18px; }
.shop-points { white-space: nowrap; color: var(--muted); font-size: .6875rem; }
.shop-points b { font-weight: 500; }
.shop-points small { font-size: inherit; }
.visitor-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 20px 0; padding: 16px; border-radius: 14px; background: var(--surface-muted); }
.visitor-summary[hidden] { display: none; }
.visitor-summary .visitor-copy { display: block; min-width: 0; }
.visitor-summary .visitor-copy strong { max-width: none; color: var(--ink); font: 600 .875rem/1.4 var(--ui); overflow-wrap: anywhere; }
.visitor-summary .visitor-copy span { font: 400 .6875rem/1.5 var(--ui); color: var(--muted); }
.visitor-summary .relationship-meter { display: flex; align-items: center; gap: 8px; flex: 0 0 90px; color: var(--accent); }
.visitor-summary .relationship-meter > div { width: 48px; height: 4px; background: var(--border); }
.visitor-summary .relationship-meter i { background: var(--accent); }
.visitor-summary .relationship-meter b { font: 550 .75rem/1.5 var(--ui); }
@media (hover:hover) and (pointer:fine) {
  #meterList .meter-row:hover .meter-detail { display: flex; }
  .care-disclosure > summary:hover { color: var(--ink); }
  .pet-stage .scene-chat:hover { color: #292622; background: #fffdf8; }
  #dailyMysterySlot .mystery-launch:hover { background: var(--surface-muted); }
}
@media (max-width:840px) {
  .pet-stage { height: auto; min-height: 380px; aspect-ratio: 1.4; }
  .care-sidebar { padding: 20px 22px 8px; }
}
@media (max-width:600px) {
  .page-shell { width: calc(100% - 24px); }
  .utility-bar { min-height: 72px; padding: 12px 4px; margin-bottom: 4px; gap: 12px; }
  .brand-lockup h1 { font-size: .9375rem; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .brand-mark img { width: 46px; height: 46px; }
  .header-tools { gap: 2px; }
  .visitor-card .visitor-edit { width: 44px; padding: 0; border: 0; background: transparent; }
  .appearance-panel { top: 68px; right: 12px; width: min(340px,calc(100vw - 24px)); max-height: calc(100dvh - 80px); padding: 22px; }
  .habitat-card { border-radius: 20px; }
  .pet-stage { min-height: 350px; aspect-ratio: 1.1; }
  .pet-stage .pet-bowls { bottom: 20px; }
  .care-sidebar { padding: 16px 16px 4px; }
  .pet-stage .scene-chat { top: 12px; right: 12px; }
  #meterList.scene-wellbeing { top: 12px; left: 12px; width: min(248px,calc(100% - 80px)); gap: 7px; padding: 8px 9px; border-radius: 14px; }
  #meterList .meter-row { grid-template-rows: 22px 3px; gap: 5px; }
  #meterList .meter-icon { width: 22px; height: 22px; border-radius: 7px; }
  #meterList .meter-icon svg { width: 15px; height: 15px; }
  #meterList .meter-label { display: none; }
  #meterList .meter-track { grid-row: 2; }
  #actionGrid .action-button { min-height: 64px; padding: 10px 4px; font-size: .75rem; }
  #petStage > .kevin-thought { max-width: min(245px,calc(100% - 28px)); font-size: .75rem; }
  .module-deck { margin-top: 18px; }
  #dailyMysterySlot .mystery-launch { min-height: 74px; padding: 14px 16px; gap: 12px; }
  #dailyMysterySlot .case-action { display: block; width: 16px; overflow: hidden; font-size: 0; }
  #dailyMysterySlot .case-action::after { margin-left: 0; font-size: 1.25rem; }
  .module-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
  .module-tabs button { flex-direction: row; min-height: 46px; padding: 10px 8px; gap: 8px; font-size: .75rem; }
  footer { min-height: 64px; margin-top: 16px; padding-top: 16px; }
}
@media (max-width:360px) {
  .brand-mark { display: none; }
  .pet-stage { min-height: 330px; }
}
@media (prefers-contrast:more) {
  .care-disclosure > summary, .appearance-panel .environment-picker button { color: var(--ink); }
}
/* Keep every care action visible as text grows. */
#actionGrid .action-button[hidden] { display: none !important; }
#actionGrid .action-button span { overflow-wrap: anywhere; }
#petStage > .kevin-thought { transform: translateX(-50%); }
.appearance-panel .environment-picker button span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width:840px) {
  #actionGrid { grid-template-columns: repeat(auto-fit,minmax(max(min(100%,3.1rem),calc((100% - 24px)/4)),1fr)); }
}
@media (prefers-reduced-transparency:reduce), (prefers-contrast:more) {
  #meterList.scene-wellbeing, html[data-palette="moonlight"] #meterList.scene-wellbeing { color: var(--ink); background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--control-border); }
}
@media (forced-colors:active) {
  #meterList.scene-wellbeing, html[data-palette="moonlight"] #meterList.scene-wellbeing { --wellbeing-ink: CanvasText; background: Canvas; border-color: CanvasText; backdrop-filter: none; -webkit-backdrop-filter: none; }
  #meterList .meter-icon, #meterList .meter-detail { color: CanvasText; background: Canvas; }
  #meterList .meter-track { border: 1px solid CanvasText; }
  #meterList .meter-fill { background: Highlight; forced-color-adjust: none; }
}
@media (prefers-reduced-motion:reduce) {
  #meterList .meter-fill { transition: none; }
}
