:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #f1edf1;
  background: #171722;
  --ink: #f1edf1;
  --muted: #b8b0c2;
  --border: #3e3748;
  --accent: #ffd0a0;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; min-height: 100dvh; background: radial-gradient(ellipse at 22% 26%, #252231 0%, #171722 57%); }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible, .room-frame:focus-visible { outline: 2px solid #ffd0a0; outline-offset: 3px; }
button:disabled { cursor: default; }
.topbar { border-bottom: 1px solid #363041; background: #191924; }
.topbar-inner, .shell { width: min(1170px, calc(100% - 88px)); margin-inline: auto; }
.topbar-inner { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wordmark { display: flex; align-items: center; gap: 11px; font-size: .94rem; color: #eee5eb; }
.wordmark strong { font-family: ui-monospace, monospace; letter-spacing: .02em; }
.brand-cat { position: relative; display: inline-block; width: 30px; height: 30px; flex: none; background: #f1b37f; border-radius: 8px; }
.brand-cat::before { content: ""; position: absolute; background: #292334; inset: 7px 5px 6px; clip-path: polygon(0 0, 30% 23%, 70% 23%, 100% 0, 100% 74%, 85% 96%, 16% 96%, 0 74%); }
.brand-cat::after { content: ""; position: absolute; top: 15px; left: 9px; width: 3px; height: 2px; background: #ffe1aa; box-shadow: 8px 0 #ffe1aa; }
.brand-cat i { position: absolute; z-index: 1; left: 13px; top: 19px; width: 4px; height: 2px; background: #fff2da; }
.mode { padding: 6px 10px; border: 1px solid #494150; color: #d4cad7; border-radius: 5px; font-size: .82rem; }
.mode[data-mode="deepseek"] { border-color: #63715b; color: #d5e7bf; }
.shell { padding-block: clamp(27px, 5vw, 65px) 45px; }
.page-heading { margin-bottom: clamp(21px, 3vw, 33px); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.6rem, 5.8vw, 4.45rem); letter-spacing: .035em; font-weight: 850; line-height: 1.08; color: #fcf1ec; }
.page-heading p { font-size: 1rem; color: #c9bdcb; margin-top: 12px; }
.layout { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(320px, 1fr); gap: 22px; align-items: stretch; }
.pet-panel { min-width: 0; display: grid; gap: 12px; align-content: start; }
.room-picker { display: flex; width: fit-content; max-width: 100%; gap: 3px; padding: 3px; border: 1px solid #483d51; border-radius: 8px; background: #201d2b; }
.room-picker button { min-height: 34px; padding: 3px 12px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #d7cadb; font-size: .88rem; white-space: nowrap; }
.room-picker button[aria-pressed="true"] { border-color: #986c68; background: #493344; color: #ffe7cf; }
.room-picker button:hover { color: var(--accent); }
.room-frame { position: relative; isolation: isolate; overflow: hidden; aspect-ratio: 328 / 218; background: #241f39; border: 1px solid #564751; border-radius: 13px; box-shadow: 0 12px 38px #0b091933; }
#room { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
#person { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; image-rendering: pixelated; pointer-events: none; }
.room-top { position: absolute; inset: 13px 13px auto; display: flex; justify-content: space-between; gap: 8px; z-index: 5; pointer-events: none; }
.room-time, .lamp-switch { font-size: .85rem; min-height: 36px; display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 6px; background: #1d192be9; color: #f7e3d9; border: 1px solid #a887896a; white-space: nowrap; }
.room-time time { font-family: ui-monospace, monospace; }
#time-icon, .lamp-switch > span:first-child { color: #ffd0a0; }
.lamp-switch { pointer-events: auto; }
.lamp-switch:hover { background: #34283b; }
.lamp-switch[aria-pressed="false"] > span:first-child { color: #b2a7be; }
.cat-hit, .person-hit { position: absolute; display: block; z-index: 2; padding: 0; border: 0; background: none; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
.person-hit { z-index: 3; width: 15%; min-width: 40px; transform: translateX(-50%); }
.person-hit:hover { box-shadow: inset 0 0 0 1px #ffd0a047; }
#cat { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; pointer-events: none; }
.room-hotspots { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.scene-point { position: absolute; display: inline-flex; align-items: center; gap: 5px; transform: translate(-50%, -50%); min-height: 33px; padding: 4px 8px; border: 1px solid #d79d8a85; border-radius: 7px; background: #231d30ef; color: #ffead8; font-size: .84rem; white-space: nowrap; pointer-events: auto; }
.scene-point::before { width: 5px; height: 5px; flex: none; background: #f4bb91; content: ""; transform: rotate(45deg); }
.scene-point:hover, .scene-point[aria-pressed="true"] { background: #624254; border-color: #ffd0a0; }
.scene-caption { position: absolute; z-index: 5; inset: auto 13px 13px; display: flex; align-items: center; gap: 8px; width: fit-content; max-width: calc(100% - 26px); padding: 7px 10px; border: 1px solid #a8878959; border-radius: 6px; background: #1d192be9; color: #f7e3d9; font-size: .84rem; pointer-events: none; }
.scene-caption > span { flex: none; width: 6px; height: 6px; background: #f7b784; transform: rotate(45deg); }
.person-actions { display: grid; grid-template-columns: auto repeat(4, minmax(0, 1fr)); gap: 6px; align-items: center; }
.person-actions > span { padding-inline: 3px 6px; color: #d3c4d6; font-size: .86rem; }
.person-actions button { min-width: 0; min-height: 40px; padding: 4px 3px; border: 1px solid #4c4156; border-radius: 7px; background: #272332; color: #f1e7ee; font-size: .88rem; white-space: nowrap; }
.person-actions button:hover, .person-actions button.active { border-color: #a77462; background: #463144; color: #ffe8d5; }
.actions { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; }
.pet-action { min-height: 57px; padding: 8px 4px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; background: #24222f; color: var(--ink); white-space: nowrap; font-size: .9rem; transition: background .16s ease, border-color .16s ease; }
.pet-action:hover, .pet-action.active { background: #392b39; border-color: #a77462; }
.action-glyph { display: inline-flex; width: 23px; align-items: center; justify-content: center; color: #ffd0a0; line-height: 1; font: 1.25rem ui-monospace, monospace; }
.chat-panel { background: #201f2c; border: 1px solid var(--border); border-radius: 13px; min-height: 450px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.chat-heading { padding: 17px 16px; min-height: 76px; display: flex; gap: 11px; align-items: center; border-bottom: 1px solid #393243; }
.chat-avatar { display: grid; place-items: center; min-width: 39px; min-height: 39px; border-radius: 8px; background: #4d3543; }
.chat-avatar .brand-cat { transform: scale(.84); }
.chat-heading h2 { font-size: 1rem; font-weight: 750; }
.chat-heading p { margin-top: 4px; font-size: .76rem; color: #c2b5ca; }
.chat-controls { margin-left: auto; display: flex; flex: none; gap: 3px; }
.clear-button, .memory-button { min-height: 36px; padding: 5px 7px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #c2b5ca; white-space: nowrap; font-size: .86rem; }
.clear-button:hover:not(:disabled), .memory-button:hover { color: var(--accent); }
.clear-button:disabled { color: #a096a9; opacity: .65; }
.memory-button { border-color: #56495e; color: #e1d2df; }
.memory-button:hover { border-color: #a77462; background: #392b39; }
.messages { min-height: 0; max-height: clamp(240px, 54vw, 580px); overflow-y: auto; scroll-behavior: smooth; overscroll-behavior: contain; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 19px 15px; }
.message { max-width: 92%; padding: 10px 12px; color: #efe9f1; border: 1px solid #494052; background: #302a3b; border-radius: 3px 10px 10px 10px; line-height: 1.65; word-break: break-word; white-space: pre-wrap; font-size: .94rem; }
.message.user { align-self: flex-end; background: #573a41; border-color: #76504f; border-radius: 10px 3px 10px 10px; color: #fff1e7; }
.message.pending { color: #d1c1d4; font-size: .84rem; }
.chat-bottom { border-top: 1px solid #383142; padding: 12px; }
.suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 11px; }
.suggestions[hidden] { display: none; }
.suggestions button { padding: 5px 8px; border: 1px solid #56495e; background: #262233; color: #e1d2df; border-radius: 5px; font-size: .77rem; }
.suggestions button:hover { border-color: #be967f; color: var(--accent); }
#chat-form { display: flex; align-items: stretch; gap: 6px; }
#message { flex: 1 1 auto; min-width: 0; height: 47px; max-height: 86px; resize: none; background: #181721; color: var(--ink); border: 1px solid #4a4054; border-radius: 7px; padding: 11px 10px; font-size: 1rem; line-height: 1.45; }
#message::placeholder { color: #b1a4b8; }
#send { padding: 0 13px; background: #f0b88d; color: #2c2029; font-weight: 750; border: 1px solid #f7c49f; border-radius: 7px; font-size: .9rem; }
#send:not(:disabled):hover { background: #ffd0a0; }
#send:disabled { opacity: .55; }
.chat-error { margin: 7px 0 0; color: #ffb6ad; font-size: .84rem; line-height: 1.4; }
.memory-dialog { width: min(420px, calc(100% - 30px)); max-height: calc(100vh - 30px); max-height: calc(100dvh - 30px); padding: 19px; overflow: auto; border: 1px solid #645164; border-radius: 13px; background: #24222f; color: var(--ink); box-shadow: 0 16px 48px #100b18aa; }
.memory-dialog::backdrop { background: #120e1bbb; }
.memory-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.memory-heading h2 { font-size: 1.15rem; }
.memory-help, .memory-empty { line-height: 1.55; color: #d3c7d7; }
.memory-empty { margin-top: 14px; color: var(--muted); }
.memory-list { display: grid; gap: 7px; margin: 15px 0 0; padding: 0; list-style: none; }
.memory-list:empty { display: none; }
.memory-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid #494052; border-radius: 7px; background: #302a3b; overflow-wrap: anywhere; }
.memory-close, .memory-remove { flex: none; min-height: 36px; padding: 4px 9px; border: 1px solid #5e4c60; border-radius: 6px; background: #262233; color: #efe1eb; font-size: .875rem; white-space: nowrap; }
.memory-close:hover, .memory-remove:hover { border-color: #a77462; color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 960px) {
  .topbar-inner, .shell { width: calc(100% - 48px); }
  .layout { gap: 16px; }
  .pet-action { gap: 3px; }
}
@media (max-width: 740px) {
  .topbar-inner, .shell { width: calc(100% - 30px); }
  .topbar-inner { min-height: 57px; }
  .layout { grid-template-columns: minmax(0,1fr); }
  .room-top { inset: 9px 9px auto; }
  .scene-caption { inset: auto 9px 9px; }
  .chat-panel { min-height: 395px; }
}
@media (max-width: 425px) {
  .pet-action { flex-direction: column; gap: 1px; font-size: .82rem; }
  .actions { gap: 5px; }
  .room-time, .lamp-switch, .scene-caption { min-height: 29px; font-size: .74rem; padding: 4px 6px; }
  .scene-point { min-height: 32px; padding-inline: 5px; gap: 4px; font-size: .76rem; }
  .person-actions { gap: 4px; }
  .person-actions button, .person-actions > span { font-size: .82rem; }
  .chat-heading { padding-inline: 11px; gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0ms !important; }
}
