/* Vic AI · 日系療癒貓咪・手繪色鉛筆風. All illustration URLs are local. */
:root {
  color-scheme: light;
  --paper: #F8F3E9;
  --tea: #B78E72;
  --pink: #D7A8A0;
  --sage: #A9B7A0;
  --ink: #644D40;
  --card: #FFFCF6;
  --muted: #806858;
  --line: #D8C9B6;
  --user: #EEE0CF;
  --focus: #78543D;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; padding: 32px 24px 16px; background: var(--paper) url('./paper-grain.svg'); color: var(--ink); font: 16px/1.7 'Hiragino Maru Gothic ProN', 'Yu Gothic', 'Microsoft JhengHei', system-ui, sans-serif; }
button, input, textarea { font: inherit; }
button { touch-action: manipulation; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button { min-height: 44px; border: 1px solid transparent; border-radius: 12px 10px 13px 10px; padding: 10px 18px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
button:disabled { opacity: .55; cursor: wait; }
button:hover:not(:disabled) { border-color: var(--ink); }
.primary { background: var(--tea); color: #302016; border-color: #A47B60; }
.secondary { background: #F0E9DC; border-color: var(--line); }
.approve { background: #DFE7D8; border-color: var(--sage); color: #3D5335; }
.reject { background: #F3E1DC; border-color: var(--pink); color: #77463F; }
.container { width: min(100%, 1060px); margin: 0 auto; }
.brand-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 6px 24px; }
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark { width: 52px; height: 52px; background: #EEE1CD; border: 1px solid #CEB69B; border-radius: 19px 22px 17px 20px; display: grid; place-items: center; transform: rotate(-4deg); }
.brand-mark img { width: 29px; height: 29px; }
h1 { font-family: Georgia, 'Yu Mincho', serif; font-size: 31px; line-height: 1.1; letter-spacing: .015em; margin: 0 0 6px; font-weight: 500; }
.tagline { margin: 0; font-size: 13px; letter-spacing: .12em; color: var(--muted); }
.header-note { font-size: 12px; letter-spacing: .14em; color: var(--muted); margin: 0; display: flex; align-items: center; gap: 12px; }
.header-note::before { content: ''; width: 30px; border-top: 1px solid #B6BEA8; transform: rotate(-5deg); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 19px 16px 21px 17px; box-shadow: 0 4px 0 #E9DFD022, 0 9px 28px #644D4006; padding: 28px; margin-bottom: 20px; min-width: 0; }
h2 { margin: 0 0 12px; font-size: 20px; font-weight: 600; letter-spacing: .04em; line-height: 1.5; }
p { overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.8; }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .19em; margin: 0 0 16px; }
.login-layout { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 530px; padding: 38px 54px; align-items: center; gap: 44px; }
.login-story { text-align: center; padding: 12px 8px 0; }
.login-story h2 { font-family: 'Yu Mincho', 'Songti TC', serif; font-size: 26px; line-height: 1.8; font-weight: 500; letter-spacing: .12em; }
.login-story p { margin: 8px 0; }
.cat { display: inline-block; flex: 0 0 auto; background-image: url('./vic-cat-atlas.webp'); background-size: 200% auto; aspect-ratio: 640 / 533; background-repeat: no-repeat; pointer-events: none; }
.cat-peek { background-position: left top; }
.cat-sleep { background-position: right top; }
.cat-sit { background-position: left bottom; aspect-ratio: 640 / 747; }
.cat-stretch { background-position: right bottom; aspect-ratio: 640 / 747; }
.login-cat { display: block; width: 245px; height: auto; margin: -24px auto -22px; }
.login-form { border-left: 1px dashed #D9C8B2; padding: 16px 0 16px 38px; }
.login-form h2 { font-size: 22px; margin-bottom: 8px; }
.login-form > .muted { margin-top: 0; margin-bottom: 24px; }
label { display: block; margin: 16px 0 7px; font-size: 14px; font-weight: 600; }
input, textarea { display: block; width: 100%; border: 1px solid #C8B49E; border-radius: 11px 13px 12px 10px; background: #FFFDF8; color: var(--ink); padding: 12px 14px; font-size: 16px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input { min-height: 48px; }
#loginBtn { width: 100%; margin-top: 26px; display: flex; align-items: center; justify-content: center; gap: 9px; }
.paw-icon { width: 18px; height: 18px; display: inline-block; }
.login-footnote { margin: 16px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.notebook-nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 3px; margin: 4px 0 0; }
.tabs { display: flex; gap: 5px; flex-wrap: wrap; align-self: end; padding-left: 12px; }
.tabs button { border: 1px solid var(--line); border-bottom: 0; border-radius: 13px 13px 0 0; background: #EDE6D9; padding: 11px 22px; font-weight: 500; }
.tabs button[aria-pressed="true"] { background: var(--card); position: relative; z-index: 1; color: var(--ink); }
.tabs button[aria-pressed="true"]::after { content: ''; position: absolute; bottom: 6px; left: 22px; right: 22px; height: 3px; background: var(--pink); border-radius: 60%; transform: rotate(-2deg); }
.account { display: flex; align-items: center; gap: 8px; min-width: 0; padding-bottom: 8px; }
#userInfo { margin: 0; font-size: 11px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#logoutBtn { min-height: 36px; padding: 5px 10px; font-size: 12px; background: transparent; border-color: var(--line); }
#chatPanel { display: flex; flex-direction: column; height: max(550px, calc(100dvh - 220px)); padding: 0; margin-bottom: 0; border-top-left-radius: 13px; }
.chat-heading { display: flex; justify-content: space-between; align-items: center; padding: 21px 28px 17px; gap: 12px; border-bottom: 1px dashed #DFD1BF; }
.chat-heading h2 { margin: 0; font-size: 17px; }
.chat-heading .muted { font-size: 12px; margin: 3px 0 0; }
.heading-cat { width: 63px; height: auto; margin: -12px 0; }
.chat-body { overflow-y: auto; overscroll-behavior-y: contain; flex: 1; min-height: auto; padding: 22px 30px; scrollbar-color: #CDB9A2 transparent; scrollbar-width: thin; }
.chat-empty { min-height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 4px 16px 12px; }
.empty-cat { width: 205px; height: auto; margin: -12px 0 8px; }
.chat-empty h3 { font-family: 'Yu Mincho', 'Songti TC', serif; font-weight: 500; font-size: 22px; letter-spacing: .07em; margin: 8px 0 0; }
.chat-empty p { font-size: 13px; color: var(--muted); margin: 8px 0; }
.chat-messages { display: flex; flex-direction: column; gap: 22px; }
.chat-messages:empty { display: none; }
.chat-message { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 88%; min-width: 0; position: relative; font-size: 15px; line-height: 1.85; padding: 16px 20px; border: 1px solid var(--line); }
.chat-message p { margin: 6px 0 0; }
.message-user { align-self: flex-end; background: var(--user); border-radius: 17px 17px 5px 17px; max-width: 78%; }
.message-vic { align-self: flex-start; background: #FFFEFA; border-radius: 5px 17px 17px 17px; margin-left: 44px; }
.message-vic::before { content: ''; position: absolute; width: 52px; height: 43px; left: -55px; top: -5px; background: url('./vic-cat-atlas.webp') left top / 200% auto no-repeat; }
.message-label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .05em; }
.markdown { white-space: normal; line-height: 1.85; }
.markdown p { margin: 6px 0 12px; }
.markdown p:last-child { margin-bottom: 0; }
.markdown ul, .markdown ol { padding-left: 1.55em; margin: 9px 0; }
.markdown li + li { margin-top: 5px; }
.markdown pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #EFE9DE; border: 1px solid #D8CBB8; padding: 12px; border-radius: 8px; font-size: 13px; }
.markdown code { white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: .9em; }
.composer { flex: 0 0 auto; margin: 0 20px 16px; padding: 13px 16px 11px; border: 1px solid #CDB99F; border-radius: 15px 12px 15px 13px; background: #FFFDF8; }
.composer label { margin: 0 0 2px; font-size: 12px; color: var(--muted); font-weight: 400; }
.composer textarea { border: 0; padding: 5px 0; min-height: 64px; height: 64px; max-height: 180px; resize: vertical; background: transparent; }
.composer textarea:focus-visible { outline-offset: 2px; outline-width: 2px; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 8px; }
#sendBtn { display: flex; align-items: center; gap: 7px; padding: 9px 21px; }
#clearChatBtn { padding: 8px 0; border-color: transparent; background: transparent; font-weight: 400; font-size: 12px; color: var(--muted); }
#clearChatBtn:hover { color: var(--ink); text-decoration: underline; }
.content { white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px; background: #F3EEE3; border: 1px solid #E1D4C1; border-radius: 12px 10px 13px 11px; margin-top: 14px; }
.meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; margin-top: 8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
#reviewPanel > .card:first-child, #memoryPanel { border-top-left-radius: 12px; }
#memoryPanel > .muted { max-width: 74ch; }
#message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; color: var(--ink); margin: 10px 5px 0; line-height: 1.7; min-height: 22px; }
.page-footer { text-align: center; font-size: 11px; letter-spacing: .13em; color: var(--muted); padding: 21px 0 4px; }
.hidden, input[type="hidden"] { display: none !important; }
@media (max-width: 700px) {
  body { padding: 20px 12px 12px; }
  .brand-header { padding: 0 4px 22px; }
  .brand-mark { width: 44px; height: 44px; border-radius: 15px 17px 14px 17px; }
  .brand-mark img { width: 25px; height: 25px; }
  .brand { gap: 11px; }
  h1 { font-size: 27px; }
  .tagline { font-size: 11px; letter-spacing: .08em; }
  .header-note { display: none; }
  .card { padding: 20px 18px; border-radius: 16px; }
  .login-layout { display: block; padding: 22px 25px 28px; min-height: 0; max-width: 460px; margin: 0 auto 18px; }
  .login-story { padding: 0; }
  .login-story .eyebrow { margin-bottom: 2px; font-size: 11px; }
  .login-story h2 { font-size: 22px; line-height: 1.6; margin: 0; }
  .login-story > .muted { display: none; }
  .login-cat { width: 160px; height: auto; margin: -12px auto -14px; }
  .login-form { border-left: 0; border-top: 1px dashed var(--line); padding: 19px 0 0; margin-top: 12px; }
  .login-form h2 { font-size: 18px; }
  .login-form > .muted { margin-bottom: 14px; font-size: 12px; }
  .notebook-nav { align-items: stretch; flex-direction: column-reverse; gap: 5px; }
  .account { justify-content: flex-end; padding: 0 3px 4px; }
  #userInfo { max-width: 220px; }
  .tabs { align-self: stretch; gap: 4px; padding-left: 6px; }
  .tabs button { padding: 10px 13px; flex: 1; font-size: 13px; }
  .tabs button[aria-pressed="true"]::after { left: 16px; right: 16px; }
  #chatPanel { height: max(480px, calc(100dvh - 252px)); min-height: 0; }
  .chat-heading { padding: 15px 17px 13px; }
  .chat-heading .muted { font-size: 11px; max-width: 32ch; }
  .heading-cat { width: 49px; height: auto; }
  .chat-body { padding: 16px 15px; }
  .empty-cat { width: 170px; height: auto; margin: -12px 0 8px; }
  .chat-empty h3 { font-size: 18px; }
  .chat-empty p { font-size: 12px; }
  .chat-message { max-width: calc(100% - 34px); padding: 12px 14px; font-size: 15px; }
  .message-vic { margin-left: 32px; }
  .message-vic::before { width: 40px; height: 33px; left: -43px; }
  .message-user { max-width: 87%; }
  .composer { margin: 0 10px 10px; padding: 10px 12px; }
  .composer textarea { height: 58px; min-height: 58px; }
  .composer-actions { padding-top: 6px; }
  .page-footer { padding-top: 14px; }
}
@media (max-height: 600px) and (max-width: 700px) {
  #chatPanel { height: 440px; }
  .login-cat { width: 100px; height: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
/* Two small ink paw stamps: the frontend reveal follows a complete non-streaming reply. */
.chat-message { position: relative; padding-bottom: 2.3rem; }
.cat-paws { display: inline-flex; align-items: center; gap: .22em; margin-left: 1em; white-space: nowrap; vertical-align: baseline; line-height: 1; }
.cat-paw { display: inline-block; width: .95em; height: .95em; background: #222;
  mask: url('./paw.svg') center/contain no-repeat; -webkit-mask: url('./paw.svg') center/contain no-repeat; }
.cat-paw.small { width: .72em; height: .72em; background: #aaa; transform: translateY(.2em); }
.walking .cat-paw.large { animation: paw-large 1.6s steps(1,end) infinite; }
.walking .cat-paw.small { animation: paw-small 1.6s steps(1,end) infinite; }
.cat-paws.signature { position: absolute; right: .8rem; bottom: .65rem; margin: 0; }
@keyframes paw-large { 0%,100% { background: #222; } 50% { background: #aaa; } }
@keyframes paw-small { 0%,100% { background: #aaa; } 50% { background: #222; } }
.message-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .65rem; }
.message-actions button, .reveal-all { font-size: .8rem; padding: .4rem .6rem; min-height: 36px; }
.correction-editor { border-top: 1px dashed var(--line, #d4ccbc); margin-top: .6rem; padding-top: .6rem; }
.correction-editor p { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 15rem; overflow: auto; }
.correction-editor textarea, #memorySearch, #memoryFilter, .correction-editor select { width: 100%; max-width: 100%; box-sizing: border-box; margin: .4rem 0; }
.correction-editor button { margin: .3rem; }
.waiting-message { min-height: 4rem; }
@media (prefers-reduced-motion: reduce) { .walking .cat-paw { animation: none; } }
