:root {
  color-scheme: light;
  --base: #f7f1e8;
  --rail: #fbf7f0;
  --panel: #fffcf7;
  --line: #e7ded2;
  --text: #2c2927;
  --muted: #665b54;
  --soft: #514b4a;
  --accent: #3e537b;
  --accent-strong: #263957;
  --accent-veil: #e8edf5;
  --accent-line: #d6deed;
  --aqua: #365d52;
  --danger: #9c423d;
  --motion-press: 140ms;
  --motion-panel: 220ms;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --title: "Instrument Serif", "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.54;
  color: var(--text);
  background: var(--base);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .62; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.desktop-pet-swatch { display: inline-block; width: 38px; aspect-ratio: 320 / 312; flex: none; background: url('/art/desk-pet/idle.webp') left top / 600% 400% no-repeat; }
.desk-welcome { display: flex; align-items: center; padding: .75rem; gap: .6rem; border-radius: 16px; background: #f1ecdf; color: #334b49; }
.desk-welcome p { margin: 0; }
.desk-welcome .desktop-pet-swatch { width: 70px; }
@media (prefers-reduced-motion: no-preference) {
  .desk-welcome .desktop-pet-swatch { animation: desk-breathe 2.3s steps(5,end) infinite alternate; }
  @keyframes desk-breathe { to { background-position: 100% 0; } }
}
.desktop-plugin { line-height: 1.65; }
.desktop-plugin details[open] summary { margin-bottom: .75rem; }
.desktop-plugin ol { margin: .5rem 0 1rem; padding-inline-start: 1.45rem; }
.desktop-plugin li + li { margin-top: .6rem; }
.desktop-plugin a { color: var(--ink, #254944); text-underline-offset: .2em; }
.desktop-plugin [data-desk-code] { margin-block: .75rem; }
.desktop-plugin small { opacity: .8; }
h1, h2, h3, p { margin: 0; }
svg { width: 21px; height: 21px; flex: 0 0 auto; }
.skip-link { position: fixed; top: 8px; left: 8px; padding: 8px 12px; z-index: 12; background: var(--panel); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.boot, .connection-error {
  min-height: 100dvh;
  display: grid;
  gap: 11px;
  align-content: center;
  justify-items: center;
  padding: 22px;
  text-align: center;
}
.boot .room-preview { width: min(640px, calc(100% - 30px)); height: auto; border-radius: 19px; }
.boot span, .muted { color: var(--muted); }
.fine { font-size: 13px; }

.layout { min-height: 100dvh; display: grid; grid-template-columns: 194px minmax(0, 1fr); }
.rail {
  height: 100dvh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 32px 16px 20px;
  border-right: 1px solid var(--line);
  background: var(--rail);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 1px 10px 36px; }
.brand-img { width: 40px; height: 40px; border: 1px solid #00000017; border-radius: 12px; object-fit: cover; }
.brand strong { font-family: var(--title); font-size: 22px; font-weight: 750; letter-spacing: .025em; }
.navigation { display: grid; gap: 7px; }
.nav-glyph { display: inline-grid; place-items: center; flex: 0 0 auto; }
.nav-button, .rail-account {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 47px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  text-align: left;
  color: var(--muted);
  font-size: 15px;
  transition: color .2s, background .2s;
}
.nav-button:hover, .rail-account:hover { background: #f0e9de; color: var(--text); }
.nav-button[aria-current="page"], .mobile-settings[aria-current="page"], .rail-account[aria-current="page"] { color: var(--accent-strong); background: var(--accent-veil); border-color: var(--accent-line); font-weight: 700; }
.nav-button[aria-current="page"] svg { color: var(--accent); }
.rail-account { margin-top: auto; }
.avatar {
  width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto;
  border: 1px solid #cbdacb; border-radius: 50%; color: var(--accent-strong); background: #e4ece0;
  font-weight: 700;
}
.avatar svg { width: 17px; height: 17px; }
.mobile-brand, .mobile-navigation { display: none; }
.content-area { min-width: 0; min-height: 100dvh; background: radial-gradient(ellipse 66% 540px at 58% 0, #fffaf1 0, var(--base) 100%); }
.content { width: min(100%, 1246px); margin: 0 auto; padding: 36px 40px 52px; }
.home-content { width: min(100%, 1138px); }
.page-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 23px; }
.page-top h1 { font-family: var(--title); font-size: clamp(29px, 3.4vw, 43px); font-weight: 750; line-height: 1.18; letter-spacing: -.05em; }
.page-top .sub { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.picker select { max-width: 146px; min-height: 40px; padding: 6px 9px; font-size: 14px; }
.icon-button {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--accent);
}
.icon-button svg { width: 19px; height: 19px; }
.icon-button:hover, .quiet:hover { background: #eaece4; color: var(--accent-strong); }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  width: fit-content; padding: 10px 16px; border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; font-weight: 680; white-space: nowrap; transition: background .18s, transform .18s, border-color .18s;
}
.button:not(:disabled):active { transform: translateY(1px); }
.button svg { width: 18px; height: 18px; }
.primary { color: #fffdf7; background: var(--accent); box-shadow: 0 2px 5px #23375826; }
.primary:hover { background: var(--accent-strong); }
.secondary { color: var(--accent-strong); background: var(--accent-veil); border-color: var(--accent-line); }
.secondary:hover { background: #dce5f2; }
.quiet { color: var(--soft); background: transparent; border-color: #dcd8cd; }
.danger { color: var(--danger); background: #f9e9e3; border-color: #efd3c8; }
.link-button { display: inline-flex; gap: 5px; align-items: center; padding: 5px 1px; border: 0; background: transparent; color: var(--accent); font-size: 13px; font-weight: 650; }
.link-button svg { width: 16px; height: 16px; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: clamp(374px, 39vw, 470px);
  border: 1px solid #1c2c41;
  border-radius: 21px;
  color: #fff8e9;
  background: #101b31;
  box-shadow: 0 15px 32px #283c422e;
}
.hero-image, .hero-shade, .hero-ripples { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-image { object-fit: cover; object-position: 56% 57%; animation: tide 14s ease-in-out infinite alternate; }
.hero-shade { background: linear-gradient(90deg, #101628ee 0, #111b2c9c 29%, transparent 68%), linear-gradient(0deg, #111629b8 0, transparent 33%); }
.hero-ripples { pointer-events: none; }
.hero-ripples i {
  position: absolute; bottom: 18%; left: var(--x); width: var(--size); height: var(--size);
  border: 1px solid #bbd6ff88; border-radius: 50%; box-shadow: inset 0 1px 3px #e8efffe0, 0 0 9px #8ab8ff50;
  opacity: 0; animation: bubble var(--period) var(--wait) infinite ease-out;
}
.hero-ripples i:nth-child(1) { --x: 44%; --size: 15px; --period: 8s; --wait: -2s; }
.hero-ripples i:nth-child(2) { --x: 75%; --size: 11px; --period: 10s; --wait: -3s; }
.hero-ripples i:nth-child(3) { --x: 84%; --size: 23px; --period: 12s; --wait: -8s; }
.hero-ripples i:nth-child(4) { --x: 59%; --size: 8px; --period: 7s; --wait: -5s; }
.hero-fed .hero-ripples i { animation-duration: 1.6s; }
@keyframes tide { from { transform: scale(1.015) translateY(1px); } to { transform: scale(1.065) translateY(-1px); } }
@keyframes bubble { 0% { transform: translate(0, 0); opacity: 0; } 23% { opacity: .55; } 80% { opacity: .25; } 100% { transform: translate(13px, -265px) scale(1.12); opacity: 0; } }
.hero-copy { padding: 38px 36px 0; width: min(45%, 398px); }
.hero-copy h2 { margin-top: 16px; font-family: var(--title); font-size: clamp(44px, 5.5vw, 72px); font-weight: 750; line-height: 1.04; letter-spacing: -.055em; overflow-wrap: anywhere; }
.hero-copy p { margin-top: 13px; color: #e7e2d9; font-size: 15px; max-width: 28ch; }
.hero-new .hero-copy h2 { font-size: clamp(38px, 4.8vw, 63px); }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border: 1px solid #f7f1df4d;
  border-radius: 999px; color: #fbf6e8; background: #22374896; font-size: 12px; font-weight: 650;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b0e0c1; box-shadow: 0 0 9px #a1e8c490; }
.status-dot.rest { background: #e4cfb0; box-shadow: none; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 21px 36px 34px; }
.hero-actions .primary { color: #233e34; background: #f7edda; box-shadow: none; }
.hero-actions .primary:hover { background: #fffaee; }
.hero-actions .secondary { color: #f8f3e7; background: #1e293a94; border-color: #f7f1df65; }
.hero-actions .secondary:hover { background: #394a5c; }
.hero-asleep .hero-image { filter: saturate(.85) brightness(.88); }
.character-scene {
  background: radial-gradient(ellipse at 70% 46%, #416c76 0%, #293f52 31%, #18283b 66%, #151c2d 100%);
}
.character-scene::before {
  position: absolute; z-index: -1; inset: 9% 5% 7% 42%; content: "";
  border: 1px solid #c7e6d821; border-radius: 50%;
  box-shadow: 0 0 0 24px #d2e5d509, 0 0 0 52px #d2e5d508;
}
.hero .character-art {
  inset: 4% 5% auto auto; width: 52%; height: 92%; object-fit: contain; object-position: center;
  filter: drop-shadow(0 14px 26px #101a3291); animation: drift 5.2s ease-in-out infinite alternate;
}
.hero-asleep .character-art { filter: drop-shadow(0 14px 26px #101a3291) saturate(.90) brightness(.94); }
.hero.character-scene .hero-shade {
  background: linear-gradient(90deg, #141b2be8, #18263872 32%, transparent 59%), linear-gradient(0deg, #141b2b63, transparent 25%);
}
@keyframes drift { from { transform: translateY(3px); } to { transform: translateY(-7px); } }

.home-grid {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  margin-top: 25px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); overflow: hidden;
}
.home-grid > .panel { border: 0; border-radius: 0; background: transparent; }
.home-grid > .panel + .panel { border-left: 1px solid var(--line); }
.panel {
  min-width: 0; overflow: hidden; padding: 23px 24px; border: 1px solid var(--line);
  border-radius: 17px; background: var(--panel);
}
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.panel-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.symbol {
  display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px;
  border: 1px solid #dddcd0; border-radius: 10px; background: #eeede5; color: var(--accent);
}
.symbol svg { width: 19px; height: 19px; }
.symbol.mint { color: #2a6357; border-color: #d4ded4; background: #e5eee5; }
.symbol.rose { color: #875b4e; border-color: #eadbd1; background: #f5e9df; }
.panel h2 { font-size: 17px; letter-spacing: .01em; }
.panel-helper { color: var(--muted); font-size: 14px; }
.progress-line, .growth-caption { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.progress-line strong { font-size: 17px; }
.progress-line span { color: var(--soft); font-size: 12px; }
progress { display: block; width: 100%; height: 8px; margin: 9px 0 8px; overflow: hidden; border: 0; border-radius: 999px; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #e7e6db; }
progress::-webkit-progress-value { background: #397768; border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); }
.growth-caption { color: var(--muted); font-size: 12px; }
.growth-caption span:last-child { text-align: right; }
.care-list, .journal-list { list-style: none; margin: 0; padding: 0; }
.care-list { display: grid; gap: 9px; }
.care-item { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; color: var(--soft); font-size: 13px; }
.care-item svg { width: 17px; height: 17px; color: #6f837b; }
.care-item.done svg { color: var(--aqua); }
.care-item .value { color: var(--muted); font-size: 12px; white-space: nowrap; }
.journal { margin-top: 24px; }
.journal-list li { display: flex; align-items: center; gap: 11px; min-height: 44px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.journal-list li:first-child { border: 0; }
.journal-list li svg { width: 17px; height: 17px; color: var(--accent); }
.journal-list time { margin-left: auto; white-space: nowrap; }

.chat-panel { padding: 0; display: flex; flex-direction: column; height: clamp(360px, calc(100dvh - 150px), 690px); overflow: hidden; }
.chat-header { display: flex; align-items: center; gap: 11px; padding: 15px 19px; border-bottom: 1px solid var(--line); }
.fish-avatar { width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid #00000016; border-radius: 13px; object-fit: cover; }
.chat-header .link-button { margin-left: auto; }
.messages { display: grid; align-content: start; gap: 15px; flex: 1; padding: 26px; min-height: 0; overflow: auto; overscroll-behavior: contain; background: #fbf7ef; }
.messages:has(.chat-empty) { align-content: center; }
.load-older { justify-self: center; }
.chat-empty { justify-self: center; align-self: center; padding: 38px 6px; text-align: center; }
.chat-empty img { width: 78px; height: 78px; margin-bottom: 15px; border: 1px solid #18282822; border-radius: 24px; box-shadow: 0 8px 18px #343f4022; }
.chat-empty h2 { font-family: var(--title); font-size: 28px; }
.chat-empty p { margin-top: 4px; color: var(--muted); font-size: 14px; }
.message { width: fit-content; max-width: min(84%, 635px); }
.message.user { justify-self: end; }
.chat-bubble { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 15px; border: 1px solid #e8e0d5; border-radius: 6px 17px 17px 17px; background: #fffdf8; font-size: 15px; }
.user .chat-bubble { border-color: var(--accent-line); border-radius: 17px 6px 17px 17px; color: var(--accent-strong); background: var(--accent-veil); }
.pending .chat-bubble { color: var(--muted); animation: waiting 1.2s ease-in-out infinite alternate; }
@keyframes waiting { to { opacity: .55; } }
.composer-area { display: grid; gap: 8px; padding: 14px 18px 16px; border-top: 1px solid var(--line); background: var(--panel); }
.prompts { display: flex; flex-wrap: wrap; gap: 6px; }
.prompt-chip { min-height: 35px; padding: 5px 11px; border: 1px solid var(--accent-line); border-radius: 999px; background: var(--accent-veil); color: var(--accent-strong); font-size: 12px; }
.prompt-chip:hover { border-color: var(--accent); }
.composer { display: flex; align-items: flex-end; gap: 9px; }
.composer textarea { min-height: 46px; max-height: 138px; }
.composer button { min-height: 46px; }
.format-hint { color: var(--muted); font-size: 12px; }

.conversation-content { width: min(100%, 1460px); }
.room-conversation { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 290px); grid-template-areas: "room history" "composer history"; column-gap: 22px; align-items: stretch; }
.conversation-room.room-panel { grid-area: room; width: 100%; margin: 0; min-width: 0; }
.conversation-composer { grid-area: composer; margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 4px 15px #654d3208; }
.conversation-composer textarea { min-height: 47px; max-height: 120px; border-color: transparent; background: #f4ede3; }
.conversation-composer textarea:focus { border-color: var(--accent-line); background: #fffcf7; }
.conversation-caption { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 21px; }
.conversation-caption .link-button { padding: 0; font-size: 11px; }
.conversation-caption .format-hint { font-size: 11px; }
.history-toggle { display: none; }
.conversation-history { grid-area: history; position: relative; align-self: stretch; min-height: 300px; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: #fffbf5; }
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.history-heading h2 { font-size: 15px; font-weight: 700; letter-spacing: .03em; }
.history-close { display: none; }
.conversation-history .messages { position: absolute; inset: 66px 0 0; gap: 20px; padding: 17px 16px 22px; background: transparent; }
/* Keep the same visual language in the home preview and the full transcript. */
:is(.letter-lines,.conversation-history .messages) { grid-template-columns:minmax(0,1fr); }
:is(.letter-lines,.conversation-history) .message { justify-self:start; min-width:0; width:fit-content; max-width:min(84%,48ch); }
:is(.letter-lines,.conversation-history) .message.user { justify-self:end; }
.history-speaker { margin:0 4px 4px; color:#59675e; font-size:11px; line-height:1.3; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.message.user .history-speaker { text-align:right; }
:is(.letter-lines,.conversation-history) .chat-bubble { padding:8px 12px; border:1px solid #ded6c6; border-radius:3px 13px 13px 13px; color:#354442; background:#fffcf4; font-size:14px; line-height:1.55; text-align:start; }
:is(.letter-lines,.conversation-history) .user .chat-bubble { border-color:#c7d5c8; border-radius:13px 3px 13px 13px; color:#28443d; background:#e2ebe1; }
.history-empty { align-self: start; padding: 6px 0; color: var(--muted); font-size: 13px; }
.history-backdrop { position: fixed; z-index: 30; inset: 0; width: 100%; border: 0; background: #30261e66; backdrop-filter: blur(4px); }
.room-speech { position: absolute; z-index: 2; left: 0; top: 0; overflow: visible; pointer-events: none; opacity: 1; transition: opacity .18s ease; }
.room-speech.speech-leaving { opacity: 0; }
.speech-body { position: relative; z-index: 1; min-width: 48px; min-height: 40px; padding: 12px 20px; overflow: hidden; border: 0; background: transparent; pointer-events: auto; }
.speech-skin { position: absolute; z-index: 0; inset: 0; display: grid; grid-template-columns: 24px minmax(0, 1fr) 24px; grid-template-rows: 20px minmax(0, 1fr) 20px; pointer-events: none; }
.room-speech[data-side="left"] .speech-skin { transform: scaleX(-1); }
.room-speech[data-placement="below"] .speech-skin { transform: scaleY(-1); }
.speech-skin-tile { position: relative; min-width: 0; min-height: 0; overflow: visible; clip-path: inset(-.5px); }
.speech-skin-tile img { position: absolute; display: block; max-width: none; max-height: none; pointer-events: none; user-select: none; }
.speech-viewport { position: relative; z-index: 1; min-width: 0; max-width: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #bec7d3 transparent; }
.speech-content { min-width: 0; max-width: 100%; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; color: #3d4351; font-size: 13px; line-height: 1.6; }
.speech-controls { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1; }
.speech-controls button { min-width: 28px; min-height: 26px; padding: 0 3px; border: 0; border-radius: 6px; color: var(--accent); background: transparent; font-size: 21px; font-weight: 500; line-height: 1; }
.speech-controls button:not(:disabled):hover { background: var(--accent-veil); }
.speech-controls button:disabled { opacity: .35; }
.speech-thinking { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 17px; padding: 3px 0; }
.speech-thinking span { width: 5px; height: 5px; border-radius: 50%; background: #5d6b84; animation: speech-dot 1.2s ease-in-out infinite; }
.speech-thinking span:nth-child(2) { animation-delay: .15s; }
.speech-thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes speech-dot { 0%, 70%, 100% { transform: translateY(0); opacity: .4; } 35% { transform: translateY(-3px); opacity: 1; } }

@media (max-width: 1040px) {
  .room-conversation { display: block; }
  .history-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; flex: 0 0 auto; padding: 8px 11px; border: 1px solid #e7dacc; border-radius: 13px; color: #6a5143; background: #fbf4e9; font-size: 12px; }
  .history-toggle svg { width: 17px; height: 17px; }
  .history-close { display: grid; }
  .conversation-history {
    position: fixed; z-index: 31; top: max(12px, env(safe-area-inset-top)); bottom: max(12px, env(safe-area-inset-bottom)); right: 12px;
    width: min(340px, calc(100vw - 32px)); min-height: 0; border-radius: 22px; background: #fffaf2;
    box-shadow: 0 15px 60px #33261d40;
    visibility: hidden; transform: translateX(calc(100% + 20px));
    transition: transform .24s ease, visibility .24s;
  }
  .conversation-history[data-open="true"] { visibility: visible; transform: translateX(0); }
}

.memory-toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.memory-toolbar input { flex: 1; }
.memory-grid { display: grid; gap: 13px; }
.memory-card { display: grid; gap: 9px; border-left: 3px solid #a4b4a5; }
.memory-card p { white-space: pre-wrap; overflow-wrap: anywhere; }
.memory-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.memory-kind { padding: 3px 8px; border: 1px solid #dce5d8; border-radius: 999px; background: #eaf0e6; color: var(--accent-strong); font-weight: 650; }
.memory-actions { display: flex; gap: 13px; }
.memory-actions .delete { color: var(--danger); }
.empty-panel { display: grid; justify-items: center; gap: 9px; padding: 39px 17px; text-align: center; }
.empty-panel p { color: var(--muted); font-size: 14px; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; gap: 14px; }
.stack { display: grid; gap: 13px; min-width: 0; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.settings-actions.spaced { margin-top: 11px; }
.field { display: grid; gap: 6px; color: var(--soft); font-size: 13px; font-weight: 650; }
input, select, textarea { display: block; width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid #d8d4c7; border-radius: 10px; background: #fcfaf5; color: var(--text); transition: border-color .18s, background .18s; }
input::placeholder, textarea::placeholder { color: #67736c; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: #fffefa; }
textarea { resize: vertical; }
.inline-status { color: var(--aqua); font-size: 13px; }
.form-error { min-height: 1.25em; color: var(--danger); font-size: 13px; }
.account-details { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.stage-label { margin-left: auto; color: var(--muted); font-size: 12px; }
.toast {
  position: fixed; z-index: 20; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(calc(100vw - 32px), 460px); padding: 11px 15px; border: 1px solid #45546c; border-radius: 14px;
  background: #293853; color: #fffaf3; box-shadow: 0 10px 30px #29385331; font-size: 14px;
}
.toast.error { border-color: #963a39; background: #672d2b; color: #fff1e8; }
dialog { width: min(calc(100vw - 28px), 468px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: 0 24px 70px #22373155; }
dialog::backdrop { background: #172c2b76; backdrop-filter: blur(4px); }
.sheet-content { display: grid; gap: 15px; padding: 24px; }
.sheet-header { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.sheet-header h2 { font-family: var(--title); font-size: 26px; line-height: 1.2; }
.sheet-header .icon-button { width: 36px; height: 36px; }
.sheet-art { width: 100%; height: 163px; border-radius: 13px; object-fit: cover; object-position: center 57%; }
.sheet-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.account-gate { width: min(452px, calc(100% - 30px)); margin: 9vh auto; }
.account-gate .panel { display: grid; gap: 14px; }
.account-gate img { width: 100%; aspect-ratio: 2; object-fit: cover; border-radius: 13px; }
.account-gate h1 { font-size: 28px; }

.welcome {
  width: min(calc(100% - 88px), 1290px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 0 40px;
}
.welcome-brand {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; margin-bottom: 26px; border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}
.welcome-brand .brand { padding: 0; }
.welcome-brand .brand-img { width: 38px; height: 38px; }
.welcome-brand .brand strong { font-size: 23px; }
.welcome-header-action { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.welcome-inner {
  display: grid; grid-template-columns: minmax(345px, .8fr) minmax(0, 1.2fr);
  gap: clamp(33px, 6.1vw, 90px); align-items: stretch;
}
.welcome-content {
  width: min(100%, 440px); align-self: center; justify-self: center;
  padding: 36px 0;
}
.welcome-room {
  align-self: center;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 1px solid #ddd3c5;
  border-radius: 20px;
  background: #a88973;
  box-shadow: 0 17px 39px #56422e25;
}
.welcome-intro { margin-bottom: 26px; }
.welcome h1 {
  font-family: var(--title); font-size: clamp(38px, 4.7vw, 63px);
  font-weight: 750; line-height: 1.06; letter-spacing: -.068em;
}
.welcome-intro p, .welcome-form > p:not(.form-error) {
  color: var(--muted); font-size: 14px; line-height: 1.65;
}
.welcome-intro p { margin-top: 12px; }
.welcome-tabs {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
  margin-bottom: 17px; padding: 4px; border: 1px solid #e4ded2; border-radius: 11px; background: #eeebe2;
}
.welcome-tab {
  display: grid; min-height: 38px; place-items: center; padding: 5px 10px;
  border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent;
  font-weight: 700; font-size: 14px; transition: background .18s, color .18s;
}
.welcome-tab[aria-selected="true"], .welcome-tab[aria-pressed="true"] {
  color: var(--accent-strong); background: #fffdf8; border-color: #e8e2d5; box-shadow: 0 2px 4px #27342d0c;
}
.welcome-tab:hover { color: var(--accent-strong); }
.welcome-form, .welcome-form > form { display: grid; gap: 13px; }
.welcome-form .field { gap: 6px; }
.welcome-form input { min-height: 49px; padding-inline: 13px; font-size: 16px; }
.welcome-form .button[type="submit"], .welcome-form .primary { width: 100%; min-height: 49px; }
.welcome-form .form-error { min-height: 0; }
.welcome-note { display: flex; align-items: flex-start; gap: 6px; margin-top: 13px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.welcome-note svg { width: 14px; height: 14px; margin-top: 2px; }
.welcome-note p + p { margin-top: 4px; }
.welcome-visual {
  position: relative; isolation: isolate; display: flex; align-items: end;
  min-height: clamp(520px, 75vh, 730px); overflow: hidden; border-radius: 20px;
  border: 1px solid #253a45; color: #fff7e8; background: #142237;
  box-shadow: 0 17px 39px #253c4237;
}
.welcome-art, .welcome-shade { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.welcome-art { display: block; object-fit: cover; object-position: 60% 56%; }
.welcome-shade { background: linear-gradient(180deg, transparent 48%, #121927d9 100%); }
.welcome-visual.character-scene {
  background: radial-gradient(ellipse at 51% 43%, #507984, #2b495d 41%, #19293c 69%, #151f31 100%);
}
.welcome-visual.character-scene::before { inset: 10% 18% 14%; }
.welcome-visual .character-art {
  inset: 5% 11% auto; width: 78%; height: 81%; object-fit: contain; object-position: center;
  filter: drop-shadow(0 14px 28px #111b3082);
}
.welcome-visual.character-scene .welcome-shade { background: linear-gradient(180deg, transparent 66%, #131c2cc4 100%); }
.welcome-visual-caption { display: grid; gap: 8px; max-width: 100%; padding: 29px 32px; margin: 0; }
.welcome-visual-caption .status-pill { justify-self: start; }
.welcome-visual-caption h2, .welcome-visual-caption strong { font-family: var(--title); font-size: clamp(23px, 2.6vw, 36px); line-height: 1.15; }
.welcome-visual-caption p, .welcome-visual-caption span { color: #f0e5d7; font-size: 13px; }

.app-overview { margin-top: 23px; }
.quick-links {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(164px, 1fr)); align-items: stretch;
  gap: 9px; margin-top: 22px;
}
.quick-link {
  display: flex; align-items: center; min-height: 65px; gap: 10px; min-width: 0;
  padding: 12px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--accent-strong);
  text-decoration: none; transition: background .18s, border-color .18s;
}
.quick-link:hover { border-color: #b7c9b7; background: #eef2e9; }
.quick-link > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.quick-link strong { font-size: 14px; }
.quick-link p, .quick-link small { color: var(--muted); font-size: 12px; }
.quick-link svg:last-child:not(:first-child) { width: 16px; height: 16px; margin-left: auto; }
.journal-form { display: grid; gap: 11px; }
.journal-form textarea { min-height: 108px; line-height: 1.65; }
.journal-entry { min-width: 0; padding: 15px 0; }
.panel.journal-entry { padding: 19px 21px; }
.journal-entry + .journal-entry { border-top: 1px solid var(--line); }
.journal-entry h2, .journal-entry h3 { margin-bottom: 6px; }
.journal-entry p { white-space: pre-wrap; overflow-wrap: anywhere; }
.journal-entry time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.fish-manager { display: grid; gap: 12px; }
.archived-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-width: 0; padding: 12px 0; border-top: 1px solid var(--line);
}
.archived-row > div { min-width: 0; overflow-wrap: anywhere; }
.archived-row .button { flex-shrink: 0; }

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 262px), 1fr));
  gap: 16px;
  margin-top: 20px;
}
.plugin-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 13px; min-width: 0;
  padding: 21px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel);
}
.plugin-top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.plugin-top > div { min-width: 0; }
.plugin-top h2, .plugin-top h3 { color: var(--text); font-size: 17px; line-height: 1.25; }
.plugin-card > p { color: var(--muted); font-size: 14px; line-height: 1.62; }
.plugin-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.plugin-meta > span {
  padding: 3px 8px; border: 1px solid #dedfd3; border-radius: 999px; background: #f1f1e8;
}
.plugin-meta .active { border-color: #cbdbcd; color: var(--accent-strong); background: #e5eee4; }
.plugin-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: auto;
  padding-top: 11px; border-top: 1px solid var(--line);
}
.plugin-actions .button { min-height: 39px; }
.quota-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 172px), 1fr));
  gap: 12px; margin: 18px 0;
}
.quota-item {
  display: grid; gap: 5px; min-width: 0; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: #fbf8f1;
  font-size: 13px;
}
.quota-value {
  display: block; color: var(--text); font-family: var(--title); font-size: clamp(23px, 3vw, 34px);
  font-weight: 750; line-height: 1.15; overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.quota-item progress { margin: 5px 0 3px; height: 7px; }
.quota-table { width: 100%; border-collapse: collapse; color: var(--soft); font-size: 13px; }
.quota-table th, .quota-table td, .quota-table > div {
  padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere;
}
.quota-table td:first-child, .quota-table th:first-child, .quota-table > div { padding-left: 0; }
.quota-table td:last-child, .quota-table th:last-child { padding-right: 0; text-align: right; }
.quota-table > div { display: flex; justify-content: space-between; gap: 10px; }
.quota-table th { color: var(--muted); font-weight: 700; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 169px minmax(0, 1fr); }
  .rail { padding-inline: 11px; }
  .content { padding: 26px 24px 37px; }
  .hero-copy { width: 57%; padding-left: 23px; }
  .hero-actions { padding-left: 23px; }
  .welcome { width: calc(100% - 52px); }
  .welcome-inner { grid-template-columns: minmax(287px, 1fr) minmax(0, .88fr); gap: 24px; }
  .welcome-content { padding: 20px 0; }
}
@media (max-width: 680px) {
  :root {
    --title: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    --base: #f5f6f4;
    --panel: #fff;
    --line: #e7e9e6;
    --text: #28333f;
    --muted: #68717a;
  }
  body:has(.layout) { height: var(--app-height, 100dvh); min-height: 0; overflow: hidden; }
  .layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; height: var(--app-height, 100dvh); min-height: 0; overflow: hidden; }
  .rail { display: none; }
  .content-area { height: 100%; min-height: 0; overflow: hidden; background: var(--base); }
  .content { position: relative; height: 100%; padding: max(22px, env(safe-area-inset-top)) 16px 24px; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: none; }
  .content::-webkit-scrollbar { display: none; }
  .mobile-brand { position: absolute; z-index: 2; top: max(14px, env(safe-area-inset-top)); right: 16px; display: flex; justify-content: flex-end; height: 44px; color: var(--accent-strong); font-size: 14px; font-weight: 700; }
  .mobile-brand > span { display: flex; align-items: center; gap: 8px; }
  .layout:not(.layout-room) .mobile-brand > span { display: none; }
  .mobile-brand img { width: 30px; height: 30px; border-radius: 10px; object-fit: cover; }
  .mobile-settings { width: 44px; height: 44px; border-color: transparent; border-radius: 50%; background: #e9ede9; }
  .mobile-navigation {
    position: relative; z-index: 10; inset: auto;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
    height: calc(66px + env(safe-area-inset-bottom));
    padding: 6px max(12px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border: 0; border-top: 1px solid var(--line); border-radius: 0;
    background: #fffdf9; backdrop-filter: none; box-shadow: none;
  }
  .mobile-navigation .nav-button { justify-content: center; flex-direction: column; gap: 3px; min-height: 50px; padding: 3px 2px; border: 0; border-radius: 12px; background: transparent; color: #75808a; font-size: 11px; font-weight: 500; transition: color var(--motion-press), background-color var(--motion-press); }
  .mobile-navigation .nav-glyph { width: 40px; height: 25px; border-radius: 14px; transition: color var(--motion-press), transform var(--motion-press) var(--ease-out); }
  .mobile-navigation .nav-button[aria-current="page"] { color: var(--accent-strong); font-weight: 750; }
  .mobile-navigation .nav-button[aria-current="page"] .nav-glyph { color: var(--accent-strong); background: transparent; }
  .mobile-navigation .nav-button[aria-current="page"] svg { fill: #dbe4f040; stroke-width: 2; }
  .mobile-navigation .nav-button:active .nav-glyph { transform: scale(.95); }
  .mobile-navigation svg { width: 22px; height: 22px; }
  .page-top { min-height: 44px; margin-bottom: 22px; padding-right: 56px; }
  .page-top h1 { font-size: 27px; letter-spacing: -.03em; font-weight: 750; }
  .picker select { max-width: 105px; padding: 5px 7px; font-size: 13px; }
  .hero { min-height: clamp(338px, 94vw, 410px); border-radius: 17px; }
  .hero.character-scene { min-height: clamp(387px, 102vw, 410px); }
  .hero-copy { width: 95%; padding: 16px 16px 0; }
  .hero-copy h2 { margin-top: 7px; font-size: 43px; }
  .hero-new .hero-copy h2 { max-width: 11em; font-size: 39px; }
  .hero-copy p { margin-top: 6px; font-size: 13px; text-shadow: 0 1px 8px #12182b; }
  .hero-shade { background: linear-gradient(180deg, #111629f2 0, transparent 44%, transparent 71%, #111629f0 100%); }
  .hero-image { object-position: 56% 53%; }
  .hero.character-scene .hero-shade { background: linear-gradient(180deg, #141b2bc0 0%, transparent 38%, transparent 70%, #141b2bf0 100%); }
  .hero.character-scene::before { inset: 19% 12% 16%; }
  .hero .character-art { inset: 29% 11% auto; width: 78%; height: 57%; }
  .hero-actions { padding: 12px 14px 14px; }
  .hero-actions .button { flex: 1; }
  .home-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { gap: 10px; }
  .home-grid, .journal { margin-top: 15px; }
  .home-grid > .panel + .panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel { padding: 18px; border-color: #e6e9e5; border-radius: 20px; background: var(--panel); box-shadow: none; }
  .chat-panel { padding: 0; height: max(335px, calc(100dvh - 200px - env(safe-area-inset-bottom))); }
  .chat-header { padding: 10px 11px; }
  .messages { padding: 14px 12px; }
  .message { max-width: 89%; }
  .chat-bubble { padding: 9px 11px; font-size: 14px; }
  .composer-area { padding: 9px 10px 10px; }
  .composer-area .format-hint { display: none; }
  .composer textarea { font-size: 16px; }
  .composer button { padding-inline: 11px; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); border-radius: 999px; font-size: 13px; pointer-events: none; }
  dialog { inset: auto 0 0; width: 100%; max-width: none; max-height: calc(var(--app-height, 100dvh) - 36px); margin: auto 0 0; padding-bottom: env(safe-area-inset-bottom); border: 0; border-radius: 28px 28px 0 0; box-shadow: 0 -8px 42px #1b2a3f30; }
  dialog[open] { animation: mobile-sheet-enter var(--motion-panel) var(--ease-out); }
  .sheet-content { padding: 24px 22px; }
  .sheet-header h2 { font-size: 21px; letter-spacing: -.02em; }
  @keyframes mobile-sheet-enter { from { opacity: .75; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
  .account-gate { margin-top: 20px; }
  .welcome { width: min(calc(100% - 34px), 460px); padding: max(10px, env(safe-area-inset-top)) 0 22px; }
  .welcome-brand { min-height: 44px; margin-bottom: 9px; padding-bottom: 7px; }
  .welcome-brand .brand-img { width: 32px; height: 32px; border-radius: 10px; }
  .welcome-brand .brand strong { font-size: 20px; }
  .welcome-header-action { gap: 4px; }
  .welcome-header-action .button { min-height: 34px; padding: 5px 8px; }
  .welcome-inner { display: flex; flex-direction: column; gap: 13px; }
  .welcome-room { order: -1; width: 100%; border-radius: 14px; box-shadow: none; }
  .welcome-content { width: 100%; padding: 0; }
  .welcome-visual { order: -1; min-height: 0; height: clamp(68px, 11vh, 95px); flex: none; border-radius: 11px; box-shadow: none; }
  .welcome-art { object-position: 58% 49%; }
  .welcome-shade { background: none; }
  .welcome-visual.character-scene::before { inset: 8% 20% 8%; }
  .welcome-visual .character-art { inset: 3% 12% auto; width: 76%; height: 94%; }
  .welcome-visual-caption { display: none; }
  .welcome-intro { margin-bottom: 11px; }
  .welcome h1 { font-size: clamp(30px, 7.8vw, 45px); }
  .welcome-intro p { margin-top: 5px; line-height: 1.45; font-size: 13px; }
  .welcome-tabs { margin-bottom: 10px; padding: 3px; }
  .welcome-tab { min-height: 32px; padding: 3px 7px; font-size: 13px; }
  .welcome-form, .welcome-form > form { gap: 7px; }
  .welcome-form .field { gap: 3px; }
  .welcome-form input { min-height: 43px; padding: 7px 10px; }
  .welcome-form .primary { min-height: 43px; }
  .welcome-note { margin-top: 7px; }
  .quick-links { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
  .quick-link { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 6px; padding: 10px 8px; }
  .quick-link > .symbol { width: 29px; height: 29px; border-radius: 8px; }
  .quick-link > .symbol svg { width: 16px; height: 16px; }
  .quick-link > svg:last-child { display: none; }
  .quick-link strong { font-size: 13px; line-height: 1.35; }
  .quick-link small { font-size: 11px; line-height: 1.4; }
  .market-grid { margin-top: 14px; gap: 11px; }
  .plugin-card { padding: 16px; gap: 10px; }
  .quota-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
  .quota-item { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.character-scene .pet-actor {
  display: grid;
  place-items: center;
  position: absolute;
  z-index: 1;
  padding: 0;
  border: 0;
  background: transparent;
  transform-origin: 50% 84%;
}
.pet-actor:focus-visible { outline-color: #e5ebeb; }
.pet-frame {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}
.pet-blink { opacity: 0; }
.character-scene .pet-actor[data-pose="idle"] { animation: breathing 5.8s ease-in-out infinite; }
.pet-actor[data-pose="idle"] .pet-open { animation: eyes-open 7.4s steps(1, end) infinite; }
.pet-actor[data-pose="idle"] .pet-blink { animation: eyes-closed 7.4s steps(1, end) infinite; }
.character-scene .pet-actor[data-pose="wave"] { animation: waving 1.52s ease-in-out both; }
.character-scene .pet-actor[data-pose="happy"] { animation: joyful 1.5s cubic-bezier(.26,.67,.45,1) both; }
.character-scene .pet-actor[data-pose="think"] { animation: pondering 2.8s ease-in-out infinite; }
.character-scene .pet-actor[data-pose="rest"] { animation: breathing 8.8s ease-in-out infinite; }
@keyframes breathing { 0%, 100% { transform: translateY(1px) scale(1); } 50% { transform: translateY(-6px) scale(1.012); } }
@keyframes eyes-open { 0%, 31%, 73%, 100% { opacity: 1; } 28.5%, 70.5% { opacity: 0; } }
@keyframes eyes-closed { 0%, 31%, 73%, 100% { opacity: 0; } 28.5%, 70.5% { opacity: 1; } }
@keyframes waving {
  0%, 100% { transform: rotate(0) translateY(0); }
  18%, 54% { transform: rotate(-5deg) translateY(-8px); }
  35%, 71% { transform: rotate(3deg) translateY(-3px); }
}
@keyframes joyful {
  0%, 32%, 67%, 100% { transform: translateY(0) scale(1); }
  17% { transform: translateY(-23px) scale(1.055); }
  50% { transform: translateY(-13px) scale(1.03); }
}
@keyframes pondering { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2deg) translateY(-4px); } }
.hero-copy, .hero-actions { position: relative; z-index: 2; }
.welcome-visual-caption { position: relative; z-index: 2; pointer-events: none; }
.hero-shade, .welcome-shade { pointer-events: none; }
.pet-touch-hint {
  position: absolute;
  right: 18px;
  bottom: 14px;
  color: #dcded5;
  font-size: 11px;
  pointer-events: none;
}
.character-sheet {
  object-fit: contain;
  padding: 12px;
  background: radial-gradient(ellipse, #638393, #213e58);
}
.chat-stage {
  position: relative;
  min-width: 0;
  min-height: 255px;
  overflow: hidden;
  isolation: isolate;
  border-radius: 18px;
  border: 1px solid #2c4459;
}
.chat-stage .status-pill { position: absolute; z-index: 2; left: 12px; top: 12px; }
.chat-stage.character-scene::before { inset: 16% 9% 13%; }
.chat-stage .chat-art { inset: 12% 4% 4%; width: 92%; height: 84%; filter: drop-shadow(0 14px 20px #132234a6); }
.journal-layout { display: grid; gap: 16px; }
.journal-days li { align-items: flex-start; padding: 12px 0; }
.journal-days time { font-weight: 650; }
.journal-note { margin: 5px 0 7px; white-space: pre-wrap; overflow-wrap: anywhere; }
.marketplace-head { display: flex; gap: 12px; align-items: center; margin-bottom: 15px; }
.marketplace-head .plugin-slot { margin-left: auto; white-space: nowrap; color: var(--muted); font-size: 13px; }
.spaced-panel { margin-top: 16px; }
.settings .archived-row, .archived-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; }
.plugin-report { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.plugin-report div { padding: 9px; border: 1px solid var(--line); border-radius: 10px; }
.plugin-report dt { color: var(--muted); font-size: 13px; }
.plugin-report dd { margin: 3px 0 0; font-weight: 750; }
.milestone-list { display: grid; gap: 5px; list-style: none; padding: 0; margin: 0; }
.milestone-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.milestone-list time { display: block; color: var(--muted); font-size: 12px; }

.room-panel { max-width: max(624px, calc(150svh - 294px)); margin-inline: auto; }
.room-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.room-identity { display: flex; align-items: center; min-width: 0; }
.room-avatar, .room-settings { display: none; }
.room-heading h1 { font-family: var(--title); font-size: clamp(29px, 3.65vw, 45px); line-height: 1.12; letter-spacing: -.045em; overflow-wrap: anywhere; }
.room-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.room-status { display: flex; align-items: center; gap: 8px; }
.room-indicator { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #6d886d; box-shadow: 0 0 0 3px #6d886d21; }
.room-scene, .room-panel > .room-stage {
  position: relative;
  isolation: isolate;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 1px solid #90755862;
  border-radius: 25px;
  background: #a88973;
  box-shadow: 0 18px 33px #755a3626, 0 3px 8px #51371d19;
}
.room-panel > .room-stage + .room-heading { margin: 21px 0 0; }
.room-scene .room-stage { position: absolute; inset: 0; }
.room-preview { display: block; width: 100%; height: 100%; object-fit: cover; }
.room-stage[data-room-night="true"] { background: #171e37; }
.room-canvas { display: block; width: 100%; height: 100%; cursor: pointer; touch-action: pan-y; }
.room-loading { height: 100%; display: grid; gap: 8px; place-content: center; text-align: center; justify-items: center; color: var(--muted); }
.room-loading img { width: 57px; height: 57px; border-radius: 16px; }
.room-light, .room-camera, .room-link a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #fff3db56;
  border-radius: 999px;
  color: #fff9ee;
  background: #29232acf;
  backdrop-filter: blur(10px);
  box-shadow: 0 3px 12px #20140028;
  font-size: 12px;
  font-weight: 620;
}
.room-light { position: absolute; top: 13px; right: 13px; padding-right: 8px; }
.room-light select { width: auto; min-height: 40px; padding: 3px 0; border: 0; border-radius: 0; color: inherit; background: transparent; font: inherit; cursor: pointer; }
.room-light select option { background: #302a2c; color: #fff9ee; }
.room-light svg, .room-camera svg, .room-link svg { width: 16px; height: 16px; }
.scene-toolbar { position: absolute; inset: auto 13px 13px; display: flex; justify-content: space-between; align-items: end; gap: 8px; pointer-events: none; }
.scene-toolbar > :is(button, p) { pointer-events: auto; }
.room-camera { margin-left: auto; transition: background-color .18s ease, transform .18s ease; }
.room-camera:hover, .room-link a:hover { background: #261d23ef; }
.room-camera:active { transform: scale(.96); }
.room-link a { text-decoration: none; }
.room-link:empty { display: none; }
.room-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 17px; }
.room-action {
  display: flex;
  width: 100%;
  min-height: 51px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 7px;
  border: 1px solid #eae1d7;
  border-radius: 15px;
  color: #504036;
  background: #fffaf3;
  box-shadow: 0 2px 5px #533a1e09;
  font-size: 13px;
  font-weight: 670;
  text-align: center;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}
.room-action svg { width: 20px; height: 20px; color: #845941; }
.room-action:not(:disabled):hover, .room-action-menu[open] .room-action { border-color: #d8c7b4; background: #fbf0e2; }
.room-action:not(:disabled):active { transform: scale(.97); }
.room-feed { border-color: var(--accent-line); color: var(--accent-strong); background: var(--accent-veil); }
.room-feed svg { color: var(--accent); }
.room-feed:not(:disabled):hover { border-color: #bac8e0; background: #dde6f4; }
.room-action-menu { position: relative; min-width: 0; }
.room-action-menu summary { list-style: none; }
.room-action-menu summary::-webkit-details-marker { display: none; }
.room-action-options {
  position: absolute;
  z-index: 2;
  bottom: calc(100% + 8px);
  right: 0;
  display: grid;
  width: 166px;
  padding: 6px;
  border: 1px solid #e8dcce;
  border-radius: 15px;
  background: var(--panel);
  box-shadow: 0 8px 24px #4a382c30;
}
.room-action-menu[open] .room-action-options { animation: room-menu-in .16s ease-out; }
@keyframes room-menu-in { from { opacity: 0; transform: translateY(5px); } }
.room-action-options button { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; font-size: 13px; }
.room-action-options svg { width: 18px; height: 18px; color: #845941; }
.room-action-options button:hover { background: #f3e9dd; }
.market-filters { display: flex; gap: 10px; align-items: center; margin-bottom: 15px; }
.market-filters input { flex: 1; }
.billing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.billing-grid > div { padding: 11px; border: 1px solid var(--line); border-radius: 12px; }
.billing-grid dt, .billing-grid small { color: var(--muted); font-size: 12px; }
.billing-grid dd { margin: 3px 0; font-weight: 730; overflow-wrap: anywhere; }
.compact-disclosure:not(.panel) { margin-top: 8px; border-top: 1px solid var(--line); }
.compact-disclosure > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 9px 4px; border-radius: 7px; list-style: none;
  cursor: pointer; color: var(--accent-strong); font-size: 14px; font-weight: 680;
}
.compact-disclosure > summary::-webkit-details-marker { display: none; }
.compact-disclosure > summary::after {
  content: ''; flex: none; width: 7px; height: 7px; margin: -4px 4px 0 0;
  border: solid var(--accent); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.compact-disclosure > summary:hover { background: #f5eee3; }
.compact-disclosure[open] > summary { margin-bottom: 10px; }
.compact-disclosure[open] > summary::after { margin-top: 4px; transform: rotate(225deg); }
.disclosure-label { display: flex; align-items: center; gap: 9px; }
.disclosure-label svg { width: 17px; height: 17px; color: var(--accent); }
.panel.journal-editor { padding-block: 5px; }
.panel.journal-editor[open] { padding-bottom: 16px; }
.activity-log .journal-days { padding-left: 22px; }
.activity-log .journal-days > li {
  position: relative; display: grid; grid-template-columns: minmax(80px, .29fr) minmax(0, 1fr);
  min-height: 50px; gap: 10px 14px; padding: 13px 0;
}
.activity-log .journal-days > li::before {
  content: ''; position: absolute; z-index: 1; top: 19px; left: -21px;
  width: 8px; height: 8px; border: 1.5px solid #a6b1c2; border-radius: 50%; background: var(--panel);
}
.activity-log .journal-days > li:not(:last-child)::after {
  content: ''; position: absolute; top: 23px; bottom: -22px; left: -17.5px; width: 1px; background: var(--accent-line);
}
.activity-log .journal-days > li[data-today="true"]::before { border-color: var(--accent); background: var(--accent); }
.activity-log .activity-date { display: grid; gap: 2px; margin: 0; font-size: 12px; line-height: 1.45; }
.activity-date strong { color: var(--accent-strong); font-size: 14px; }
.activity-day { min-width: 0; }
.activity-day-events { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 14px; color: var(--text); font-size: 14px; }
.activity-event { display: inline-flex; align-items: center; gap: 5px; }
.activity-event svg { width: 15px; height: 15px; }
.activity-growth { color: var(--muted); font-size: 12px; }
.activity-log .journal-note {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px;
  margin: 6px 0 0; padding: 4px 0 4px 8px; border-left: 2px solid #d7c5b6; color: var(--soft); line-height: 1.55;
}
.activity-log .journal-note:first-child { margin-top: 0; }
.activity-log .journal-note > .muted { font-size: 12px; font-weight: 650; }
.activity-log > .button { margin-top: 6px; }
.usage-meter {
  padding: clamp(14px, 3.4vw, 20px); border-radius: 13px;
  background: linear-gradient(115deg, #263958, #3b5278); color: #fffdf8;
}
.usage-meter-grid { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 18px; }
.usage-total { display: grid; min-width: 0; gap: 2px; }
.usage-total > span, .usage-budget-totals dt { color: #e1e9f6; font-size: 13px; }
.usage-total .quota-value { color: inherit; font-size: clamp(33px, 6vw, 48px); letter-spacing: -.025em; }
.usage-total small { color: #e1e9f6; font-family: Inter, sans-serif; font-size: 13px; font-weight: 610; letter-spacing: 0; }
.usage-budget-totals { display: flex; flex-wrap: wrap; gap: 10px 18px; min-width: 0; margin: 0; }
.usage-budget-totals div { min-width: 0; }
.usage-budget-totals dd { margin: 1px 0 0; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.usage-budget-status { margin-top: 9px; color: #ffe0c6; font-size: 13px; }
.usage-receipt-list { margin: 18px 0 10px; }
.usage-receipt-list h3 { margin-bottom: 8px; color: var(--accent-strong); font-size: 15px; }
.usage-receipt-list > .panel-helper { margin-top: 8px; font-size: 12px; }
.usage-receipts { font-variant-numeric: tabular-nums; }
.usage-receipts th, .usage-receipts td { padding-block: 7px; overflow-wrap: anywhere; }
.usage-receipts th { background: #f3eee6; font-size: 12px; }
.usage-receipts th:first-child { padding-left: 8px; border-top-left-radius: 8px; }
.usage-receipts th:last-child { padding-right: 8px; border-top-right-radius: 8px; }
.usage-receipts td:last-child { color: var(--accent-strong); font-weight: 700; }
.usage-receipts tbody tr:last-child td { border-bottom: 0; }
.resource-usage .resource-totals { gap: 0; margin-bottom: 5px; padding-bottom: 4px; }
.resource-usage .resource-totals > div { padding: 5px 10px; border: 0; border-radius: 0; }
.resource-usage .resource-totals > div:first-child { padding-left: 0; }
.resource-usage .resource-totals > div + div { border-left: 1px solid var(--line); }
.resource-usage .resource-totals dd { color: var(--accent-strong); font-size: 15px; }
.resource-details > .panel-helper { margin-bottom: 8px; }
.model-usage-details { margin-top: 18px; }
.model-usage-details summary { cursor: pointer; font-weight: 660; }
.model-usage-details .panel-helper { margin-top: 9px; }
.model-usage-details .quota-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, .8fr); overflow-wrap: anywhere; }
.model-usage-details .quota-row > :last-child { text-align: right; }
.model-usage-history { margin-top: 14px; }
.model-usage-details .model-usage-history .quota-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.chat-budget-notice { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.market-grid p, .plugin-actions a { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .chat-stage { order: -1; min-height: 122px; }
  .chat-stage .chat-art { inset: 7% 18% 4%; width: 64%; height: 89%; }
}
@media (max-width: 680px) {
  .pet-touch-hint { top: 15px; right: 14px; bottom: auto; }
  .hero-copy { pointer-events: none; }
  .layout-room .mobile-brand { display: none; }
  .layout-room .content { padding: 0; overflow: hidden; }
  .layout-room .room-panel { position: relative; height: 100%; min-height: 0; max-width: none; margin: 0; }
  .layout-room .room-heading {
    position: absolute; z-index: 4; top: calc(14px + env(safe-area-inset-top)); left: 18px; right: 18px;
    display: flex; gap: 12px; margin: 0; padding: 0; color: #fff; pointer-events: none;
  }
  .layout-room .room-identity { flex: 1; gap: 10px; min-width: 0; }
  .layout-room .room-identity > div { min-width: 0; }
  .layout-room .room-avatar { display: block; width: 42px; height: 42px; flex: 0 0 auto; object-fit: cover; border: 1.5px solid #fff9; border-radius: 15px; box-shadow: 0 3px 9px #12203924; }
  .layout-room .room-heading h1 { overflow: hidden; font-family: var(--title); font-size: 19px; font-weight: 750; line-height: 1.3; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 7px #14203570; }
  .layout-room .room-title-suffix { display: none; }
  .layout-room .room-status { overflow: hidden; margin-top: 3px; color: #fffdf5; font-size: 11px; line-height: 1.5; text-shadow: 0 1px 5px #172735b0; }
  .layout-room [data-room-status] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .layout-room .room-indicator { width: 5px; height: 5px; background: #b2d4b2; box-shadow: 0 0 0 2px #cfeccf25; }
  .layout-room .room-settings { display: grid; width: 44px; height: 44px; border: 1px solid #fff4; border-radius: 50%; color: #fff; background: #13263935; backdrop-filter: blur(12px); pointer-events: auto; transition: background-color var(--motion-press); }
  .layout-room .room-settings:active { background: #13263980; }
  .layout-room .picker { pointer-events: auto; }
  .layout-room .room-scene {
    height: 100%; min-height: 0; width: 100%; aspect-ratio: auto;
    border: 0; border-radius: 0; box-shadow: none;
  }
  .layout-room .room-scene::after {
    content: ''; position: absolute; z-index: 1; inset: 0; pointer-events: none;
    background: linear-gradient(180deg, #10233482, #14263610 25%, transparent 46%, transparent 80%, #1827351c);
  }
  .layout-room .room-light { z-index: 3; top: calc(74px + env(safe-area-inset-top)); right: 18px; min-height: 36px; padding: 0 10px; border: 1px solid #fff3; background: #1c2b375c; font-size: 11px; box-shadow: none; }
  .layout-room .room-light select { min-height: 36px; font-size: 11px; }
  .layout-room .room-light svg { width: 15px; height: 15px; }
  .layout-room .scene-toolbar { z-index: 3; inset: auto 16px 18px; }
  .layout-room .room-camera { width: 44px; min-height: 44px; justify-content: center; padding: 0; border-color: #fff4; background: #1c2b375c; box-shadow: none; }
  .layout-room .room-camera span { display: none; }
  .layout-room .room-camera svg { width: 20px; height: 20px; }
  .layout-room .home-content > .room-panel { display: grid; grid-template-rows: minmax(0, 1fr) 112px; }
  .layout-room .home-content > .room-panel .room-scene { border-radius: 0 0 30px 30px; }
  .layout-room .room-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 12px 16px 10px; background: #fffdf9; }
  .layout-room .room-action { display: flex; flex-direction: column; justify-content: center; gap: 7px; min-height: 84px; padding: 0; border: 0; border-radius: 16px; background: transparent; color: #6a625b; box-shadow: none; font-size: 11px; font-weight: 600; }
  .layout-room .room-action > svg { box-sizing: content-box; width: 21px; height: 21px; padding: 12px; border-radius: 16px; background: #f2ece3; color: #8a694c; transition: background-color var(--motion-press), transform var(--motion-press) var(--ease-out); }
  .layout-room .room-feed > svg { color: #344f74; background: #e8eef7; }
  .layout-room .room-action:not(:disabled):active > svg { transform: scale(.96); background: #e4ddcf; }
  .layout-room .room-action-menu summary { height: 100%; }
  .layout-room .room-action-options { z-index: 5; bottom: calc(100% + 16px); padding: 8px; border-color: #ece7df; border-radius: 20px; }
  .layout-room .room-action-options button { min-height: 48px; border-radius: 12px; }
  .layout-room .room-action-menu[open] .room-action-options { animation-duration: var(--motion-panel); }
  .room-conversation {
    display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(180px, 56%) minmax(72px, 1fr) auto;
    grid-template-areas: "room" "history" "composer"; gap: 0; height: 100%; min-height: 0;
    overflow: hidden; background: #fffdf9;
  }
  .room-conversation .conversation-room { min-height: 0; height: 100%; }
  .room-conversation .conversation-room .room-scene { border-radius: 0 0 28px 28px; }
  .conversation-composer { position: relative; z-index: 3; flex-shrink: 0; margin: 0; padding: 10px 16px 12px; border: 0; border-radius: 0; background: #fffdf9; box-shadow: 0 -8px 18px #fffdf9; }
  .conversation-composer .composer { gap: 10px; align-items: flex-end; padding: 0; }
  .conversation-composer .composer textarea { min-height: 46px; max-height: 90px; padding: 11px 15px; border: 1px solid #e9ebe8; border-radius: 23px; background: #f0f2ee; font-size: 15px; line-height: 1.5; resize: none; }
  .conversation-composer .composer textarea:focus { border-color: #b8c9dc; background: #f7f9f5; }
  .conversation-composer .composer button { min-width: 46px; width: 46px; min-height: 46px; height: 46px; padding: 0; border-radius: 50%; background: #3d567d; box-shadow: 0 3px 8px #233f6429; }
  .conversation-composer .composer button svg { width: 20px; height: 20px; }
  .conversation-composer .composer button span { display: none; }
  .conversation-composer .prompts { gap: 8px; }
  .conversation-composer .prompt-chip { padding: 4px 10px; min-height: 30px; border: 0; font-size: 11px; background: #edf0f5; }
  .conversation-history {
    position: relative; z-index: auto; inset: auto; width: 100%;
    display: flex; flex-direction: column; height: 100%; min-height: 0; margin: 0;
    border: 0; border-radius: 0; background: #fffdf9; box-shadow: none;
    visibility: visible; transform: none; transition: none;
  }
  .conversation-history .history-heading { flex: 0 0 auto; min-height: 35px; padding: 11px 20px 5px; border: 0; }
  .conversation-history .history-heading h2 { font-size: 11px; font-weight: 600; color: #777f84; letter-spacing: .02em; }
  .conversation-history .messages { position: relative; inset: auto; gap: 16px; min-height: 0; flex: 1; padding: 10px 20px 14px; scrollbar-width: thin; scrollbar-color: #d5dcd6 transparent; }
  .room-conversation:has(.room-speech[data-pending="false"][data-dismissed="false"]:not([hidden])) .conversation-history [data-latest-reply] { display: none; }
  .history-toggle, .history-close { display: none; }
  .conversation-caption { display: none; }
  .speech-content { font-size: 13px; }
  .room-scene, .room-panel > .room-stage { border-radius: 22px; }
  .layout-room .room-scene[data-focused="true"] { aspect-ratio: auto; }
  .room-panel:not(:has(.room-settings)) .room-heading { margin-top: 16px; }
  .billing-grid { grid-template-columns: minmax(0, 1fr); }
  .resource-totals:has(> :nth-child(3)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .resource-totals > div { padding: 8px; }
  .activity-log .activity-day { display: contents; }
  .activity-log .journal-note { grid-column: 1 / -1; margin-top: 0; }
}
@media (max-width: 680px) and (max-height: 620px) {
  .room-conversation { grid-template-rows: minmax(140px, 49%) minmax(56px, 1fr) auto; }
  .layout-room .room-light { top: calc(65px + env(safe-area-inset-top)); min-height: 32px; }
  .layout-room .room-light select { min-height: 32px; }
  .layout-room .room-heading { top: calc(10px + env(safe-area-inset-top)); }
  .layout-room .home-content > .room-panel { grid-template-rows: minmax(0, 1fr) 94px; }
  .layout-room .room-controls { padding-block: 6px; }
  .layout-room .room-action { min-height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .character-scene .pet-actor, .pet-actor[data-pose] .pet-frame { animation: none !important; }
  .room-action-menu[open] .room-action-options { animation: none; }
  .room-action, .room-camera, .nav-glyph { transition: none; }
  .speech-thinking span { animation: none; }
  .conversation-history { transition: none; }
  .room-speech { transition: none; }
  dialog[open] { animation: none; }
}

/* Paper surround and enamel controls for the illustrated room. */
.layout-room, .welcome {
  --paper: #f8f4e9;
  --paper-line: #dcd3c0;
  --room-ink: #263f40;
  --room-muted: #645f50;
  --room-serif: "STSong", "Songti SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
}
.layout-room:has(.room-light[data-night="true"]) {
  --paper: #253638;
  --paper-line: #4c5b58;
  --room-ink: #f7efde;
  --room-muted: #c8c4b6;
}
.layout-room .content-area { background: var(--paper); }
.layout-room .room-heading { color: var(--room-ink); }
.layout-room .room-identity { gap: 15px; min-width: 0; flex: 1; }
.room-calendar {
  display: grid; flex: 0 0 auto; width: 47px; text-align: center; align-content: center;
  border: 1px solid #b8aa8e; border-radius: 5px; background: #fff9e8;
  color: #393c35; box-shadow: 0 2px 0 -1px #fff9e8, 0 3px 0 -1px #b8aa8e;
  overflow: hidden;
}
.room-calendar small { padding: 1px 2px; background: #83523e; color: #fff9e8; font-size: 10px; line-height: 16px; letter-spacing: .06em; }
.room-calendar b { font: 25px/29px Georgia, "Times New Roman", serif; font-variant-numeric: lining-nums tabular-nums; }
.layout-room .room-name { min-width: 0; }
.layout-room .room-heading h1 { font-family: var(--room-serif); letter-spacing: .025em; line-height: 1.25; }
.layout-room .room-title-suffix { font-size: .72em; font-weight: 500; }
.layout-room .room-status { color: var(--room-muted); }
.layout-room .room-indicator { background: #739a80; box-shadow: none; }
.layout-room .room-action .room-object {
  box-sizing: border-box; width: 42px; height: 40px; padding: 0; border-radius: 0;
  background: none; filter: drop-shadow(0 2px 1px #44351e1d);
  transform-origin: 50% 80%; transition: transform .23s cubic-bezier(.2,.8,.3,1);
}
.layout-room .room-action:active .room-object,
.layout-room .room-action:not(:disabled):active > .room-object { background: none; transform: translateY(1px) rotate(-4deg) scale(.94); }
.layout-room .room-controls { background: var(--paper); }
.layout-room .room-action { color: var(--room-ink); }
.layout-room .room-action-options { background: #fffbef; color: #383e35; }
.layout-room .room-action-options button:hover { background: #f1ead9; }
.layout-room .room-scene::before {
  content: ""; position: absolute; inset: 4px; z-index: 1; pointer-events: none;
  border: 1px solid #fff5d950; border-radius: inherit;
}
.history-heading h2 { display: flex; align-items: center; gap: 9px; }
.history-heading h2::before { content: ""; width: 4px; height: 12px; background: #af794e; border-radius: 2px; }
.welcome .welcome-room { border: 4px solid #fff9eb; border-radius: 40px 12px 32px 12px; outline: 1px solid #d2c7b2; }
.welcome h1 { color: var(--room-ink); font-family: var(--room-serif); }
.welcome .welcome-submit { background: #29494a; border-color: #29494a; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .room-action:not(:disabled):hover .room-object { transform: translateY(-2px) rotate(-3deg); }
}
@media (min-width: 681px) {
  .rail { background: #253e40; border-color: #314e50; color: #fff7e6; }
  .rail .brand { border-bottom: 1px solid #ffffff26; margin-bottom: 24px; padding-bottom: 23px; }
  .rail .brand-img { border: 1px solid #f0dfba88; }
  .rail :is(.nav-button,.rail-account) { color: #dbdfd5; }
  .rail :is(.nav-button,.rail-account):hover { background: #355052; color: #fff9ec; }
  .rail [aria-current="page"] { background: #f3e8ce; color: #253e40; border-color: transparent; }
  .rail [aria-current="page"] svg { color: inherit; }
  .layout-room .room-heading { margin-bottom: 20px; }
  .layout-room .room-heading h1 { font-size: clamp(25px, 2.7vw, 40px); }
  .layout-room .room-scene { border-radius: 32px 10px 32px 10px; border-color: var(--paper-line); box-shadow: 0 5px 17px #4a3b2015; }
  .layout-room .room-controls { padding: 8px 0; border-block: 1px solid var(--paper-line); gap: 0; }
  .layout-room .room-action { border: 0; border-radius: 8px; background: transparent; box-shadow: none; gap: 12px; }
  .layout-room .room-action:not(:disabled):hover { background: color-mix(in srgb, var(--room-ink) 7%, transparent); }
  .conversation-history, .conversation-composer { background: #fffbf2; }
}
@media (max-width: 680px) {
  .layout { background: #f8f4e9; }
  .layout-room { background: var(--paper); }
  .layout-room .content { padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
  .layout-room .room-heading {
    position: relative; inset: auto; min-height: 0; margin: 0; padding: 0 8px; align-items: center;
    pointer-events: auto; gap: 8px;
  }
  .layout-room .room-identity { gap: 12px; }
  .layout-room .room-calendar { width: 39px; }
  .layout-room .room-calendar b { font-size: 22px; line-height: 24px; }
  .layout-room .room-calendar small { font-size: 9px; line-height: 14px; }
  .layout-room .room-heading h1 { font-size: 23px; text-shadow: none; }
  .layout-room .room-title-suffix { display: inline; }
  .layout-room .room-status { margin-top: 3px; text-shadow: none; font-size: 11px; }
  .layout-room .room-settings { background: transparent; backdrop-filter: none; color: var(--room-ink); border-color: var(--paper-line); }
  .layout-room .room-settings:active { background: color-mix(in srgb, var(--room-ink) 12%, transparent); }
  .layout-room .home-content > .room-panel { grid-template-rows: 78px minmax(0,1fr) 85px; }
  .room-conversation .conversation-room { display: grid; grid-template-rows: 78px minmax(0,1fr); }
  .layout-room .home-content > .room-panel .room-scene,
  .room-conversation .conversation-room .room-scene {
    border-radius: 28px 9px 28px 9px; border: 1px solid var(--paper-line); box-shadow: 0 2px 5px #48341f14;
  }
  .layout-room .room-scene::after { background: linear-gradient(0deg,#2a221e2c,transparent 18%); }
  .layout-room .room-light { inset: 10px 10px auto auto; min-height: 44px; padding: 0 11px; background: #272e2cd9; }
  .layout-room .room-light select { min-height: 42px; }
  .layout-room .scene-toolbar { inset: auto 12px 12px; }
  .layout-room .room-camera { background: #272e2cc9; }
  .layout-room .room-controls { padding: 4px 0; align-items: stretch; gap: 0; }
  .layout-room .room-action {
    min-height: 0; height: 100%; gap: 1px; font-size: 12px; letter-spacing: .02em; font-weight: 600;
  }
  .layout-room .room-action:not(:disabled):hover, .layout-room .room-action-menu[open] .room-action { background: transparent; }
  .layout-room .room-action:focus-visible { outline-offset: -3px; }
  .layout-room .room-action-options { bottom: calc(100% + 5px); }
  .room-conversation { background: var(--paper); grid-template-rows: minmax(190px,57%) minmax(64px,1fr) auto; }
  .conversation-history, .conversation-composer { background: var(--paper); color: var(--room-ink); }
  .conversation-history .history-heading { padding: 13px 9px 4px; }
  .conversation-history .history-heading h2 { font-family: var(--room-serif); font-size: 14px; color: var(--room-ink); }
  .conversation-history .messages { padding-inline: 11px; }
  .conversation-history .history-speaker, .history-empty { color: var(--room-muted); }
  .conversation-composer { padding: 6px 3px 7px; box-shadow: none; }
  .conversation-composer .composer { gap: 5px; padding: 3px; border: 1px solid var(--paper-line); border-radius: 25px; background: #fffcf3; }
  .conversation-composer .composer:focus-within { border-color: #788d82; }
  .conversation-composer .composer textarea, .conversation-composer .composer textarea:focus {
    border: 0; outline: 0; box-shadow: none; background: transparent; min-height: 42px; font-size: 16px; padding: 9px 12px;
  }
  .conversation-composer .composer button { background: #2c4b4c; box-shadow: none; width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .mobile-navigation {
    width: auto; margin: 0 max(10px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
    height: 56px; padding: 4px; border: 0; gap: 2px; border-radius: 22px; background: #253e40; box-shadow: inset 0 0 0 1px #ede5cb26;
  }
  .mobile-navigation .nav-button { gap: 2px; min-height: 44px; color: #d7e0d6; border-radius: 18px; }
  .mobile-navigation .nav-button[aria-current="page"] { background: #f2e7cc; color: #243f41; }
  .mobile-navigation .nav-button[aria-current="page"] .nav-glyph, .mobile-navigation .nav-button[aria-current="page"] svg { color: inherit; }
  .mobile-navigation .nav-glyph { width: 30px; height: 20px; }
  .mobile-navigation svg { width: 19px; height: 19px; }
  .layout-room .room-scene { view-transition-name: fish-room; }
  .layout-room .room-heading { view-transition-name: room-heading; }
  .mobile-navigation { view-transition-name: tab-bar; }
  .mobile-navigation .nav-button[aria-current="page"] { view-transition-name: current-tab; }
  ::view-transition-group(*) { animation-duration: 340ms; animation-timing-function: cubic-bezier(.22,.76,.2,1); }
  ::view-transition-group(fish-room) { overflow: clip; border-radius: 28px 9px 28px 9px; }
  ::view-transition-old(fish-room), ::view-transition-new(fish-room) { height: 100%; object-fit: cover; }
  ::view-transition-old(root) { animation-duration: 110ms; }
  ::view-transition-new(root) { animation-name: reveal-room-panel; }
  @keyframes reveal-room-panel { from { opacity: 0; transform: translateY(8px); } }
}
@media (max-width: 680px) and (max-height: 620px) {
  .layout-room .home-content > .room-panel { grid-template-rows: 56px minmax(0,1fr) 64px; }
  .room-conversation .conversation-room { grid-template-rows: 56px minmax(0,1fr); }
  .room-conversation { grid-template-rows: minmax(140px,48%) minmax(54px,1fr) auto; }
  .layout-room .room-action .room-object { height: 32px; }
}
@media (prefers-reduced-motion: no-preference) {
  .room-speech:not([hidden]) { animation: ink-bubble-in .2s cubic-bezier(.22,.78,.2,1); }
  @keyframes ink-bubble-in { from { opacity: 0; translate: 0 3px; } }
}
@media (prefers-reduced-motion: reduce) {
  .layout-room .room-action .room-object { transition: none; }
}
/* The side wall is a linen-covered pinboard. The frame, paper and pins scale with the scene. */
.atelier-wall { --studio-ink: #284843; min-width: 0; color: var(--studio-ink); }
.wall-heading { display: flex; align-items: center; gap: 11px; min-height: 46px; margin: 0 1px 14px; }
.wall-heading h2 { margin: 0; color: var(--room-ink, #314a42); font: 600 clamp(21px,1.8vw,32px)/1.2 "STSong","Songti SC","SimSun",serif; letter-spacing: .08em; }
.studio-seal { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid #ab795d; border-radius: 50%; color: #9a5c40; font: 25px/1 Georgia,serif; transform: rotate(-8deg); }
.wall-capacity { margin-left: auto; display: inline-flex; align-items: baseline; gap: 7px; padding-inline: 5px; color: var(--room-muted,#696858); font: 15px/1.2 Georgia,serif; font-variant-numeric: tabular-nums; }
.wall-capacity i { opacity: .6; font-weight: 400; }
.pin-surface { position: relative; isolation: isolate; display: grid; align-content: start; align-items: start; gap: 24px; padding: clamp(18px,2.3vw,43px); border: 5px solid #84664c; border-radius: 9px; box-shadow: inset 0 2px 9px #4e493e42, 0 0 0 1px #ab9579, 0 4px 10px #59452521;
 background-color: #b9b9a4; background-image: repeating-linear-gradient(0deg, transparent 0px 2px,#655c4918 2px 3px), repeating-linear-gradient(92deg,transparent 0px 2px,#fff2d833 2px 3px), linear-gradient(135deg,#e4dcc4aa,#879e8b70); }
.pin-surface::before { content: ""; position: absolute; z-index: -1; inset: 6px; border: 1px dashed #f2e5c595; border-radius: 3px; pointer-events: none; }
.pinned-piece { position: relative; min-width: 0; width: 97%; justify-self: center; padding-bottom: 17px; }
.pinned-piece.note { width: 87%; justify-self: end; }
.wall-paper { position: relative; display: block; width: 100%; text-align: left; border: 0; border-radius: 1px; background: #fcf7e8; padding: clamp(8px,1vw,17px); box-shadow: 1px 4px 7px #3a392f48; color: #354740; transform: rotate(-2deg); transform-origin: 50% 4%; }
.pinned-piece.note .wall-paper { padding: 0; transform: rotate(2.2deg); }
.wall-paper:before { content: ""; position: absolute; z-index: 1; left: calc(50% - 21px); width: 42px; height: 15px; top: -7px; transform: rotate(4deg); background: repeating-linear-gradient(95deg,#dcc49dbb 0px 2px,#ddc59fc9 2px 4px); box-shadow: 0 1px 2px #6f624222; clip-path: polygon(1% 0,100% 5%,97% 25%,100% 50%,97% 75%,100% 98%,0 100%,3% 68%,0 43%,3% 30%); }
.note .wall-paper:before { width: 10px; height: 10px; left: calc(50% - 5px); top: 4px; border-radius: 50%; clip-path: none; background: radial-gradient(circle at 30% 28%,#f2d69b,#c0995f 57%,#7d6142); box-shadow: 1px 2px 2px #645c4666; }
.atelier-wall canvas,.wall-detail canvas,.theme-list canvas { width: 100%; height: auto; display: block; background: #ebe1c6; }
.print-label,.note-writing footer { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
.print-label { padding: 9px 1px 1px; }
.print-label b { font: 600 clamp(14px,1.12vw,20px)/1.45 "STKaiti","KaiTi","SimSun",serif; }
.print-label time,.note-writing time { color: #736d59; white-space: nowrap; font: italic 11px Georgia,serif; letter-spacing: .08em; }
.note-writing { min-width: 0; padding: 23px 17px 13px; background: repeating-linear-gradient(to bottom,transparent 0 25px,#c3af8138 25px 26px) 0 12px / 100% 26px, linear-gradient(130deg,#fff2c9,#f1dfae); color: #514e3c; }
.note-writing p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; font: 500 17px/26px "STKaiti","KaiTi","FangSong",serif; }
.pinned-piece .note-writing p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-writing footer { margin-top: 9px; font: 15px/1.45 "STKaiti","KaiTi",serif; }
.unpin { position: absolute; right: -2px; bottom: -9px; background: #e8e4d3; color: #354b42; border: 1px solid #959c87; border-radius: 12px; min-height: 25px; padding: 1px 10px; font-size: 11px; }
.wall-tools,.wall-detail-tools,.wall-note-actions { display:flex; align-items:center; gap: 10px; }
.wall-tools { padding-top: 14px; }
.wall-tools button,.wall-mobile-open,.wall-empty button { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:42px; border:1px solid #a9aaa0; border-radius:7px; padding:6px 13px; background:#fffaef; color:#344e46; font-size:13px; font-weight:600; }
.wall-tools button:first-child { background:#304f49; border-color:#304f49; color:#fff8e6; flex:1.25; }
.wall-tools button:last-child { flex:1; }
.wall-tools svg { width:15px; height:15px; }
.wall-tools button span { font-size:19px; line-height:1; }
.wall-full,.wall-empty { font-size:14px; line-height:1.7; }
.wall-full { margin:12px 0 0; color:var(--room-muted,#606553); }
.wall-empty { min-height:152px; display:grid; place-content:center; justify-items:center; gap:12px; color:#304a3c; text-align:center; padding:20px; }
.wall-in-sheet .wall-heading h2,.wall-in-sheet .studio-seal { display:none; }
.wall-in-sheet .wall-heading { min-height:18px; margin:0 0 8px; }
.wall-in-sheet .pin-surface { padding:22px; }
.wall-detail { padding:13px; background:#fff8e7; box-shadow:0 2px 7px #4d48302b; }
.wall-detail.note { padding:0; }
.wall-detail-tools,.wall-note-actions { margin-top:17px; justify-content:space-between; flex-wrap:wrap; }
.theme-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.theme-list button { padding:5px; background:#f9f3e4; border:1px solid #d8cfba; border-radius:4px; }
.theme-list span { display:flex; align-items:center; justify-content:space-between; padding:8px 2px 2px; font-size:13px; }
.theme-list svg { width:14px; height:14px; }
.wall-mobile-open { display:none; }
.pin-surface:is([data-count="3"],[data-count="4"]) { grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px 12px; padding:23px 16px; }
.pin-surface:is([data-count="3"],[data-count="4"]) .pinned-piece { width:100%; }
.pin-surface:is([data-count="3"],[data-count="4"]) .print-label { flex-wrap:wrap; }
.pin-surface:is([data-count="3"],[data-count="4"]) .note-writing { padding:17px 9px 8px; }
.home-studio { min-width:0; display:grid; align-content:start; gap:clamp(20px,2.3svh,36px); }
.home-letter { min-width:0; display:grid; gap:clamp(12px,1.6svh,23px); padding:clamp(16px,1.4vw,30px);
  border:1px solid var(--paper-line); border-top:3px double #9b9b80; border-radius:3px 3px 10px 3px;
  background:color-mix(in srgb,var(--paper) 93%,#fff); color:var(--room-ink); box-shadow:0 3px 9px #524d3410; }
.home-letter header { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:6px 12px; }
.home-letter h2 { margin:0; min-width:0; overflow-wrap:anywhere; font:600 clamp(17px,1.18vw,25px)/1.4 var(--room-serif); }
.letter-history,.letter-greeting { border:0; color:var(--room-muted); background:transparent; font:inherit; }
.letter-history { display:inline-flex; align-items:center; gap:4px; padding:4px 0; font-size:12px; }
.letter-history svg { width:15px; height:15px; }
.letter-lines { min-width:0; display:grid; gap:.4em; font-size:clamp(14px,.85vw,18px); }
.letter-lines .chat-bubble { font-size:inherit; }
.letter-lines .chat-bubble > span { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.layout-room:has(.room-light[data-night="true"]) .home-letter .history-speaker { color:var(--room-muted); }
.letter-greeting { justify-self:start; border-bottom:1px dashed var(--paper-line); font-family:var(--room-serif); padding:7px 0; }
.home-letter .composer { display:flex; align-items:center; gap:6px; padding:4px; border-radius:10px; border:1px solid var(--paper-line); background:var(--paper); }
.home-letter .composer:focus-within { outline:2px solid #879a8c; outline-offset:1px; }
.home-letter .composer textarea { flex:1; width:0; min-width:0; min-height:42px; height:42px; line-height:22px; padding:9px 7px; border:0; resize:vertical; outline:0; box-shadow:none; color:var(--room-ink); background:transparent; }
.home-letter .composer textarea::placeholder { color:var(--room-muted); }
.home-letter .composer button { height:40px; width:40px; min-height:40px; flex:0 0 auto; border-radius:7px; padding:0; background:#34544e; color:#fff9eb; }
.home-letter .composer button span { display:none; }

@media (min-width:681px) {
  .layout-room[data-view="home"] .home-content {
    --room-padding:clamp(18px,min(2.3vw,3svh),62px);
    width:min(100%,calc(195svh - 140px),3600px);
    padding:var(--room-padding);
    display:grid; grid-template-columns:minmax(0,2.12fr) minmax(290px,1fr);
    gap:clamp(18px,min(2vw,2.8svh),54px); align-items:start;
  }
  .layout-room[data-view="home"] .home-content > .room-panel { width:100%; max-width:none; min-width:0; margin:0; }
  .layout-room[data-view="home"] .room-heading,.home-studio .wall-heading { height:clamp(51px,6svh,87px); margin:0 0 clamp(10px,1.5svh,22px); }
  .layout-room[data-view="home"] .content-area { background:radial-gradient(ellipse at 77% 18%,#bba77c16,transparent 50%),var(--paper); }
  .layout-room[data-view="home"] .room-scene { border-radius:17px; }
  .layout-room[data-view="home"] .room-controls { margin-top:clamp(8px,1.4svh,18px); }
  .home-studio .pin-surface { padding:clamp(18px,2.3svh,37px); }
}
@media (min-width:681px) and (max-width:1160px) {
  .layout:has(.home-studio) { grid-template-columns:98px minmax(0,1fr); }
  .layout:has(.home-studio) .rail { padding:18px 8px; overflow-y:auto; }
  .layout:has(.home-studio) .rail .brand { justify-content:center; padding:4px 0 15px; margin-bottom:12px; }
  .layout:has(.home-studio) .rail .brand strong { display:none; }
  .layout:has(.home-studio) .rail :is(.nav-button,.rail-account) { flex-direction:column; justify-content:center; gap:4px; padding:7px 2px; font-size:12px; }
}
@media (min-width:681px) and (max-width:960px) {
  .layout-room[data-view="home"] .home-content { grid-template-columns:minmax(0,1fr); }
  .home-studio { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
  .home-studio .wall-heading { height:auto; margin-bottom:12px; }
}
@media (min-width:681px) and (max-height:920px) {
  .home-studio .pin-surface[data-count="2"] { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:20px 14px; }
  .home-studio .pin-surface[data-count="2"] .pinned-piece { width:100%; }
  .home-studio .pin-surface[data-count="2"] .print-label { flex-wrap:wrap; }
  .home-studio .pin-surface[data-count="2"] .note-writing { padding:19px 10px 10px; }
  .home-studio .pin-surface:is([data-count="3"],[data-count="4"]) { padding:20px 14px; gap:16px 12px; }
}
@media (min-width:961px) and (min-height:921px) {
  .home-studio { align-self:stretch; grid-template-rows:auto 1fr; }
  .home-studio .home-letter { display:flex; flex-direction:column; }
  .home-letter .letter-lines { flex:1; align-content:center; }
  .home-letter .letter-lines { row-gap:clamp(8px,1.3svh,18px); }
}
@media (min-width:681px) and (max-height:600px) and (max-width:1160px) {
  .layout-room[data-view="home"] .home-content { width:100%; grid-template-columns:minmax(0,min(60%,calc(150svh - 205px))) minmax(220px,1fr); gap:14px; padding:12px; }
  .home-studio { grid-template-columns:minmax(0,1fr); }
  .layout-room[data-view="home"] .room-heading { height:48px; margin:0 0 8px; }
  .layout-room[data-view="home"] .room-heading h1 { font-size:22px; }
  .layout-room[data-view="home"] .room-controls { margin-top:5px; padding:3px 0; }
  .layout-room[data-view="home"] .room-action { flex-direction:column; gap:1px; min-height:42px; padding:0; font-size:11px; }
  .layout-room[data-view="home"] .room-action .room-object { width:26px;height:26px; }
}
@media (min-width:1650px) and (min-aspect-ratio:23/10) {
  .layout-room[data-view="home"] .home-content { width:min(100%,calc(248svh + 280px),3600px); grid-template-columns:minmax(0,min(60%,calc(127svh - 110px))) minmax(0,1fr); }
  .home-studio { grid-template: auto / minmax(0,1.08fr) minmax(0,1fr); gap:clamp(15px,1vw,30px); align-items:start; align-self:start; }
  .home-studio .home-letter { margin-top:calc(clamp(51px,6svh,87px) + clamp(10px,1.5svh,22px)); }
}
@media (max-width:680px) {
  .home-studio { display:none; }
  .wall-in-sheet .unpin::after { content:""; position:absolute; inset:-8px -3px; }
  .wall-in-sheet .wall-full { line-height:1.6; }
  .wall-mobile-open { display:inline-flex; flex-shrink:0; min-height:36px; background:transparent; color:var(--room-ink); border-color:var(--paper-line); }
  .mobile-navigation { grid-template-columns:repeat(5,minmax(0,1fr)); }
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .wall-paper { transition:transform .23s ease,box-shadow .23s ease; }
  .pinned-piece .wall-paper:hover { transform:rotate(0) translateY(-2px); box-shadow:1px 7px 11px #36382f4a; }
  .unpin:hover,.wall-tools button:hover,.theme-list button:hover { filter:brightness(.96); }
}

