/* Portrait-led voice page. Audio, model selection and wake-lock behavior live in app.js. */
:root {
  color-scheme: light;
  --paper: #f4f0e8;
  --ink: #244537;
  --muted: #6e786c;
  --green: #345c47;
  --red: #9f493f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: #e5dfd4; color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, a, summary, select { -webkit-tap-highlight-color: transparent; }
button, select { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button:focus-visible, a:focus-visible, summary:focus-visible, select:focus-visible,
input:focus-visible + span { outline: 2px solid #9b743f; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.call-page {
  position: relative; isolation: isolate; display: flex; flex-direction: column;
  width: min(100%, 540px); min-height: 540px; height: 100svh; height: 100dvh;
  margin: 0 auto; background: #eee7dc; overflow: clip;
}
.portrait-scene { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.portrait { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 43%; transform: translateY(-28px); }
.portrait-scene::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(245,241,232,.72) 0%, rgba(245,241,232,.10) 17%, transparent 32%, transparent 63%, rgba(245,241,232,.14) 77%, rgba(245,241,232,.50) 100%);
  pointer-events: none;
}
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: calc(22px + env(safe-area-inset-top)) 24px 0; }
.wordmark { text-decoration: none; color: var(--ink); font-size: 24px; font-family: "Songti SC", SimSun, serif; font-weight: 700; letter-spacing: 3px; }
.wordmark span { display: block; font-family: inherit; font-size: 11px; font-weight: 400; letter-spacing: 1px; margin-top: 5px; color: var(--muted); }
.connection { display: flex; align-items: center; gap: 5px; padding-top: 5px; color: #677164; font-size: 10px; line-height: 1.5; white-space: nowrap; }
.connection i { width: 5px; height: 5px; border-radius: 50%; background: #a3ac9d; }
.connection.connected i { background: #527e56; }
.call-dock {
  position: relative; margin-top: auto; padding: 28px 24px calc(12px + env(safe-area-inset-bottom));
  text-align: center;
  background: linear-gradient(180deg, rgba(246,242,234,0), rgba(246,242,234,.86) 25%, rgba(246,242,234,.97) 100%);
}
.call-status { min-height: 20px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.call-status h2 { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.5; letter-spacing: .5px; }
.presence { flex: 0 0 5px; width: 5px; height: 5px; border-radius: 50%; background: #849681; }
.presence[data-state="speaking"] { background: #345c47; animation: presence-breathe 1.4s ease-in-out infinite; }
.presence[data-state="listening"] { background: #527e56; }
.presence[data-state="thinking"] { animation: presence-breathe 2.4s ease-in-out infinite; }
.presence[data-state="muted"] { background: #a49b89; }
.call-time { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 5px; }
.status-hint { margin: 4px auto 0; max-width: 330px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.notice { margin: 9px auto 0; padding: 8px 11px; max-width: 340px; border: 1px solid rgba(133,91,51,.08); border-radius: 9px; background: rgba(231,214,192,.63); color: #76543c; font-size: 10px; line-height: 1.65; text-align: left; overflow-wrap: anywhere; }
.start-button { display: flex; justify-content: center; align-items: center; min-height: 48px; width: min(100%, 236px); margin: 13px auto 9px; padding: 10px 22px; border: 0; border-radius: 28px; color: #fffaf0; background: var(--green); font-size: 16px; letter-spacing: 1px; }
.start-button:active { transform: scale(.985); }
.control-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px auto 7px; }
.control-button { display: flex; justify-content: center; align-items: center; gap: 7px; min-width: 84px; min-height: 44px; padding: 8px 12px; border: 1px solid #cbd1c4; border-radius: 24px; background: rgba(248,246,239,.64); color: var(--ink); font-size: 12px; }
.control-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.control-button[aria-pressed="true"] { background: #dce3d6; border-color: #8eaa90; }
.hangup { color: var(--red); border-color: #d7beb1; background: rgba(240,222,211,.73); }
.hold-button { width: 100%; min-height: 45px; margin: 5px 0; border: 1px solid #b9c6af; border-radius: 12px; background: #e3e9da; color: var(--ink); font-size: 13px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.hold-button.recording { background: var(--green); color: var(--paper); }
.wake-line { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; }
.wake-status { color: var(--muted); font-size: 9px; line-height: 1.5; }
.recovery-button { min-height: 36px; padding: 7px 11px; border: 1px solid #b6c3ad; border-radius: 8px; background: #f7f3e9; color: var(--ink); font-size: 11px; }
.audio-recovery { margin: 8px auto 0; padding: 9px 12px; max-width: 340px; border-radius: 9px; color: #76543c; background: #efdfcbbb; }
.audio-recovery p { font-size: 11px; line-height: 1.65; margin: 0 0 5px; }
.tools-panel { margin: 0; }
.tools-panel > summary { display: inline-flex; align-items: center; gap: 5px; justify-content: center; min-height: 38px; padding: 6px 12px; color: #62755e; font-size: 11px; list-style: none; }
summary::-webkit-details-marker { display: none; }
.tools-panel > summary::after { content: "⌃"; font-size: 13px; margin-left: 3px; }
.tools-panel[open] > summary::after { content: "⌄"; }
.tools-content { position: absolute; z-index: 3; left: 16px; right: 16px; bottom: calc(100% - 7px); max-height: min(56svh, 390px); overflow-y: auto; overscroll-behavior: contain; padding: 18px; border: 1px solid #d7d7c8; border-radius: 16px; background: rgba(248,245,237,.97); box-shadow: 0 8px 35px #3d392325; text-align: left; }
.preferences { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 10px; }
.model-setting { flex-basis: 100%; display: grid; grid-template-columns: 1fr minmax(140px, 61%); align-items: center; gap: 6px 9px; }
.model-setting label { font-size: 12px; }
.model-setting select { min-height: 42px; width: 100%; border: 1px solid #bdc9b8; border-radius: 9px; padding: 8px 10px; background: #fcfaf4; color: var(--ink); font-size: 13px; }
.model-setting p { grid-column: 1/-1; font-size: 10px; color: var(--muted); line-height: 1.6; margin: 0; }
.voice-setting { display: flex; flex-direction: column; gap: 4px; }
.setting-label { font-size: 10px; color: var(--muted); }
.setting-value { font-size: 11px; }
.mode-setting { position: relative; display: flex; align-items: center; gap: 7px; font-size: 12px; }
.mode-setting input { position: absolute; opacity: 0; right: 0; top: 0; width: 35px; height: 22px; margin: 0; cursor: pointer; }
.switch-track { width: 35px; height: 22px; border-radius: 20px; background: #c4cbbb; position: relative; pointer-events: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fffdf5; transition: transform .15s; }
.mode-setting input:checked + .switch-track { background: #365f45; }
.mode-setting input:checked + .switch-track::after { transform: translateX(13px); }
.preferences > p { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.transcript-panel { margin-top: 15px; border-top: 1px solid #dcded1; padding-top: 10px; }
.transcript-panel summary { display: flex; align-items: center; min-height: 34px; list-style: none; font-size: 12px; }
.transcript-panel summary::before { content: "＋"; margin-right: 7px; }
.transcript-panel[open] summary::before { content: "－"; }
.transcript-panel summary > span { margin-left: auto; color: var(--muted); font-size: 10px; }
.transcript-list { margin-top: 8px; max-height: 200px; overflow-y: auto; overscroll-behavior: contain; }
.empty-transcript { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.8; }
.transcript-entry { margin: 0 0 15px; }
.transcript-entry h3 { font-size: 10px; font-weight: 500; color: var(--muted); margin: 0 0 4px; }
.transcript-entry p { font-size: 13px; line-height: 1.8; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.transcript-entry.assistant { border-left: 2px solid #b7c1aa; padding-left: 10px; }
footer { color: #818778; font-size: 9px; line-height: 1.5; }
footer span { padding: 0 4px; }
@keyframes presence-breathe { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
@media (min-width: 600px) { .call-page { box-shadow: 0 0 90px #4d463824; } }
@media (max-height: 680px) { .portrait { transform: translateY(-20px); } .topbar { padding-top: calc(16px + env(safe-area-inset-top)); } .wordmark { font-size: 24px; } .wordmark span { margin-top: 5px; font-size: 11px; } .call-dock { padding-top: 20px; padding-bottom: calc(9px + env(safe-area-inset-bottom)); } .start-button { margin-top: 10px; min-height: 46px; } .tools-panel > summary { min-height: 34px; } }
@media (max-width: 350px) { .topbar { padding-left: 18px; padding-right: 18px; } .call-dock { padding-left: 18px; padding-right: 18px; } .control-button { min-width: 78px; padding: 8px 10px; } .control-row { gap: 8px; } }
@media (orientation: landscape) and (max-height: 540px) { .call-page { min-height: 450px; } .portrait { object-position: 50% 32%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
