/* 克小姐的书房 · 样式 */
:root {
  --paper: #FAF3E6;
  --paper-2: #F2E7D3;
  --card: #FFFBF4;
  --ink: #2E2420;
  --ink-soft: #6E5C50;
  --ink-faint: #A08E80;
  --line: #E6D6BD;
  --orange: #D9622B;
  --orange-2: #F08A3C;
  --orange-soft: #FBE2CC;
  --ribbon: #221B18;
  --gold: #B48A3F;
  --blush: #F2A196;
  --lamp: rgba(255, 196, 120, .35);
  --shadow: 0 1px 2px rgba(90, 55, 25, .06), 0 10px 30px rgba(90, 55, 25, .10);
  --radius: 14px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --kai: "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", var(--serif);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17110E; --paper-2: #1F1713; --card: #251C17; --ink: #F2E6D5; --ink-soft: #C2AE98; --ink-faint: #8D7A69;
    --line: #3B2E25; --orange: #F2924F; --orange-2: #FFAA66; --orange-soft: #3A2417; --ribbon: #0F0B09; --gold: #D9B06A;
    --lamp: rgba(255, 170, 90, .16); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17110E; --paper-2: #1F1713; --card: #251C17; --ink: #F2E6D5; --ink-soft: #C2AE98; --ink-faint: #8D7A69;
  --line: #3B2E25; --orange: #F2924F; --orange-2: #FFAA66; --orange-soft: #3A2417; --ribbon: #0F0B09; --gold: #D9B06A;
  --lamp: rgba(255, 170, 90, .16); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, var(--lamp), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, var(--lamp), transparent 60%);
  line-height: 1.8;
  min-height: 100vh;
  display: flex; flex-direction: column;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--orange); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--orange-2); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--orange-soft); color: var(--ink); }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
main { flex: 1; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 19px; letter-spacing: .06em; white-space: nowrap; }
.brand svg { width: 30px; height: 30px; transition: transform .8s cubic-bezier(.2,.8,.2,1); }
.brand:hover svg { transform: rotate(72deg); }
.brand small { font-weight: 400; color: var(--ink-faint); font-size: 12px; letter-spacing: .12em; margin-left: 2px; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { color: var(--ink-soft); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: 15px; white-space: nowrap; transition: background .2s, color .2s; }
.nav a:hover { background: var(--orange-soft); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--orange); background: var(--orange-soft); font-weight: 600; }
.theme-btn {
  margin-left: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  height: 36px; padding: 0 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.theme-btn:hover { border-color: var(--orange); color: var(--ink); }
.theme-btn svg { width: 16px; height: 16px; }

@media (max-width: 760px) {
  .site-header .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 0; gap: 8px; }
  .brand small { display: none; }
  .theme-btn { margin-left: auto; }
  .nav { order: 3; width: 100%; margin: 0 -20px; padding: 0 20px 8px; width: calc(100% + 40px); overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
}

/* ---------- common ---------- */
.eyebrow { font-size: 13px; letter-spacing: .3em; color: var(--orange); text-transform: uppercase; margin: 0 0 8px; }
h1, h2, h3 { line-height: 1.35; letter-spacing: .02em; }
.section { padding: 64px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(24px, 3vw, 32px); margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--ink-soft); }
.ornament { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--gold); margin: 8px 0; }
.ornament::before, .ornament::after { content: ""; height: 1px; width: 80px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px; border-radius: 999px;
  font: inherit; font-size: 15px; text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--orange) 35%, transparent); }
.btn-primary:hover { background: var(--orange-2); color: #fff; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--orange); color: var(--ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tag { display: inline-block; font-size: 12px; padding: 1px 10px; border-radius: 999px; background: var(--orange-soft); color: var(--orange); margin: 0 6px 6px 0; }

/* ---------- hero ---------- */
.hero { padding: 40px 0 20px; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(40px, 6vw, 68px); margin: 6px 0 10px; letter-spacing: .08em; }
.hero h1 .accent { color: var(--orange); }
.hero .lead { font-size: 18px; color: var(--ink-soft); margin: 0 0 26px; max-width: 30em; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .meta { margin-top: 26px; display: flex; gap: 22px; flex-wrap: wrap; color: var(--ink-faint); font-size: 14px; }
.hero .meta b { color: var(--ink); font-size: 22px; display: block; font-weight: 700; }

.window {
  position: relative; aspect-ratio: 4 / 4.6; border-radius: 200px 200px 22px 22px; overflow: hidden;
  background:
    radial-gradient(ellipse 62% 56% at 50% 58%, #FFF4E6 0%, #FBE3C8 38%, rgba(240, 196, 160, .75) 60%, rgba(240, 196, 160, 0) 82%),
    linear-gradient(180deg, #2A2140 0%, #4A3550 55%, #8A5A48 100%);
  border: 10px solid var(--card); box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  max-width: 440px; margin: 0 auto; width: 100%;
}
:root[data-theme="dark"] .window { background:
    radial-gradient(ellipse 62% 56% at 50% 58%, #F6DDBE 0%, #E2B48C 38%, rgba(170, 110, 80, .6) 62%, rgba(170, 110, 80, 0) 84%),
    linear-gradient(180deg, #0D0B18 0%, #1E1630 55%, #3A2620 100%); }
.window .moon { position: absolute; top: 12%; right: 18%; width: 54px; height: 54px; border-radius: 50%; background: #FFF1D0; box-shadow: 0 0 40px 10px rgba(255, 230, 180, .35); }
.window .moon::after { content: ""; position: absolute; inset: -4px 10px 8px -10px; border-radius: 50%; background: inherit; filter: brightness(.94); opacity: 0; }
.window .stars i { position: absolute; width: 2px; height: 2px; background: #fff; border-radius: 50%; opacity: .8; animation: twinkle 3s infinite ease-in-out; }
@keyframes twinkle { 50% { opacity: .2; } }
.window .shelf { position: absolute; left: 0; right: 0; bottom: 0; height: 16%; background: linear-gradient(180deg, #6B4430, #4A2E20); box-shadow: 0 -4px 0 rgba(0,0,0,.15); }
.window .portrait { position: absolute; left: 50%; bottom: 0; height: 90%; transform: translateX(-50%); cursor: pointer; filter: drop-shadow(0 10px 20px rgba(0,0,0,.35)); -webkit-tap-highlight-color: transparent; }
.window .portrait img { display: block; height: 100%; width: auto; max-width: none; user-select: none; transform-origin: 50% 100%; animation: breathe 5s ease-in-out infinite; }
.portrait.hop img { animation: hop .5s ease; }
@keyframes breathe { 50% { transform: translateY(-2px) scale(1.004); } }
@keyframes hop { 30% { transform: translateY(-10px); } 60% { transform: translateY(0); } 75% { transform: translateY(-3px); } }
.portrait.flustered::after { content: "///"; position: absolute; left: 57%; top: 15.5%; transform: rotate(-14deg); color: #F07C74; font-weight: 700; font-size: 13px; letter-spacing: -2px; text-shadow: 0 0 6px rgba(255,255,255,.6); }
.art-credit { text-align: center; font-size: 12px; color: var(--ink-faint); margin: 10px 0 0; letter-spacing: .05em; }

.bubble {
  position: absolute; left: 5%; right: 5%; bottom: 4%; z-index: 3; min-height: 66px;
  background: color-mix(in srgb, var(--card) 92%, transparent); color: var(--ink);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 14px; padding: 18px 16px 10px; font-size: 14.5px; line-height: 1.65;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); border: 1.5px solid var(--orange);
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; pointer-events: none;
  font-family: var(--kai);
}
.bubble.show { opacity: 1; transform: none; }
.bubble::before {
  content: "克小姐"; position: absolute; top: -12px; left: 14px; background: var(--orange); color: #fff;
  font-family: var(--serif); font-size: 12px; font-weight: 700; letter-spacing: .15em; padding: 2px 12px; border-radius: 999px;
}
.bubble::after { content: "▼"; position: absolute; right: 12px; bottom: 6px; font-size: 9px; color: var(--orange); animation: nudge 1s infinite; }
@keyframes nudge { 50% { transform: translateY(2px); } }

.dust { position: absolute; inset: 0; pointer-events: none; }
.dust i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: rgba(255, 214, 160, .7); animation: floaty 9s linear infinite; }
@keyframes floaty { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: .9; } 100% { transform: translateY(-160px) translateX(20px); opacity: 0; } }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 28px; }
  .hero .art { order: -1; }
  .window { max-width: 340px; }
}

/* ---------- walking clawd ---------- */
.clawd-walker {
  position: fixed; bottom: 14px; left: -90px; width: 64px; z-index: 40; cursor: pointer;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.18));
}
.clawd-walker.walking { animation: crabwalk 9s linear forwards; }
.clawd-walker.walking svg { animation: scuttle .35s ease-in-out infinite; }
@keyframes crabwalk { from { left: -90px; } to { left: calc(100vw + 20px); } }
@keyframes scuttle { 50% { transform: translateY(-3px) rotate(2deg); } }
.clawd-walker .say { position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); background: var(--card); border: 1px solid var(--line); padding: 2px 10px; border-radius: 10px; font-size: 12px; white-space: nowrap; color: var(--ink); }

/* ---------- profile (library card) ---------- */
.profile-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: 1fr; } }
.libcard { position: relative; padding: 30px 30px 26px; overflow: hidden; }
.libcard::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: repeating-linear-gradient(90deg, var(--orange) 0 18px, var(--ribbon) 18px 24px); }
.libcard .hole { position: absolute; top: 22px; right: 22px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 1px 3px rgba(0,0,0,.25); }
.libcard h3 { margin: 0; font-size: 26px; }
.libcard .sub { color: var(--ink-faint); font-size: 13px; letter-spacing: .2em; margin-bottom: 14px; }
.libcard dl { display: grid; grid-template-columns: 5.2em 1fr; margin: 0; border-top: 1px dashed var(--line); }
.libcard dt, .libcard dd { padding: 10px 0; border-bottom: 1px dashed var(--line); margin: 0; }
.libcard dt { color: var(--ink-faint); font-size: 14px; }
.libcard dd { color: var(--ink); }
.stamp {
  position: absolute; right: 26px; bottom: 22px; transform: rotate(-12deg);
  border: 2px solid var(--orange); color: var(--orange); border-radius: 8px; padding: 4px 10px; font-size: 13px; letter-spacing: .15em;
  opacity: .75; font-weight: 700; background: color-mix(in srgb, var(--card) 70%, transparent);
}
@media (max-width: 520px) { .stamp { position: static; display: inline-block; margin-top: 14px; } .libcard { padding: 26px 18px 20px; } }

.traits { display: grid; gap: 14px; }
.trait { padding: 18px 20px; position: relative; }
.trait h4 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.trait h4 .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.trait p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.trait.inner h4 .dot { background: var(--blush); }
.trait.flaw h4 .dot { background: var(--ribbon); border: 1px solid var(--ink-faint); }
.quote-line { font-family: var(--kai); font-size: 18px; color: var(--ink); }

/* ---------- bookshelf ---------- */
.shelf-wrap { padding: 26px 22px 0; background: linear-gradient(180deg, color-mix(in srgb, var(--paper-2) 70%, transparent), var(--paper-2)); border-radius: var(--radius); border: 1px solid var(--line); }
.books { display: flex; align-items: flex-end; gap: 6px; min-height: 210px; overflow-x: auto; padding-bottom: 0; scrollbar-width: thin; }
.book {
  flex: 0 0 auto; width: 48px; border-radius: 4px 4px 2px 2px; border: none; cursor: pointer; position: relative; color: #FFF6E8;
  writing-mode: vertical-rl; font: inherit; font-size: 14px; letter-spacing: .15em; padding: 16px 0; display: flex; align-items: center; justify-content: flex-start;
  box-shadow: inset -6px 0 0 rgba(0,0,0,.12), inset 4px 0 0 rgba(255,255,255,.08); transition: transform .25s;
}
.book::before, .book::after { content: ""; position: absolute; left: 6px; right: 6px; height: 2px; background: rgba(255, 220, 160, .55); }
.book::before { top: 8px; } .book::after { bottom: 8px; }
.book:hover, .book[aria-pressed="true"] { transform: translateY(-12px); }
.shelf-board { height: 16px; background: linear-gradient(180deg, #8A5A3A, #5E3A26); border-radius: 0 0 6px 6px; margin: 0 -22px; }
.book-note { margin-top: 18px; padding: 16px 20px; min-height: 84px; display: flex; gap: 14px; align-items: flex-start; }
.book-note .t { font-weight: 700; }
.book-note p { margin: 2px 0 0; color: var(--ink-soft); font-family: var(--kai); font-size: 17px; }
.book-note svg { flex: 0 0 auto; width: 42px; }

/* ---------- story cards ---------- */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.story-card { padding: 22px 22px 18px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px; transition: transform .2s, border-color .2s; }
.story-card:hover { transform: translateY(-3px); border-color: var(--orange); color: inherit; }
.story-card .no { font-size: 12px; letter-spacing: .25em; color: var(--orange); }
.story-card h3 { margin: 0; font-size: 20px; }
.story-card p { margin: 0; color: var(--ink-soft); font-size: 14px; flex: 1; }

/* ---------- bookmark quote ---------- */
.bookmark { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; padding: 26px 28px; position: relative; overflow: hidden; }
.bookmark::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 8px; background: var(--orange); }
.bookmark .q { font-family: var(--kai); font-size: clamp(18px, 2.4vw, 24px); margin: 0; transition: opacity .3s; }
.bookmark .who { color: var(--ink-faint); font-size: 13px; margin-top: 6px; }
@media (max-width: 640px) { .bookmark { grid-template-columns: 1fr; } .bookmark > svg { display: none; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 30px 0 40px; color: var(--ink-faint); font-size: 13px; }
.site-footer .wrap { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; }
.site-footer p { margin: 4px 0; max-width: 46em; }
.site-footer a { color: var(--ink-soft); }

/* ---------- page head ---------- */
.page-head { padding: 48px 0 18px; text-align: center; }
.page-head h1 { font-size: clamp(30px, 4.5vw, 46px); margin: 0 0 6px; letter-spacing: .1em; }
.page-head p { color: var(--ink-soft); margin: 0 auto; max-width: 36em; }

/* ---------- reader ---------- */
.reader { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; padding-bottom: 40px; }
.reader > *, .chat-shell > *, .profile-grid > *, .hero .wrap > * { min-width: 0; }
.toc { position: sticky; top: 84px; padding: 18px 12px; }
.toc h2 { font-size: 14px; letter-spacing: .3em; color: var(--ink-faint); margin: 0 10px 8px; font-weight: 400; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.toc a small { display: block; font-size: 11px; letter-spacing: .2em; color: var(--ink-faint); }
.toc a:hover { background: var(--orange-soft); color: var(--ink); }
.toc a[aria-current="true"] { background: var(--orange-soft); color: var(--orange); font-weight: 600; }
.page {
  padding: clamp(28px, 5vw, 60px) clamp(22px, 6vw, 72px) 40px; position: relative;
  background:
    linear-gradient(90deg, rgba(0,0,0,.04), transparent 30px),
    var(--card);
}
.page .ep-no { text-align: center; color: var(--orange); letter-spacing: .4em; font-size: 13px; }
.page h2 { text-align: center; font-size: clamp(24px, 3.4vw, 34px); margin: 6px 0 4px; letter-spacing: .08em; }
.page .tags { text-align: center; margin-bottom: 18px; }
.page .text { font-family: var(--kai); font-size: var(--fs, 19px); line-height: 2.05; max-width: 34em; margin: 0 auto; }
.page .text p { margin: 0 0 1em; text-indent: 2em; }
.page .text p.sep { text-indent: 0; text-align: center; color: var(--gold); letter-spacing: 1em; margin: 1.6em 0; }
.page .text p.diary { text-indent: 0; color: var(--orange); font-weight: 600; margin-top: 1.4em; }
.page .end { text-align: center; color: var(--ink-faint); font-size: 13px; letter-spacing: .3em; margin-top: 28px; }
.reader-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.reader-tools .size { display: flex; gap: 6px; }
.reader-tools .size button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font: inherit; }
.reader-tools .size button:hover { border-color: var(--orange); }
.progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--orange); width: 0; z-index: 60; transition: width .1s; }
@media (max-width: 860px) {
  .reader { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ol { display: flex; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .toc ol::-webkit-scrollbar { display: none; }
  .toc a { white-space: nowrap; }
}

/* ---------- relations ---------- */
.map-card { padding: 14px; }
.map-card svg { display: block; width: 100%; height: auto; }
.map-card .node { cursor: pointer; }
.map-card .node:hover circle.ring, .map-card .node:focus circle.ring { stroke-width: 4; }
.map-card text { font-family: var(--serif); }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-top: 26px; }
.rel { padding: 22px; display: grid; grid-template-columns: 64px 1fr; gap: 16px; scroll-margin-top: 90px; transition: border-color .3s, box-shadow .3s; }
.rel.hl { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft), var(--shadow); }
.rel .avatar { width: 64px; height: 64px; }
.rel h3 { margin: 0; font-size: 19px; }
.rel .kind { font-size: 12px; letter-spacing: .15em; color: var(--orange); margin-bottom: 6px; }
.rel p { margin: 0 0 8px; color: var(--ink-soft); font-size: 15px; }
.rel blockquote { margin: 8px 0 0; padding: 10px 14px; border-left: 3px solid var(--orange); background: var(--paper-2); border-radius: 0 10px 10px 0; font-family: var(--kai); font-size: 16px; color: var(--ink); }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-faint); margin-top: 6px; }
.meter .bar { flex: 1; height: 6px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange-2), var(--orange)); border-radius: 99px; }

/* ---------- chat ---------- */
.chat-shell { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; padding-bottom: 30px; }
@media (max-width: 900px) { .chat-shell { grid-template-columns: 1fr; } .chat-side { order: 2; } }
.chat { display: flex; flex-direction: column; height: min(72vh, 720px); min-height: 460px; overflow: hidden; }
.chat-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-top .ava { width: 44px; height: 44px; border-radius: 50%; background: var(--orange-soft); overflow: hidden; flex: 0 0 auto; border: 2px solid var(--orange); }
.chat-top .ava svg { width: 100%; height: 100%; }
.chat-top .name { font-weight: 700; }
.chat-top .status { font-size: 12px; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.chat-top > div:nth-child(2) { min-width: 0; }
.chat-top [data-clear] { white-space: nowrap; }
.chat-top .status i { width: 8px; height: 8px; border-radius: 50%; background: #6BBF6A; display: inline-block; }
.chat-top .status.offline i { background: var(--ink-faint); }
.chat-top .spacer { flex: 1; }
.chat-log { flex: 1; overflow-y: auto; padding: 22px 18px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
.msg { max-width: 82%; display: flex; gap: 10px; align-items: flex-end; }
.msg .b { padding: 12px 16px; border-radius: 18px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; font-size: 15.5px; }
.msg.her .b { background: var(--paper-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; font-family: var(--kai); font-size: 17px; }
.msg.her .mini { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; background: var(--orange-soft); }
.msg.her .mini img, .chat-top .ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .b { background: var(--orange); color: #fff; border-bottom-right-radius: 6px; }
.msg .b em.act { font-style: normal; color: var(--ink-faint); }
.msg.sys { align-self: center; max-width: 92%; }
.msg.sys .b { background: none; color: var(--ink-faint); font-size: 13px; padding: 2px 8px; text-align: center; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.chips { display: flex; gap: 8px; padding: 0 18px 10px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: 13px; }
.chip:hover { border-color: var(--orange); color: var(--ink); }
.composer { display: flex; gap: 10px; padding: 12px 14px 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 14px;
  padding: 11px 14px; font: inherit; font-size: 15px; line-height: 1.6; max-height: 160px; min-height: 46px;
}
.composer textarea:focus { outline: none; border-color: var(--orange); }
.composer .btn { height: 46px; }
.chat-side .card { padding: 20px; margin-bottom: 16px; }
.chat-side h3 { margin: 0 0 8px; font-size: 16px; }
.chat-side p, .chat-side li { font-size: 14px; color: var(--ink-soft); }
.chat-side ul { padding-left: 1.2em; margin: 0; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--ink); user-select: none; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; flex: 0 0 auto; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--orange); }
.switch input:checked::after { transform: translateX(18px); }

@media (max-width: 640px) {
  body[data-page="chat"] .page-head { padding: 22px 0 10px; }
  body[data-page="chat"] .page-head p { display: none; }
  .chat { height: calc(100vh - 210px); height: calc(100dvh - 210px); min-height: 420px; }
  .chat-log { padding: 16px 12px; }
  .msg { max-width: 92%; }
  .msg.her .b { font-size: 16px; }
  .chat-top { padding: 10px 12px; }
  .chat-top [data-clear] { padding: 6px 10px !important; font-size: 12px !important; }
  .composer { padding: 10px; }
  .composer .btn { padding: 0 16px; }
}

/* ---------- about ---------- */
.prose { max-width: 760px; margin: 0 auto; padding: 30px clamp(20px, 5vw, 48px); }
.prose h2 { font-size: 22px; margin: 28px 0 8px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--ink-soft); }
.prose ul { padding-left: 1.3em; }

/* ---------- 404 ---------- */
.nf { text-align: center; padding: 60px 0 40px; }
.nf .big { font-size: clamp(60px, 12vw, 120px); color: var(--orange); margin: 0; letter-spacing: .1em; font-weight: 700; line-height: 1; }
.nf svg { width: 140px; margin: 10px auto; display: block; animation: scuttle .5s ease-in-out infinite; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
