@import './shared-ui.css';
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
[hidden] { display: none !important; }
.wrap { width: min(100%, 1200px); margin-inline: auto; padding-inline: 32px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header { width: 100%; min-height: 80px; flex: none; display: flex; align-items: center; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; gap: 16px; font-weight: 750; letter-spacing: -.04em; }
.brand img { width: 128px; height: 192px; object-fit: contain; flex: none; transition: width 250ms ease, height 250ms ease; }
.brand-wordmark { white-space: nowrap; }
.brand-zh { display: none; }
.brand-en { display: block; }
:root:lang(zh) .brand-zh { display: block; }
:root:lang(zh) .brand-en { font-size: 17px; font-weight: 500; letter-spacing: .12em; margin-top: 7px; color: var(--secondary); }
.site-header nav { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; font-size: 14px; }
.header-preferences, .header-links { display: flex; align-items: center; gap: 14px; }
.header-preferences { flex: none; }
.header-links { flex-wrap: wrap; justify-content: flex-end; margin-inline-start: auto; }
.theme-switch { --slot: 36px; position: relative; width: calc(var(--slot) * 3 + 10px); height: 42px; display: grid; grid-template-columns: repeat(3, var(--slot)); flex: none; align-items: center; border: 1px solid var(--line); border-radius: 24px; background: var(--muted); padding: 0 4px; color: var(--secondary); }
.theme-switch::before { content: ""; position: absolute; left: 5px; top: 4px; width: 34px; height: 32px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 5px rgba(0,0,0,.13); transition: transform 180ms ease; }
:root[data-theme-choice=system] .theme-switch::before { transform: translateX(var(--slot)); }
:root[data-theme-choice=dark] .theme-switch::before { transform: translateX(calc(var(--slot) * 2)); }
.theme-option { position: relative; display: grid; place-items: center; width: var(--slot); height: 38px; border: 0; border-radius: 50%; padding: 0; background: transparent; color: var(--secondary); }
.theme-option[aria-pressed=true] { color: var(--text); }
:root[data-theme=dark] .theme-option[data-choice=dark][aria-pressed=true] { color: var(--brand); }
.theme-option:focus-visible { z-index: 1; }
.theme-icon { width: 19px; height: 19px; pointer-events: none; }
.theme-switch:hover { border-color: var(--control); }
.language-select { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 42px; padding: 0 9px; border: 1px solid var(--line); border-radius: 22px; background: var(--muted); color: var(--text); cursor: pointer; }
.language-select:hover { border-color: var(--control); }
.language-select:focus-within { outline: 2px solid var(--text); outline-offset: 3px; }
.language-select svg { width: 18px; height: 18px; flex: none; pointer-events: none; }
.language-select .language-chevron { width: 13px; height: 13px; }
.language-current { width: min(18vw, 104px); min-width: 75px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; pointer-events: none; }
.language-select select { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; border: 0; opacity: 0; cursor: pointer; }
.language-select select option { background: var(--surface); color: var(--text); }
.nav-login { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 11px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-weight: 600; }
.nav-login:hover { background: var(--muted); }

.hero { flex: 1; display: flex; flex-direction: column; align-items: center; padding-top: clamp(60px, 15vh, 150px); padding-bottom: 60px; transition: padding-top 250ms ease; }
.intro { width: min(100%, 780px); text-align: center; margin-bottom: 30px; }
.intro h1 { font-size: 64px; line-height: 1.1; margin: 0 0 18px; transition: font-size 250ms ease; }
.intro p { font-size: 19px; line-height: 1.7; color: var(--secondary); margin: 0; }
.chat-shell { width: min(100%, 720px); }
.chat-reveal { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 250ms ease, opacity 250ms ease; }
.chat-panel { min-height: 0; overflow: hidden; }
body.chat-active .chat-reveal { grid-template-rows: 1fr; opacity: 1; }
.chat-top { min-height: 53px; display: flex; align-items: center; justify-content: space-between; padding: 6px 22px; border-bottom: 1px solid var(--line); color: var(--secondary); font-size: 13px; }
.reset-button { border: 0; background: transparent; color: var(--secondary); min-height: 40px; padding: 6px 8px; border-radius: 8px; }
.reset-button:hover { color: var(--text); background: var(--muted); }
.conversation { max-height: min(54vh, 560px); min-height: 160px; overflow-y: auto; padding: 19px 22px; }
.message { display: flex; gap: 10px; align-items: flex-start; margin: 13px 0; line-height: 1.65; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { justify-content: flex-end; }
.message .bubble { max-width: min(86%, 620px); border-radius: 16px; padding: 10px 14px; }
.message.user .bubble { background: var(--soft); border-bottom-right-radius: 5px; }
.message.assistant .bubble { background: var(--muted); border-bottom-left-radius: 5px; }
.message.pending .bubble { color: var(--secondary); }
.message .trial-markdown { white-space: normal; }
.trial-markdown p { margin: 0 0 .65em; }
.trial-markdown > :last-child { margin-bottom: 0; }
.trial-markdown a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.trial-markdown ul, .trial-markdown ol { padding-left: 1.4em; margin: .6em 0; }
.trial-markdown pre { overflow-x: auto; white-space: pre; padding: 10px; border-radius: 8px; background: var(--muted); max-width: 100%; }
.trial-markdown table { border-collapse: collapse; width: 100%; }
.trial-markdown td, .trial-markdown th { padding: 6px 8px; border: 1px solid var(--line); text-align: left; }
.trial-markdown .table-scroll { overflow-x: auto; }
.trial-sources { margin-top: 12px; font-size: 13px; color: var(--secondary); }
.trial-sources summary { cursor: pointer; }
.mini-duck { width: 29px; height: 29px; object-fit: contain; flex: none; margin-top: 4px; }
.composer { display: flex; align-items: flex-end; gap: 14px; padding: 10px 11px 10px 23px; border: 1px solid var(--control); border-radius: 32px; background: var(--surface); box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--text); }
.composer textarea { display: block; flex: 1; min-width: 0; width: 100%; height: 40px; min-height: 40px; max-height: 144px; padding: 8px 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; line-height: 24px; }
.composer textarea::placeholder { color: var(--secondary); }
.composer button { flex: none; min-height: 40px; border: 0; border-radius: 22px; padding: 8px 17px; background: var(--brand); color: #242523; font-size: 14px; font-weight: 700; }
.composer button:hover { background: var(--brand-hover); }
.composer button:disabled { opacity: .55; cursor: default; }
.campaign-note { width: min(100%, 760px); display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 7px; text-align: center; color: var(--secondary); font-size: 12px; line-height: 20px; margin: 16px 0 0; }
.campaign-note strong { color: var(--text); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.campaign-note .campaign-separator { color: var(--control); padding-inline: 2px; }
.chat-error { width: min(100%, 760px); color: var(--danger); font-size: 13px; line-height: 1.5; margin: 9px 0 0; }
body.chat-active .hero { padding-top: 24px; }
body.chat-active .intro h1 { font-size: 36px; margin-bottom: 12px; }
body.chat-active .brand img { width: 60px; height: 90px; }
:root:lang(zh) body.chat-active .brand-en { font-size: 12px; }
body.chat-active .intro p { font-size: 16px; }
.site-footer { flex: none; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--secondary); font-size: 12px; }
.site-footer { flex-wrap: wrap; padding-block: 16px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 8px 18px; line-height: 1.8; }
.legal-links a { text-decoration: underline; text-underline-offset: 3px; }
.legal-links a:hover { color: var(--text); }
.auth-legal { justify-content: center; margin-top: 14px; color: var(--secondary); font-size: 12px; }

.auth-dialog { position: fixed; width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 26px; padding: 30px; background: var(--surface); color: var(--text); box-shadow: 0 28px 80px rgba(26, 22, 8, .18); }
.auth-dialog::backdrop { background: rgba(36, 32, 20, .28); backdrop-filter: blur(2px); }
:root[data-theme=dark] .auth-dialog::backdrop { background: rgba(0, 0, 0, .46); }
.auth-close { position: absolute; right: 20px; top: 15px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--secondary); font-size: 26px; line-height: 1; }
.auth-close:hover { background: var(--muted); color: var(--text); }
.auth-brand { display: flex; align-items: center; gap: 7px; font-size: 18px; font-weight: 750; }
.auth-brand img { width: 42px; height: 42px; object-fit: contain; }
.auth-dialog h2 { margin: 22px 0 5px; font-size: 27px; letter-spacing: -.025em; }
.auth-subtitle { margin: 0 0 25px; color: var(--secondary); font-size: 14px; }
.auth-tabs { display: flex; gap: 5px; padding: 4px; margin-bottom: 24px; background: var(--muted); border-radius: 13px; }
.auth-tabs button { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--secondary); font-weight: 650; }
.auth-tabs button[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.auth-form { display: grid; gap: 15px; }
.auth-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.auth-form input { width: 100%; height: 47px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; outline: 0; background: var(--bg); color: var(--text); font-size: 15px; }
.auth-form input:focus { border-color: var(--control); box-shadow: 0 0 0 3px var(--soft); }
.auth-primary { min-height: 47px; margin-top: 5px; border: 0; border-radius: 12px; background: var(--brand); color: #242523; font-weight: 700; }
.auth-primary:hover { background: var(--brand-hover); }
.auth-primary:disabled { opacity: .6; cursor: wait; }
.auth-error { margin: 16px 0 0; color: var(--danger); font-size: 13px; line-height: 1.5; }
.auth-fallback, .auth-dev-mailbox { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.auth-help { margin: 21px 0 0; color: var(--secondary); font-size: 12px; line-height: 1.5; text-align: center; }
.auth-verify-copy { margin: 0; color: var(--secondary); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.auth-dev-mailbox { font-size: 13px; }
.auth-resend { justify-self: start; border: 0; padding: 4px 0; background: transparent; color: var(--secondary); font-size: 13px; }
.auth-resend:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 640px) {
  .wrap { padding-inline: 20px; }
  .site-header { min-height: 68px; }
  .brand { gap: 12px; }
  .brand img { width: 96px; height: 144px; }
  .site-header nav { flex-wrap: wrap; gap: 8px; font-size: 13px; }
  .header-preferences { gap: 8px; }
  .header-links { gap: 4px; max-width: 100%; }
  .theme-switch { --slot: 32px; height: 40px; }
  .theme-switch::before { width: 30px; height: 30px; }
  .theme-option { height: 36px; }
  .language-select { height: 40px; padding-inline: 7px; }
  .language-current { width: 70px; min-width: 0; font-size: 12px; }
  .nav-login { min-height: 40px; padding: 7px 8px; }
  .hero { padding-top: max(11vh, 54px); padding-bottom: 50px; }
  .intro { margin-bottom: 28px; }
  .intro h1 { font-size: 49px; margin-bottom: 18px; }
  :root:not(:lang(zh)) .intro h1 { font-size: clamp(30px, 7vw, 49px); }
  .intro p { font-size: 17px; }
  .conversation { max-height: 50vh; padding: 14px; }
  .chat-top { padding-inline: 14px; }
  .composer { padding: 8px 9px 8px 18px; gap: 6px; }
  .composer button { padding-inline: 13px; }
  body.chat-active .hero { padding-top: 14px; }
  body.chat-active .intro { margin-bottom: 21px; }
  body.chat-active .intro h1 { font-size: 29px; }
  :root:not(:lang(zh)) body.chat-active .intro h1 { font-size: 29px; }
  .site-footer { min-height: 56px; }
  .auth-dialog { padding: 25px 21px; border-radius: 22px; }
}
@media (max-width: 360px) {
  .wrap { padding-inline: 15px; }
  .site-header nav { font-size: 12px; }
  .nav-login { padding-inline: 7px; }
  .language-select { width: 40px; justify-content: center; }
  .language-current { display: none; }
  .language-select .language-chevron { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* A brighter neutral input surface in the dark palette. */
:root[data-theme=dark] .composer { background: var(--muted); }

.restore-reset{margin-top:6px;color:var(--secondary);font-size:13px;text-decoration:underline;text-underline-offset:3px}
