:root {
  color-scheme: dark;
  --bg: #090e1a;
  --panel: #101725;
  --line: #29354a;
  --text: #edf1fb;
  --muted: #acbad0;
  --rose: #fa91a4;
  --header-height: 60px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 "Segoe UI", system-ui, sans-serif; }
body { height: 100dvh; display: grid; grid-template-rows: var(--header-height) minmax(0, 1fr); overflow: hidden; }
a { color: inherit; }
button, textarea { font: inherit; }
button { cursor: pointer; }
:is(button, a, textarea, summary):focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; }
button:disabled { opacity: .5; cursor: wait; }
.skip-link { position: absolute; top: 8px; left: 12px; transform: translateY(-200%); z-index: 10; background: var(--panel); padding: 8px; }
.skip-link:focus { transform: none; }
.site-header { display: flex; align-items: center; padding: 0 28px; gap: 48px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-size: 23px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.brand img { width: 28px; height: 28px; }
.brand span { color: var(--rose); }
.site-header nav { display: flex; gap: 28px; font-size: 13px; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }
.workspace { display: grid; grid-template-columns: minmax(240px, 28%) minmax(0, 1fr); width: 100%; max-width: 1600px; min-height: 0; margin: 0 auto; }
.mascot { position: relative; overflow: hidden; background: #201316; min-height: 0; }
.mascot > img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 12%; transform: scale(1.35); transform-origin: 50% 8%; }
.mascot::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, #130d14); }
.mascot-caption { position: absolute; bottom: 28px; left: 28px; right: 20px; z-index: 1; }
.mascot h1 { font-size: 40px; line-height: 1.1; margin: 0 0 10px; letter-spacing: -1px; }
.mascot p { margin: 0; color: #d0d8e6; font-size: 15px; }
.mascot-note { display: block; font-size: 12px; color: #b9c3d7; margin-top: 12px; }
.chat { margin: 14px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); background: #141d2d; }
.chat-header h2 { font-size: 21px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.4px; }
.chat-header p { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: 12px; }
.chat-header p::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #89cdb0; flex-shrink: 0; }
#clear-chat { margin-left: auto; border: 1px solid #44506a; background: #1c273a; color: #d0d9e9; font-size: 12px; min-height: 40px; padding: 8px 12px; border-radius: 10px; }
#clear-chat:hover { border-color: var(--rose); color: var(--text); }
.yuna-face { background-image: url("/static/yuna/emotions.webp"); background-size: 200% 200%; background-position: 0 0; border-radius: 50%; }
html[data-yuna-mood=thinking] .yuna-face { background-position: 100% 0; }
html[data-yuna-mood=happy] .yuna-face { background-position: 0 100%; }
html[data-yuna-mood=supportive] .yuna-face { background-position: 100% 100%; }
.mobile-avatar { width: 42px; height: 42px; flex-shrink: 0; border: 1px solid #ac748c; }
.conversation { overflow: auto; min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #65516a transparent; padding: 16px 22px 22px; overflow-wrap: anywhere; }
.welcome { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 12px 0; gap: 18px; }
.welcome > .portrait-avatar { width: 76px; height: 76px; flex-shrink: 0; border: 2px solid #ac748c; }
.welcome > p { margin: 0; font-size: clamp(20px, 2vw, 27px); font-weight: 650; letter-spacing: -.5px; }
.welcome-description { max-width: 380px; margin: -8px 0 2px; color: var(--muted); font-size: 13px; }
.suggestions { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }
.suggestions button { border: 1px solid #536079; background: #1c283b; border-radius: 12px; padding: 11px 15px; min-height: 44px; font-size: 13px; color: var(--text); }
.suggestions button:hover { border-color: var(--rose); background: #322639; }
.composer { padding: 12px 22px 14px; border-top: 1px solid var(--line); background: #111a29; min-width: 0; }
.composer label { display: block; margin-bottom: 6px; color: #c1cce0; font-size: 12px; }
.input-row { display: flex; gap: 10px; align-items: stretch; }
textarea { resize: none; height: 64px; min-height: 54px; max-height: 112px; flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid #4b5871; border-radius: 13px; background: #0c1422; color: var(--text); font-size: 14px; line-height: 1.5; }
textarea::placeholder { color: #a0b0c7; }
#send { width: 54px; min-height: 54px; flex-shrink: 0; display: grid; place-items: center; background: var(--rose); border: 1px solid #ffc0cd; color: #29121e; border-radius: 13px; }
#send:hover { background: #ffacbd; }
.composer-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 9px; font-size: 11px; color: var(--muted); }
.composer-footer p { margin: 0 auto 0 0; }
.composer-footer a { color: #ffc0cf; text-underline-offset: 3px; }
#operator-open, .operator-bar button { border: 1px solid #ac718c; background: #3c2b40; color: #fff0f5; border-radius: 9px; padding: 7px 11px; min-height: 36px; font-size: 12px; }
#operator-open:hover, .operator-bar button:hover { background: #50374f; }
.privacy-note { font-size: 11px; color: #a9b9d0; margin: 8px 0 0; }
.privacy-note summary { cursor: pointer; width: fit-content; color: #b8c6da; }
.privacy-note p { margin: 8px 0 0; max-width: 700px; }
.reply-status { display: flex; align-items: center; gap: 5px; margin: 0 0 7px; font-size: 12px; color: var(--rose); }
.reply-status:empty { display: none; }
.reply-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--rose); animation: yuna-dot 1s ease-in-out infinite; }
.reply-status i:nth-of-type(2) { animation-delay: .15s; }
.reply-status i:nth-of-type(3) { animation-delay: .3s; }
.reply-status span { margin-right: 4px; }
@keyframes yuna-dot { 0%,70%,100% { transform: translateY(0); opacity: .35; } 35% { transform: translateY(-4px); opacity: 1; } }
.message { max-width: 90%; margin: 14px 0 0; padding: 14px 17px; border: 1px solid #35445c; border-radius: 17px 17px 17px 5px; background: #1a273b; }
.message.user { margin-left: auto; background: #38293d; border-color: #785870; max-width: 82%; border-radius: 17px 17px 5px 17px; }
.message .speaker { display: block; font-size: 11px; font-weight: 700; color: #ffb0c2; margin-bottom: 6px; }
.message p { margin: 0; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.message.user .speaker { color: #e3cfe9; }
.reply-avatar { float: left; width: 30px; height: 30px; margin: 0 10px 5px 0; }
.sources { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sources a { font-size: 11px; color: #d0d9eb; text-decoration: none; border: 1px solid #53627c; border-radius: 8px; padding: 7px 10px; }
.sources a:hover { border-color: var(--rose); }
.answer-note { display: block; margin-top: 9px; font-size: 10px; color: #b0bfd3; }
.retry { background: #35283b; color: #ffd4df; border: 1px solid #ad758f; border-radius: 9px; min-height: 40px; padding: 7px 12px; margin-top: 10px; }
.operator-divider { display: flex; align-items: center; gap: 12px; font-size: 12px; color: #f2bdd0; margin: 22px 0 14px; }
.operator-divider::before, .operator-divider::after { content: ""; height: 1px; background: #896379; flex: 1; }
.operator-system-note { padding: 12px; border: 1px solid #5a557a; background: #1b2438; font-size: 12px; border-radius: 12px; color: #ded0ee; }
.operator-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; font-size: 11px; border: 1px solid #796180; background: #272237; border-radius: 11px; padding: 9px 11px; margin-bottom: 10px; }
.operator-bar > span { flex: 1; min-width: 140px; color: #ffd0e0; }
.operator-bar button { font-size: 11px; min-height: 32px; }
.operator-bar a, .operator-system-note a { color: #ffc2d2; }
.operator-inline-thread { display: contents; }
.operator-context { font-size: 12px; color: #c3cfe2; border: 1px solid #46536c; border-radius: 11px; padding: 11px 13px; margin-top: 14px; }
.operator-context summary { cursor: pointer; }
.operator-context p { white-space: pre-wrap; overflow-wrap: anywhere; }
.message.human { border-left: 3px solid var(--rose); background: #1b3043; }
html[data-chat-mode=operator] .input-row textarea { border-color: #c793ad; }
html[data-chat-mode=operator] #send { background: #eab4ca; }
.noscript { padding: 12px; }
@media (max-width: 960px) {
  .workspace { display: block; }
  .mascot { display: none; }
  .chat { height: calc(100% - 24px); margin: 12px; }
}
@media (max-width: 600px) {
  :root { --header-height: 54px; }
  .site-header { padding: 0 15px; justify-content: space-between; gap: 12px; }
  .brand { font-size: 19px; gap: 7px; }
  .brand img { width: 25px; height: 25px; }
  .site-header nav { gap: 14px; font-size: 12px; }
  .chat { height: 100%; margin: 0; border: 0; border-radius: 0; }
  .chat-header { padding: 12px 15px; gap: 10px; }
  .chat-header h2 { font-size: 19px; }
  .chat-header p { font-size: 11px; }
  .mobile-avatar { width: 38px; height: 38px; }
  #clear-chat { min-height: 38px; padding: 7px 9px; font-size: 11px; }
  .conversation { padding: 12px 15px 18px; }
  .composer { padding: 10px 15px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .composer-footer { gap: 8px 12px; }
  .composer-footer p { width: 100%; font-size: 10px; }
  #operator-open { min-height: 40px; }
  .message { max-width: 96%; padding: 12px 14px; }
  .message.user { max-width: 88%; }
  .suggestions { gap: 8px; }
  .suggestions button { padding: 10px 12px; font-size: 12px; }
  .welcome { gap: 16px; }
  .welcome-description { font-size: 12px; }
  #send { width: 49px; }
}
@media (max-height: 700px) {
  .chat-header { padding-top: 10px; padding-bottom: 10px; }
  .welcome > .portrait-avatar { display: none; }
  .welcome { gap: 12px; padding: 4px 0; }
  .welcome > p { font-size: 21px; }
  .welcome-description { margin: 0; font-size: 12px; }
  .mascot-caption { bottom: 20px; }
  .mascot h1 { font-size: 32px; }
  .composer { padding-top: 9px; padding-bottom: 10px; }
}
@media (max-height: 460px) {
  .composer-footer p, .welcome-description { display: none; }
  .chat-header .mobile-avatar { width: 32px; height: 32px; }
  .chat-header h2 { font-size: 17px; }
  textarea { height: 44px; min-height: 44px; padding: 8px 12px; }
  .composer label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .privacy-note:not([open]) { display: none; }
  #send { min-height: 44px; }
  .suggestions button { min-height: 38px; padding: 7px 10px; }
}
@media (prefers-reduced-motion: reduce) { .reply-status i { animation: none; } }
