:root {
  color-scheme: light;
  --paper: #f7f5ee;
  --ink: #26332c;
  --muted: #606b60;
  --red: #973f30;
  --line: #d7d7c9;
  --serif: "Songti TC","Noto Serif CJK TC","Noto Serif HK","PMingLiU",serif;
  --sans: -apple-system,BlinkMacSystemFont,"PingFang HK","Microsoft JhengHei",sans-serif;
  font: 16px/1.55 var(--sans);
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { background: none; border: 0; }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible, a:focus-visible, canvas:focus-visible, textarea:focus-visible { outline: 2px solid #994a36; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mast { border-bottom: 1px solid var(--line); }
.mast-inner { max-width: 1536px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 15px clamp(20px,4vw,72px); }
.brand { display: flex; align-items: center; gap: 12px; font: 700 21px/1 var(--serif); letter-spacing: .1em; }
.brand i { width: 1px; height: 20px; background: #c9cbbb; margin: 0 2px; }
.brand .brand-edition { font: 400 14px/1 var(--sans); letter-spacing: .15em; color: var(--muted); }
.book-mark { display: grid; place-items: center; height: 32px; width: 31px; color: #faf5e8; background: #3b4b41; font: 700 22px/1 var(--serif); letter-spacing: 0; border-radius: 2px 3px 1px 3px; }
.info { min-height: 32px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.info span { font-family: system-ui; font-size: 16px; }
.layout { max-width: 1536px; margin: 0 auto; padding: clamp(20px,3vw,48px) clamp(18px,4vw,72px); display: grid; grid-template-columns: minmax(0,1.12fr) minmax(0,1fr); gap: clamp(25px,3.8vw,68px); }
.portrait-panel, .conversation { height: clamp(585px,calc(100svh - 152px),820px); }
.portrait-panel { position: relative; border-radius: 4px; isolation: isolate; overflow: hidden; background-color: #eae9d9; background-image: radial-gradient(ellipse at 91% 27%,#ebe2cd 0%,transparent 42%),radial-gradient(ellipse at 5% 68%,#bbc8ba 0%,transparent 55%),linear-gradient(134deg,#f4efe0 15%,#ece7d9 41%,#c1cebf); box-shadow: inset 0 0 0 1px #33423214; }
.portrait-panel::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(0deg,#263c34a6 0%,transparent 17%),linear-gradient(100deg,#f5f0df2b 3%,transparent 32%); }
.portrait-heading { position: absolute; z-index: 3; top: clamp(19px,4vw,55px); left: clamp(19px,3vw,44px); pointer-events: none; }
.dynasty { font-size: 12px; font-weight: 600; letter-spacing: .25em; color: #526154; }
.name-line { display: flex; align-items: flex-end; gap: .65rem; }
h1 { font: 600 clamp(42px,4.8vw,76px)/1.18 var(--serif); margin: .2em 0 .08em; letter-spacing: .12em; color: #2d3c32; }
.seal { display: inline-block; margin: 0 0 9px -.4em; padding: 3px 2px; writing-mode: vertical-rl; font: 600 11px/1 var(--serif); letter-spacing: 1px; color: #f7eddb; background: #a55240; transform: rotate(-3deg); border-radius: 1px; }
.portrait-heading p { margin: 3px 0; color: #48564c; font: 500 14px/1.5 var(--serif); letter-spacing: .06em; }
#portrait { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; }
#portrait:active { cursor: grabbing; }
#portrait-fallback { position: absolute; inset: 35% 0 24%; margin: auto; writing-mode: vertical-rl; width: max-content; font: 500 42px var(--serif); letter-spacing: .2em; color: #51695a; }
#landscape { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.portrait-footer { position: absolute; bottom: 20px; left: 25px; right: 22px; z-index: 3; display: flex; justify-content: space-between; align-items: center; color: #fffcf0; pointer-events: none; }
.studio { font: 500 15px var(--serif); letter-spacing: .25em; }
.drag { font-size: 12px; letter-spacing: .03em; }
.drag span { padding-right: 6px; font-size: 19px; vertical-align: -1px; }
.conversation { display: flex; flex-direction: column; min-width: 0; padding: 8px 0 0; }
.chat-heading { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 0 0 22px; gap: 10px; }
h2 { margin: 0; font: 600 clamp(27px,2.5vw,39px)/1.25 var(--serif); letter-spacing: .05em; }
.rule { width: 31px; height: 3px; margin: 0 0 13px; background: var(--red); }
select { background: transparent; border: none; max-width: 100%; }
.language-control { border: 1px solid #c8ccbe; border-radius: 3px; }
.language-control select { font-size: 13px; padding: 7px 5px; }
.scroll { overflow-y: auto; min-height: 0; flex: 1; padding: 25px 4px 20px 0; scrollbar-width: thin; scrollbar-color: #c8ccbd transparent; }
.messages { display: grid; gap: 18px; }
.message { min-width: 0; }
.message-person { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .11em; color: #5b685c; }
.message-person::before { content: ""; background: #9a4c38; width: 5px; height: 5px; transform: rotate(45deg); }
.message p { font: 500 clamp(17px,1.35vw,21px)/1.75 var(--serif); margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.message.user { background: #e9ecdf; padding: 10px 15px 11px; border-left: 2px solid #879782; margin-left: 11%; }
.message.user .message-person::before { display: none; }
.message.user p { font: 400 16px/1.6 var(--sans); margin-top: 2px; }
.message-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 5px; }
.message-tools button, .message-tools a { font: 500 12px/1.5 var(--sans); color: #5d665d; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; padding: 3px 0; }
.suggestions { margin-top: clamp(19px,3.5vh,36px); }
.suggestions p { margin: 0 0 9px; font-size: 12px; letter-spacing: .07em; color: var(--muted); }
.prompt-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.prompt-list button { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 11px 1px; border-bottom: 1px solid var(--line); font-size: 15px; }
.prompt-list button:hover { background: #ececde; }
.prompt-category { font: 600 12px/1.4 var(--serif); color: var(--red); white-space: nowrap; }
.prompt-list button span:last-child { margin-left: auto; color: #758373; }
.composer { margin-top: auto; padding-top: 12px; }
#compose { background: #fffdf6; padding: 11px 12px 9px; border: 1px solid #adb6a6; border-radius: 4px; }
#compose:focus-within { border-color: #607761; }
textarea { resize: none; width: 100%; min-height: 47px; display: block; padding: 0 1px; outline: none !important; border: none; background: transparent; font-size: 16px; line-height: 1.5; }
textarea::placeholder { color: #758072; }
.composer-actions, .voice-tools, .composer-meta { display: flex; align-items: center; }
.composer-actions, .composer-meta { justify-content: space-between; gap: 4px; }
.voice-tools { gap: 7px; }
.mic { display: inline-flex; align-items: center; gap: 7px; padding: 5px 4px; font-size: 13px; }
.mic i { position: relative; display: inline-block; height: 11px; width: 6px; border-radius: 5px; border: 1.5px solid currentColor; margin: -3px 2px 0 3px; }
.mic i::before { content: ""; position: absolute; inset: 4px -4px -4px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 6px 6px; }
.mic i::after { content: ""; position: absolute; height: 3px; border-left: 1px solid; bottom: -6px; left: 1px; }
.mic[aria-pressed=true] { color: #9d4132; }
#mic-language { border-left: 1px solid var(--line); padding-left: 4px; font-size: 12px; color: var(--muted); }
.send, .dialog-button { min-height: 34px; color: #fffef4; background: #374d40; padding: 5px 12px; border-radius: 3px; }
.send span { margin-left: 3px; }
.send { font-size: 14px; }
.send:disabled { background: #687769; opacity: .76; }
.composer-meta { padding: 6px 1px 0; color: #6b756a; font-size: 11px; }
.composer-meta button { font-size: 11px; color: var(--muted); padding: 3px 1px; }
.composer-meta button:disabled { opacity: .5; }
#status { margin: 0 0 6px; color: #834132; font-size: 13px; }
dialog { background: var(--paper); color: var(--ink); border: 1px solid var(--line); width: min(420px,90vw); padding: 24px; border-radius: 5px; }
dialog::backdrop { background: #20302980; }
dialog h2 { font-size: 25px; }
dialog p { font-size: 15px; }
dialog form { display: flex; justify-content: flex-end; gap: 12px; }
@media (max-width: 850px) and (min-width: 701px) {
  .layout { grid-template-columns: .85fr 1fr; gap: 22px; }
  .portrait-heading { top: 19px; }
}
@media (max-width: 700px) {
  .mast-inner { padding: 10px 16px; }
  .layout { grid-template-columns: 1fr; gap: 16px; padding: 14px 14px 18px; }
  .portrait-panel { height: clamp(260px,41svh,390px); }
  .portrait-heading { top: 16px; left: 16px; }
  h1 { font-size: 40px; }
  .portrait-heading p { font-size: 12px; }
  .portrait-footer { bottom: 10px; left: 15px; right: 12px; }
  .conversation { height: auto; min-height: 0; padding: 0 2px; }
  .chat-heading { padding: 0 0 12px; }
  .rule { display: none; }
  h2 { font-size: 26px; }
  .scroll { padding-top: 14px; max-height: 55svh; flex: 0 1 auto; }
  .suggestions { margin-top: 16px; }
  .prompt-list button { padding: 9px 0; }
  .composer { position: sticky; bottom: 0; z-index: 4; background: var(--paper); padding: 5px 0 max(4px,env(safe-area-inset-bottom)); }
  .brand { font-size: 18px; gap: 9px; }
}
