:root {
  color-scheme: light;
  --bg: #eee8e5; --surface: #fffdfa; --text: #29292d; --muted: #686366;
  --accent: #a51930; --accent-soft: #f7e7e8; --border: #e5d6d6; --danger: #992137;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --font-body: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --space-1: 4px; --space-2: 8px; --space-3: 16px; --space-4: 24px; --space-5: 40px;
  --radius: 18px; --duration: 180ms; --ease: cubic-bezier(.16, 1, .3, 1);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font-body); line-height: 1.7; letter-spacing: .02em; }
button, input { font: inherit; }
button, summary, input { -webkit-tap-highlight-color: transparent; }
button { min-width: 44px; min-height: 44px; padding: .5em 1em; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; transition: background var(--duration), color var(--duration), transform var(--duration); }
button:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
summary { min-width: 44px; min-height: 44px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
p { margin: 0; }
.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; }
.kiosk-stage { --unit: min(1vw, .5625vh); width: min(100%, 56.25vh); min-height: 100vh; margin: 0 auto; padding: max(22px, calc(var(--unit) * 5)) max(18px, calc(var(--unit) * 5.9)) max(14px, calc(var(--unit) * 3)); position: relative; isolation: isolate; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 0, #f9e9e7, transparent 40%), radial-gradient(ellipse at 95% 70%, #faeeea, transparent 48%), linear-gradient(#fffdfa, #fff, #fff7f3); overflow: clip; }
.toprow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; z-index: 5; }
.clock-panel { flex: 1; min-width: 0; }
.weather { font-size: max(11px, calc(var(--unit) * 2.1)); color: var(--muted); }
.big-time { display: block; font-size: max(39px, calc(var(--unit) * 9.7)); line-height: 1.2; letter-spacing: -.045em; font-weight: 300; font-variant-numeric: tabular-nums; }
.date-line { color: var(--muted); font-size: max(10px, calc(var(--unit) * 1.9)); }
.top-right { display: flex; flex-direction: column; align-items: flex-end; gap: max(10px, calc(var(--unit) * 2.3)); }
.brand { display: flex; flex-direction: column; align-items: flex-end; gap: max(4px, calc(var(--unit) * .7)); }
/* 官方标志（行标 + 书法行名 + 英文行名），保持原始比例，不重绘、不拉伸。 */
.brand-logo { display: block; width: clamp(122px, 15.5vw, 176px); height: auto; }
.brand-sub { display: block; font-size: max(9px, calc(var(--unit) * 1.5)); color: var(--muted); letter-spacing: .04em; }
.top-tools { display: flex; align-items: center; gap: max(3px, calc(var(--unit) * .7)); font-size: max(10px, calc(var(--unit) * 1.6)); }
.top-tools > button, .settings > summary { padding: 0; width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.top-tools svg { width: 20px; height: 20px; flex: none; }
.settings { position: relative; }
.settings > summary { border: 1px solid var(--border); border-radius: 999px; background: var(--surface); list-style: none; }
.settings-panel { position: absolute; top: calc(100% + 10px); right: 0; z-index: 10; width: max(250px, calc(var(--unit) * 38)); padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 16px 40px #6b29331c; }
.view-switch { display: flex; gap: 8px; }
.view-switch button { flex: 1; font-size: max(12px, calc(var(--unit) * 1.7)); }
button[aria-pressed="true"]:not(.mic-button) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
#bot-actions { display: block; margin-top: 8px; }
#diagnostics { white-space: pre-line; font-size: max(11px, calc(var(--unit) * 1.6)); overflow-wrap: anywhere; }
.conversation { min-width: 0; flex: 1; display: flex; flex-direction: column; padding-top: max(22px, calc(var(--unit) * 5)); }
.hero-heading { text-align: center; }
.eyebrow { color: var(--accent); font-size: max(10px, calc(var(--unit) * 1.7)); letter-spacing: .16em; }
h1 { margin: max(5px, calc(var(--unit) * .8)) 0; font-family: var(--font-display); font-size: max(27px, calc(var(--unit) * 5.5)); font-weight: 500; letter-spacing: -.03em; line-height: 1.4; }
.description { color: var(--muted); font-size: max(11px, calc(var(--unit) * 2)); }
.avatar-presentation { position: relative; flex: 1; min-height: calc(var(--unit) * 61); display: grid; place-items: center; margin-top: calc(var(--unit) * 2); }
.halo { position: absolute; width: 95%; aspect-ratio: 1; pointer-events: none; }
.halo i { position: absolute; border: 1px solid #a5193018; border-radius: 50%; inset: 0; }
.halo i:nth-child(2) { inset: 10%; border-style: dashed; }
.halo i:nth-child(3) { inset: 21%; border-color: #a5193025; box-shadow: inset 0 0 40px #a5193006; }
.orb-stage { width: 77%; aspect-ratio: 1; position: relative; z-index: 1; margin-inline: auto; }
#orb { display: block; width: 100%; height: 100%; }
.orbit-caption { position: absolute; bottom: 1%; text-align: center; width: 100%; font-size: max(10px, calc(var(--unit) * 1.8)); color: var(--muted); }
.quick-questions { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.quick-questions button { position: absolute; display: flex; align-items: center; gap: .5em; pointer-events: auto; font-size: max(11px, calc(var(--unit) * 1.9)); padding: .55em .8em; background: #fffdfaeb; box-shadow: 0 8px 26px #7b27320a; }
.quick-index { color: var(--accent); font-size: .75em; }
.quick-questions button:nth-child(1) { left: 0; top: 18%; }
.quick-questions button:nth-child(2) { right: 0; top: 30%; }
.quick-questions button:nth-child(3) { left: 0; bottom: 25%; }
.quick-questions button:nth-child(4) { right: 0; bottom: 13%; }
.state-line { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--accent); font-size: max(11px, calc(var(--unit) * 1.9)); margin: calc(var(--unit) * 1.4) 0; }
.dot, .state-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.state-dot { background: var(--accent); }
.dot.online { background: #41724b; }
.mode-label { padding-left: .8em; border-left: 1px solid var(--border); color: var(--muted); }
.current-turn { border-top: 1px solid var(--border); padding-top: max(12px, calc(var(--unit) * 2)); }
.user-transcript { margin-bottom: .8em; font-size: max(12px, calc(var(--unit) * 2)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
#user-transcript-label { color: var(--accent); margin-right: .75em; font-size: .85em; }
.caption-row { min-height: calc(var(--unit) * 15); display: grid; align-items: center; }
.caption { font-size: max(18px, calc(var(--unit) * 3.25)); line-height: 1.65; text-align: center; overflow-wrap: anywhere; white-space: pre-line; }
.source-list { margin-top: .7em; color: var(--muted); font-size: max(10px, calc(var(--unit) * 1.6)); max-height: 3.5em; overflow: auto; overflow-wrap: anywhere; }
.progress-panel { margin-top: max(8px, calc(var(--unit) * 1.3)); }
#progress-current { text-align: center; color: var(--accent); font-size: max(11px, calc(var(--unit) * 1.9)); }
#progress-steps { margin: .4em 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .25em 1em; justify-content: center; color: var(--muted); font-size: max(10px, calc(var(--unit) * 1.5)); }
#progress-steps li::before { content: "·"; margin-right: .3em; }
#progress-steps li[data-status="complete"]::before { content: "✓"; }
#progress-steps li[data-status="running"], #progress-steps li[data-status="error"] { color: var(--accent); }
.controls { display: flex; align-items: center; justify-content: center; gap: clamp(10px, calc(var(--unit) * 1.8), 24px); margin-top: max(10px, calc(var(--unit) * 2)); }
/* 三个主控统一为同尺寸圆形按钮，只保留图标；文字仅留给读屏。 */
.toggle-button, .mic-button {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  width: clamp(52px, calc(var(--unit) * 5.6), 88px);
  height: clamp(52px, calc(var(--unit) * 5.6), 88px);
  min-width: 0; min-height: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: clamp(10px, calc(var(--unit) * 1.25), 13px);
  line-height: 1.2;
}
.controls .toggle-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.toggle-label { max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.toggle-button svg, .mic-button svg { width: clamp(20px, calc(var(--unit) * 2.6), 30px); height: clamp(20px, calc(var(--unit) * 2.6), 30px); }
.mic-button { border-color: var(--accent); background: var(--accent); color: var(--surface); box-shadow: 0 6px 18px #a5193022; }
.mic-button.is-on { background: var(--surface); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stop-button:disabled { opacity: .4; }
.hint { text-align: center; color: var(--muted); margin-top: max(12px, calc(var(--unit) * 1.5)); font-size: max(11px, calc(var(--unit) * 1.8)); }
.text-entry { margin-top: 3px; font-size: max(11px, calc(var(--unit) * 1.8)); }
.text-entry > summary { color: var(--accent); text-decoration: underline; text-underline-offset: .3em; }
#text-form { display: flex; gap: 8px; margin: 8px 0; }
#question { width: 100%; min-width: 0; min-height: 48px; padding: .8em; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px; }
#send { display: flex; align-items: center; gap: 8px; background: var(--accent); border-color: var(--accent); color: var(--surface); }
.notice { color: var(--danger); font-size: max(11px, calc(var(--unit) * 1.8)); text-align: center; overflow-wrap: anywhere; }
.notice:not(:empty) { margin-top: 10px; }
footer { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); border-top: 1px solid var(--border); margin-top: max(16px, calc(var(--unit) * 2)); padding-top: max(10px, calc(var(--unit) * 1.5)); font-size: max(9px, calc(var(--unit) * 1.5)); }
.connection { display: flex; align-items: center; gap: 5px; }
.large-text .caption { font-size: max(23px, calc(var(--unit) * 4.2)); }
.large-text .user-transcript, .large-text #progress-current, .large-text .hint { font-size: max(14px, calc(var(--unit) * 2.5)); }
@media (prefers-reduced-motion: no-preference) {
  .toprow, .hero-heading, .avatar-presentation, .current-turn, .controls { animation: arrive 640ms var(--ease) both; }
  .hero-heading { animation-delay: 80ms; } .avatar-presentation { animation-delay: 160ms; } .current-turn { animation-delay: 240ms; } .controls { animation-delay: 320ms; }
  @keyframes arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (max-width: 600px) {
  .kiosk-stage { --unit: 1vw; width: 100%; min-height: 100svh; padding: 20px 18px 14px; }
  .conversation { padding-top: 18px; }
  .avatar-presentation { min-height: 235px; }
  .top-tools { gap: 3px; }
  .top-tools > button, .settings > summary { padding: 0; }
  .brand strong { font-size: 16px; }
  .mode-label { font-size: 10px; }
  .quick-questions button { font-size: 11px; gap: 4px; }
  .quick-index { display: none; }
  .caption-row { min-height: 90px; }
  .orb-stage { width: 79%; }
  .controls { gap: 16px; }
  footer { font-size: 9px; }
  footer > span { text-align: right; }
}
/* 大屏固定视口预算：角色吸收剩余高度，回答和控件不再把页面向下撑开。 */
.kiosk-stage { height: 100svh; min-height: 0; overflow: visible; }
.toprow, .hero-heading, .state-line, .current-turn, .controls, .hint, .text-entry, .notice, footer { flex-shrink: 0; }
.conversation { min-height: 0; padding-top: max(12px, calc(var(--unit) * 3)); }
.avatar-presentation { min-height: 0; flex: 1 1 0; container-type: size; margin-top: 0; }
.orb-stage { width: min(77cqw, 90cqh); height: min(77cqw, 90cqh); aspect-ratio: 1; }
.halo { width: min(95cqw, 108cqh); }
.orbit-caption { bottom: 0; }
.current-turn { padding-top: max(8px, calc(var(--unit) * 1.3)); }
.user-transcript { max-height: 3.4em; margin-bottom: .35em; }
.caption-row { height: calc(var(--unit) * 18); min-height: 0; }
.caption { max-height: 100%; }
.source-list { max-height: 1.7em; margin-top: .2em; }
.progress-panel { margin-top: .25em; }
#progress-current { max-height: 3.4em; overflow: auto; }
#progress-steps { max-height: 3.4em; overflow: auto; margin-top: .2em; }
.controls { margin-top: max(8px, calc(var(--unit) * 1.5)); }
.hint { margin-top: max(6px, calc(var(--unit) * .8)); }
footer { margin-top: max(6px, calc(var(--unit) * 1)); padding-top: max(6px, calc(var(--unit) * .8)); }
.notice { max-height: 3.4em; overflow: auto; }
.notice:not(:empty) { margin-top: 4px; }
.answer-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 3px; font-size: max(11px, calc(var(--unit) * 1.8)); }
.answer-pages button { min-width: 44px; min-height: 44px; padding: 0; }
.settings-panel { max-height: 60svh; overflow: auto; }
.text-entry { position: relative; }
.text-entry[open] #text-form { position: relative; margin: 4px 0 0; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
/* 设置是显式菜单，展开时暂隐其下方快捷入口，关闭即恢复；主控始终保留。 */
.kiosk-stage:has(.settings[open]) .quick-questions { visibility: hidden; }
@media (max-width: 600px) {
  .kiosk-stage { padding: 12px 16px 10px; }
  .conversation { padding-top: 10px; }
  h1 { font-size: 25px; margin: 3px 0; }
  .big-time { font-size: 38px; }
  .avatar-presentation { min-height: 0; }
  .caption-row { height: 112px; }
  .caption { font-size: 18px; line-height: 1.5; }
  .large-text .caption { font-size: 23px; }
  .user-transcript { font-size: 11px; max-height: 1.7em; -webkit-line-clamp: 1; }
  #progress-steps { max-height: 1.7em; }
  .large-text .user-transcript, .large-text #progress-current, .large-text .hint { font-size: 12px; }
  .quick-questions button { max-width: 49%; font-size: 10px; padding-inline: 8px; }
  .quick-questions button:nth-child(1), .quick-questions button:nth-child(2) { top: 3%; }
  .quick-questions button:nth-child(3), .quick-questions button:nth-child(4) { bottom: 8%; }
  .orbit-caption { display: none; }
  .state-line { margin: 4px 0; }
  .controls { gap: 12px; margin-top: 6px; }
  .toggle-button, .mic-button { min-height: 0; }
  .hint { margin-top: 4px; font-size: 10px; }
  .text-entry { margin-top: 0; }
  footer { font-size: 8px; }
  .top-tools { font-size: 10px; }
  .brand strong { font-size: 14px; letter-spacing: .02em; }
  .brand span:not(.brand-mark) { font-size: 8px; }
}
@media (min-width: 601px) and (max-height: 800px) { .kiosk-stage { width: max(375px, 56.25vh); } }

/* ---------------- 按屏幕比例自适应 ----------------
   竖屏沿用单列九比十六舞台；横屏与近方形改为左右两列，
   左列放品牌感强的角色，右列放本轮问答，主控始终居中并保持 44px 以上热区。 */
.brand-sub { font-size: max(9px, calc(var(--unit) * 1.5)); }
@media (min-aspect-ratio: 1/1) {
  .kiosk-stage {
    width: 100%;
    max-width: none;
    --unit: min(.52vw, .95vh);
    padding: max(12px, 2.2vh) clamp(20px, 3.4vw, 64px) max(8px, 1.2vh);
  }
  .conversation {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto auto auto auto;
    grid-template-areas:
      "hero hero"
      "avatar turn"
      "state turn"
      "controls controls"
      "hint hint"
      "entry entry"
      "notice notice";
    column-gap: clamp(16px, 2.6vw, 56px);
    row-gap: clamp(3px, .7vh, 10px);
    padding-top: clamp(4px, 1vh, 14px);
  }
  .conversation > * { min-width: 0; min-height: 0; }
  .big-time { font-size: clamp(36px, calc(var(--unit) * 7.2), 76px); }
  .hero-heading { grid-area: hero; text-align: left; }
  .hero-heading h1 { font-size: max(24px, calc(var(--unit) * 4.4)); margin: 2px 0; }
  .hero-heading .description { font-size: max(11px, calc(var(--unit) * 1.9)); }
  .avatar-presentation { grid-area: avatar; }
  .state-line { grid-area: state; margin: 0; justify-content: flex-start; }
  .current-turn {
    grid-area: turn;
    border-top: 0;
    border-left: 1px solid var(--border);
    padding: 0 0 0 clamp(16px, 2vw, 36px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: clamp(4px, .8vh, 12px);
  }
  .caption-row { height: auto; min-height: calc(var(--unit) * 12); }
  .caption { text-align: left; }
  .source-list { max-height: 3.4em; }
  .progress-panel { margin-top: 0; }
  #progress-current, #progress-steps { max-height: 3.4em; }
  .controls { grid-area: controls; margin-top: 0; }
  .hint { grid-area: hint; margin-top: 2px; }
  .text-entry { grid-area: entry; margin-top: 0; }
  .notice { grid-area: notice; }
  .notice:not(:empty) { margin-top: 2px; }
  footer { margin-top: clamp(4px, .8vh, 12px); padding-top: clamp(4px, .6vh, 8px); }
  .quick-questions button { font-size: max(10px, calc(var(--unit) * 1.55)); }
  .quick-questions button:nth-child(1) { left: 0; top: 8%; }
  .quick-questions button:nth-child(2) { right: 0; top: 26%; }
  .quick-questions button:nth-child(3) { left: 0; bottom: 24%; }
  .quick-questions button:nth-child(4) { right: 0; bottom: 6%; }
  .orbit-caption { font-size: max(9px, calc(var(--unit) * 1.6)); }
}
@media (min-aspect-ratio: 1/1) and (max-width: 820px) {
  /* 小平板横屏进一步压缩非关键信息，保证主控与字幕不被挤出 */
  .hero-heading .description { display: none; }
  .orbit-caption { display: none; }
  .quick-questions button:nth-child(3), .quick-questions button:nth-child(4) { display: none; }
}

