:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #252c3a;
  background: #f5f0e7;
  --muted: #596376;
  --line: #e3d9ca;
  --ink: #25466b;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.account-controls { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.account-panel { max-width: 35rem; margin: 2rem auto; }
.account-link { display: inline-block; margin-top: .6rem; color: #244f83; }
#cloud-connect-form button { margin-top: .4rem; }
button, input, textarea, select { font: inherit; }
button, .file-button, select { cursor: pointer; }
button, .file-button {
  border: 1px solid var(--line);
  background: #fffdf7;
  border-radius: 9px;
  padding: .47rem .73rem;
  color: inherit;
}
button:hover:not(:disabled), .file-button:hover { background: #e9eff8; border-color: #a2b3c8; }
button:disabled { opacity: .47; cursor: default; }
:focus-visible { outline: 2px solid #3d73c5; outline-offset: 2px; }
input:not([type=checkbox]), textarea, select {
  color: inherit;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .48rem .57rem;
  width: 100%;
  min-width: 0;
}
textarea { resize: vertical; }
label { display: block; font-size: .83rem; }
label[for=persona], details label { margin: .62rem 0 .22rem; }
ul { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
h1, h2 { margin: 0; }
img { max-width: 100%; }
.top {
  max-width: 1152px;
  margin: auto;
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}
.brand { display: flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; font-weight: 750; }
.brand-dot { width: 16px; height: 12px; border-radius: 75% 65% 65% 45%; background: #4c82e1; transform: rotate(-16deg); }
.mode, .note { color: var(--muted); font-size: .8rem; }
main {
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 1.5rem 2.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.stage, .panel { border-radius: 16px; border: 1px solid var(--line); }
.stage {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: radial-gradient(ellipse at 50% 52%, #f8fbff, #e3ebf6);
  border-color: #ccdaec;
  min-height: 382px;
  padding: 1.2rem;
}
.stage-header, .section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: .7rem; }
h1 { font-size: clamp(1.35rem, 4vw, 2.35rem); letter-spacing: -.04em; line-height: 1.12; }
h2 { font-size: 1.03rem; margin-bottom: .68rem; }
#persona-preview { color: var(--muted); margin-top: .36rem; font-size: .83rem; overflow-wrap: anywhere; }
.status { white-space: nowrap; border: 1px solid #bed1e5; border-radius: 30px; color: var(--ink); padding: .32rem .65rem; font-size: .75rem; background: #f2f7ff; }
.stage-center { display: grid; justify-items: center; align-content: center; gap: .1rem; padding: .35rem 0 .65rem; }
.avatar { width: calc(232px * var(--avatar-scale, 1)); max-width: 100%; height: calc(176px * var(--avatar-scale, 1)); position: relative; }
.shadow { position: absolute; width: 52%; height: 12px; bottom: 12px; left: 24%; background: #35578228; filter: blur(5px); border-radius: 50%; }
.figure { position: absolute; inset: 6px 14px 20px; transform-origin: center 80%; }
.figure img { height: 100%; width: 100%; object-fit: contain; }
.figure video { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: contain; }
.figure video[data-preparing][hidden] { display: block !important; opacity: 0; pointer-events: none; }
.clip-art .figure { animation: none; }
.clip-art .figure video { object-fit: cover; }
.figure.pet-grab { cursor: grab; touch-action: none; user-select: none; }
.figure.pet-grab > * { pointer-events: none; }
.figure[data-grab] { z-index: 2; }
.figure[data-grab="held"] { cursor: grabbing; }
.clip-ready #artwork { visibility: hidden; }
.live2d-art .figure, .dengdeng-art .figure { animation: none; }
.live2d-ready #artwork, .dengdeng-ready #artwork { visibility: hidden; }
.figure .live2d-canvas { position: absolute; inset: 0; display: block; }
.figure .dengdeng-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.figure .dengdeng-canvas:active { cursor: grabbing; }
.figure .dengdeng-canvas.dengdeng-outline {
  filter: drop-shadow(.65px 0 #26334d) drop-shadow(-.65px 0 #26334d)
    drop-shadow(0 .65px #26334d) drop-shadow(0 -.65px #26334d);
}
.dengdeng-appearance { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .25rem .55rem; margin-top: .4rem; }
.dengdeng-appearance label, .dengdeng-appearance select, .dengdeng-appearance output { font-size: .76rem; }
.dengdeng-appearance select { width: auto; padding: .26rem .45rem; }
.dengdeng-appearance input { width: 86px; padding: 0; accent-color: #426fae; }
.dengdeng-appearance output { min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; }
.pet-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin-top: .45rem; }
.pet-actions select { width: auto; max-width: 100%; }
.pet-actions select, .pet-actions button { font-size: .76rem; padding: .3rem .45rem; }
.pet-actions input[type="search"] { width: 8em; font-size: .76rem; padding: .3rem .45rem; }
.animation-note { font-size: .7rem; max-width: 95%; text-align: center; margin-top: .3rem; }
.avatar-zoom { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .4rem; margin-top: .4rem; color: var(--ink); }
.avatar-zoom label, .avatar-zoom output, .avatar-zoom button { font-size: .76rem; }
.avatar-zoom input { width: clamp(68px, 21vw, 112px); padding: 0; accent-color: #426fae; }
.avatar-zoom output { min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; }
.avatar-zoom button { padding: .22rem .42rem; }
.three-view-art { height: calc(clamp(224px, 28vw, 292px) * var(--avatar-scale, 1)); width: calc(300px * var(--avatar-scale, 1)); }
.three-view-art .figure { inset: 2px 12px 15px; }
.three-view-art .shadow { opacity: .6; }
.custom-art .body, .custom-art .fin { display: none; }
.body {
  position: absolute;
  inset: 12% 16% 9% 3%;
  border: 2px solid #243a6728;
  border-radius: 54% 57% 44% 42% / 59% 60% 46% 48%;
  background: radial-gradient(ellipse at 35% 23%, #fff5 0%, transparent 34%), linear-gradient(var(--pet) 66%, #e1efff 67%);
  box-shadow: inset 1px -5px #233f771c;
}
.fin { position: absolute; right: 2%; top: 42%; width: 28%; height: 27%; background: var(--pet); border-radius: 65% 15% 70% 22%; transform: rotate(-30deg); border: 2px solid #243a6728; }
.eye { position: absolute; top: 44%; width: 10px; height: 13px; border-radius: 55%; background: #253452; animation: blink 5.1s infinite; }
.eye.left { left: 34%; }
.eye.right { left: 55%; }
.mouth { position: absolute; top: 57%; left: 45%; width: 14%; height: 11%; background: #283860; border-radius: 25% 25% 80% 80%; transform-origin: center top; }
[data-speaking=true] .mouth { animation: mouth .3s infinite alternate; }
[data-shape=blob] .body { inset: 12% 14% 9%; border-radius: 51% 50% 28% 31%; }
[data-shape=blob] .fin { display: none; }
[data-motion=float] { animation: float 2.7s ease-in-out infinite; }
[data-motion=look] { animation: look 1.2s ease-in-out infinite alternate; }
[data-motion=bounce] { animation: bounce .55s ease-in-out infinite alternate; }
@keyframes float { 50% { transform: translateY(-9px); } }
@keyframes look { to { transform: rotate(-7deg) translate(7px, -3px); } }
@keyframes bounce { from { transform: scale(1,.96); } to { transform: translateY(-6px) scale(.98, 1.035); } }
@keyframes blink { 0%, 46%, 51%, 100% { transform: scaleY(1); } 49% { transform: scaleY(.12); } }
@keyframes mouth { from { transform: scaleY(.35); } to { transform: scaleY(1.3); } }
.speech {
  position: relative;
  max-width: 95%;
  min-height: 2.5rem;
  margin-top: .35rem;
  padding: .58rem .85rem;
  border: 1px solid #d6e0ee;
  border-radius: 12px;
  background: #fcfdff;
  font-size: .91rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.speech::before {
  content: '';
  position: absolute;
  top: -5px;
  left: calc(50% - 4px);
  width: 8px;
  height: 8px;
  border-top: 1px solid #d6e0ee;
  border-left: 1px solid #d6e0ee;
  background: inherit;
  transform: rotate(45deg);
}
.events, .suggestions, .days { display: flex; flex-wrap: wrap; gap: .42rem; }
.events button, .suggestions button, .days button { font-size: .82rem; }
.character-views { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; margin-top: .45rem; }
.character-views button { font-size: .75rem; padding: .22rem .5rem; border-color: transparent; background: transparent; color: var(--ink); }
.character-views [aria-pressed=true] { border-color: #a7bcd6; background: #f5f9ff; }
.main-column, .side { min-width: 0; display: grid; gap: 1rem; }
.panel { min-width: 0; background: #fffbf3; padding: 1rem; }
.model-panel details { margin: 0; }
.model-panel summary { font-size: 1rem; font-weight: 700; }
#model-badge { float: right; font-weight: 400; max-width: 56%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#model-fields { margin: .4rem 0 0; padding: 0; border: 0; min-width: 0; }
.model-buttons { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .2rem; }
#provider-note, #model-message, #chat-note, #voice-status, #turn-timing { margin-top: .35rem; }
#model-message:empty, #chat-note:empty, #voice-status:empty { margin: 0; }
#read-models { flex-shrink: 0; }
.attachment { margin-top: .55rem; }
.attachment input { margin: .18rem 0; }
.role-row { display: flex; gap: .45rem; margin-top: .24rem; }
.role-row > :is(input, select) { flex: 1; min-width: 0; }
.pet-profile-form > label { display: block; }
.persona-trait { display: grid; gap: .24rem; margin: .45rem 0; padding: .4rem 0; border-bottom: 1px solid #e8dfd2; }
.persona-trait button, #add-trait { justify-self: start; font-size: .78rem; }
.file-button { flex-shrink: 0; font-size: .78rem; display: grid; place-items: center; }
.role-row:focus-within .file-button { outline-color: #3d73c5; }
#role-message { margin-top: .24rem; min-height: 1rem; }
details { margin-top: .28rem; font-size: .82rem; }
summary { cursor: pointer; color: var(--ink); }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .6rem; }
.actions-grid select { display: block; margin-top: .16rem; }
.sources { display: grid; grid-template-columns: 1fr 1fr; gap: .54rem; }
.source { min-width: 0; }
.source label { cursor: pointer; }
.source input { accent-color: #315f9a; }
.source button { margin: .25rem 0; }
.capture-preview { display: block; width: 100%; height: 82px; border-radius: 7px; object-fit: contain; background: #27364a; }
.thumb { position: relative; display: block; overflow: hidden; isolation: isolate; height: 58px; border-radius: 7px; }
.camera-thumb { background: linear-gradient(#b8ccbb 0 55%, #be9982 55%); }
.camera-thumb i { position: absolute; height: 48%; width: 26%; left: 34%; top: 35%; background: #4579b0; border-radius: 7% 7% 25% 25%; border-top: 3px solid #285687; }
.camera-thumb i::after { content: ''; position: absolute; inset: 16% -28% 32% 90%; border: 3px solid #4579b0; border-radius: 50%; }
.screen-thumb { background: #3e516d; }
.screen-thumb i { position: absolute; inset: 17% 20%; border-radius: 3px; background: repeating-linear-gradient(#e7ebff 0 5px, #7787a8 5px 6px, #e7ebff 6px 8px); border: 6px solid #e7ebff; }
#source-note { margin-top: .46rem; }
#conversation { display: grid; gap: .38rem; max-height: 160px; overflow-y: auto; }
#conversation:not(:empty) { margin-bottom: .6rem; }
#conversation li { border-radius: 8px; background: #eaf0f9; padding: .4rem .55rem; font-size: .86rem; overflow-wrap: anywhere; }
#conversation li[data-speaker=user] { background: #f0e7d8; }
#conversation span { font-weight: 650; margin-right: .58rem; }
.chat-images { display: flex; flex-wrap: wrap; gap: .25rem .65rem; margin-top: .25rem; color: var(--muted); font-size: .75rem; }
#chat-form { display: flex; gap: .43rem; margin-top: .57rem; }
#voice-input { white-space: nowrap; }
.voice-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .55rem; margin-top: .45rem; }
.voice-controls button { font-size: .8rem; }
.voice-controls select { width: auto; font-size: .8rem; }
.profile-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .55rem; margin: .35rem 0; }
.profile-controls button, .memory-entry button { font-size: .76rem; padding: .25rem .4rem; }
#persona-card { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font: inherit; }
#memory-entries { list-style: none; padding: 0; }
.memory-entry { margin: .4rem 0; overflow-wrap: anywhere; }
.memory-entry small { display: block; }
.memory-entry button { margin-right: .35rem; }
.voice-controls button[aria-pressed=true] { border-color: #a7bcd6; background: #edf4ff; }
.primary { background: #274871; border-color: #274871; color: #fff; flex-shrink: 0; }
.primary:hover:not(:disabled) { background: #1b3556; }
.section-heading button { font-size: .8rem; }
.days { margin: .52rem 0; }
.days [aria-pressed=true] { border-color: #8298b7; background: #e8eef7; }
#records li { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .45rem; font-size: .84rem; overflow-wrap: anywhere; }
.evidence { display: inline-grid; vertical-align: top; gap: .12rem; color: var(--muted); font-size: .72rem; margin: .38rem .45rem .12rem 0; }
.evidence .thumb { height: 38px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 730px) {
  main { grid-template-columns: minmax(0, 1fr); padding: 0 .7rem 1.3rem; gap: .67rem; }
  .top { padding: .8rem .7rem; }
  .main-column, .side { gap: .67rem; }
  .stage { min-height: 332px; }
}
@media (prefers-reduced-motion: reduce) {
  .figure, .eye, .mouth { animation: none !important; }
}
.archive-entry p { white-space: pre-wrap; overflow-wrap: anywhere; }
.archive-entry time { font-size: .8rem; }
