:root {
  --bg: #f7f8f2; --paper: #fffefa; --ink: #304936; --muted: #72806d;
  --green: #486a50; --border: #dde3d5; --serif: Georgia, 'Times New Roman', serif;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink); font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, textarea, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid #739565; outline-offset: 5px;
}
svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.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; }

/* A single welcome composition combines reaching hands with a soft circular glow. */
.opening {
  position: fixed; inset: 0; z-index: 10; width: 100%; height: 100dvh;
  overflow: auto; background: radial-gradient(ellipse at 50% 48%, #eaf0df 0, #f7f8f2 65%);
  transition: opacity .8s ease, transform .8s ease;
}
.opening.leaving { opacity: 0; transform: scale(1.025); pointer-events: none; }
.opening-layout {
  width: min(100%, 680px); min-height: 100%; margin: auto; display: flex; flex-direction: column;
  justify-content: center;
  padding: max(32px, env(safe-area-inset-top)) 42px max(32px, env(safe-area-inset-bottom));
}
.opening-header { display: flex; align-items: center; justify-content: center; gap: 12px; }
.opening-brand { display: inline-flex; align-items: center; gap: 10px; font: 34px var(--serif); letter-spacing: -.7px; white-space: nowrap; }
.opening-center {
  flex: 0 0 auto; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 0 12px; border: 0; background: none; text-align: center;
}
.opening-title { display: block; font: clamp(36px, 4.5vw, 54px)/1.15 var(--serif); letter-spacing: -1.7px; margin-top: 14px; animation: appear 1.6s ease both; }
.opening-title-phrase { white-space: nowrap; }
.opening-tagline { margin-top: 12px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.connection-scene { position: relative; display: grid; place-items: center; width: clamp(180px, 26dvh, 260px); aspect-ratio: 1; flex-shrink: 0; margin: 26px 0 12px; }
.connection-halo { position: absolute; inset: -18%; background: radial-gradient(ellipse, #dce5c877, transparent 69%); animation: halo-breathe 8s ease-in-out infinite; }
.breathing-ring { position: absolute; border-radius: 50%; animation: breath-expand 8s ease-in-out infinite; }
.ring-outer { inset: 0; background: #dbe5cb55; border: 1px solid #c9d7b737; }
.ring-inner { inset: 8%; background: #e1e9d67a; border: 1px solid #c9d7b737; animation-delay: .15s; }
.opening-bottom { width: min(100%, 480px); align-self: center; padding-top: 20px; }
.talk-panel { background: #e8eedf99; border: 1px solid #dce5d28c; padding: 18px 22px 20px; border-radius: 24px; }
.talk-panel > p { font: 18px var(--serif); margin: 0 0 12px; text-align: center; }
.talk-actions { display: flex; gap: 12px; }
.talk-actions button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; border: 0; border-radius: 17px; transition: background .2s, transform .2s; }
.talk-actions button:hover:not(:disabled) { transform: translateY(-2px); }
.talk-call { flex: 1; background: #57785f; color: #fffefa; font-size: 16px; }
.talk-call:hover:not(:disabled) { background: #486a50; }
.opening-hint { text-align: center; font-size: 10px; letter-spacing: 1px; color: #7e8c73; margin: 18px 0 0; }
.hands-illustration { position: relative; width: 88%; height: 88%; z-index: 1; stroke: none; overflow: visible; animation: appear 1.5s ease both; }
.hand-upper { animation: hand-reach-upper 8s ease-in-out infinite; }
.hand-lower { animation: hand-reach-lower 8s ease-in-out infinite; }
.hand-contour { fill: none; stroke: #6b8b6b; stroke-width: 1.4; opacity: .65; }
.hand-contour.soft { opacity: .3; }
.hand-highlight { fill: none; stroke: #e8efd9; stroke-width: 2; opacity: .55; }
.noscript-note { position: fixed; top: 0; z-index: 20; background: var(--paper); padding: 15px; width: 100%; text-align: center; }

/* The conversation expands until the per-message prompt viewer is opened. */
.app-shell { height: 100dvh; animation: appear .7s ease; display: flex; }
.main { height: 100%; display: flex; flex: 1; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; padding: 22px 40px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font: 32px var(--serif); letter-spacing: -1px; }

.topbar-controls { display: flex; gap: 10px; }
.account-button { border: 1px solid var(--border); border-radius: 999px; background: var(--paper); padding: 0 14px; min-height: 40px; font-size: 11px; }
.account-button:hover { background: #e9eee1; }
.feedback-button { border: 1px solid #aebfa3; border-radius: 999px; background: #edf2e5; color: var(--green); padding: 0 14px; min-height: 40px; font-size: 11px; }
.feedback-button:hover { background: #e2ead9; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #6b7e62; }
.icon-button:hover, .icon-button[aria-pressed="true"] { background: #e9eee1; }
.music-button { font-size: 23px; }
.conversation-area { flex: 1; min-height: 0; overflow: auto; padding: 0 24px; scroll-behavior: smooth; }
.conversation-area:focus { outline: none; }
.welcome { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 0 70px; }
h1 { font: 400 clamp(30px, 4vw, 42px)/1.2 var(--serif); letter-spacing: -1px; margin: 0 0 16px; }
.welcome h1 em { font-weight: 400; color: #7a9268; }
.welcome p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0; }
.messages { max-width: 700px; margin: 0 auto; }
.messages:empty { display: none; }
.message { display: flex; gap: 14px; margin: 26px 0; animation: appear .2s ease; }
.message-body { min-width: 0; max-width: 92%; }
.message-label { font-size: 9px; letter-spacing: 1px; color: var(--muted); padding-top: 6px; margin-bottom: 10px; }
.message-text { font-size: 15px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { justify-content: flex-end; }
.message.user .message-body { background: #eaf0e2; border-radius: 20px 20px 4px 20px; padding: 13px 20px; max-width: 85%; }
.message.assistant { margin-bottom: 34px; }
.message.opening-message { padding-top: 22px; }
.diagnostic-action { margin-top: 14px; border: 0; border-radius: 10px; background: var(--green); color: white; padding: 11px 15px; font-size: 12px; font-weight: 600; }
.diagnostic-action:hover { background: #34563d; }
.response-review { margin-top: 13px; color: var(--muted); font-size: 11px; }
.review-toggle { border: 0; background: none; color: var(--muted); padding: 3px 0; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.review-panel { margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; background: #f0f4e9; padding: 14px; }
.review-panel > p { margin: 0 0 10px; color: var(--ink); font-size: 12px; }
.review-ratings { display: flex; flex-wrap: wrap; gap: 7px; }
.review-ratings button, .outcome-options button { border: 1px solid #b9c9ae; border-radius: 999px; background: var(--paper); padding: 8px 12px; font-size: 11px; }
.review-ratings button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: white; }
.review-reasons { border: 0; padding: 0; margin: 14px 0 5px; }
.review-reasons legend { margin-bottom: 8px; font-size: 10px; }
.review-reasons label { display: inline-flex; align-items: center; gap: 5px; margin: 0 10px 7px 0; font-size: 10px; }
.review-reasons input { width: auto; }
.review-comment { width: 100%; margin-top: 10px; resize: vertical; border: 1px solid var(--border); border-radius: 8px; background: var(--paper); padding: 9px; font: inherit; }
.review-panel .review-privacy { margin: 9px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.review-submit { margin-top: 8px; border: 0; border-radius: 8px; background: var(--green); color: white; padding: 9px 13px; font-size: 11px; }
.review-submit:disabled { opacity: .55; }
.review-status { display: block; min-height: 16px; margin-top: 6px; font-size: 10px; }
.composer-wrap { flex-shrink: 0; width: 100%; max-width: 756px; align-self: center; padding: 18px 24px max(20px, env(safe-area-inset-bottom)); }
.composer { display: flex; align-items: flex-end; gap: 10px; background: var(--paper); border: 1px solid var(--border); border-radius: 22px; padding: 12px 12px 12px 19px; box-shadow: 0 4px 24px #344e3405; }
.composer:focus-within { border-color: #9aac8b; }
.composer textarea { flex: 1; min-width: 0; height: 40px; max-height: 130px; resize: none; border: 0; background: transparent; padding: 9px 0; line-height: 1.6; font-size: 14px; }
.composer textarea:focus-visible { outline: none; }
.composer textarea::placeholder { color: #7d8976; }
.composer-tools { display: flex; align-items: center; gap: 6px; }
.composer button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; }
.composer button:hover { background: #edf2e7; }
.composer #send-button { background: var(--green); color: white; }
.composer #send-button:hover { background: #34563d; }
.composer #language-hint-button { width: auto; min-width: 44px; padding: 0 7px; border-radius: 8px; }
#language-label { font-size: 9px; letter-spacing: .5px; }
#mic-button.recording { background: #a5493e; color: white; }
.voice-feedback { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.voice-feedback:has(#voice-status:empty):has(#cancel-recording[hidden]) { display: none; }
.voice-feedback:not(:has(#voice-status:empty)) { margin-top: 10px; }
.voice-feedback button, .listen-button { border: 1px solid #ccd7c1; border-radius: 8px; background: #f0f4e9; padding: 6px 10px; font-size: 11px; }
.voice-disclosure { text-align: center; color: var(--muted); font-size: 10px; line-height: 1.5; margin: 10px 0; }
.mode-notice { color: #877046; text-align: center; font-size: 10px; line-height: 1.5; margin-top: 8px; }
.mode-notice.live { color: var(--muted); }
.error-banner { background: #f9eee7; color: #865437; border: 1px solid #ecd5c6; border-radius: 10px; font-size: 12px; line-height: 1.5; padding: 12px; margin: 0 0 10px; }
.source-details { margin-top: 12px; color: var(--muted); font-size: 11px; }
.retrieved-context { margin-top: 14px; }
.retrieved-context p { line-height: 1.6; }
.context-entry { margin-top: 12px; }
.context-entry summary { overflow-wrap: anywhere; line-height: 1.6; }
.context-entry pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow-y: auto; background: #fff; padding: 12px; border-radius: 8px; font-size: 12px; line-height: 1.6; color: #29352d; }
.prompt-viewer-button { margin-top: 14px; border: 1px solid #b9c9ae; border-radius: 8px; background: #fffefa; padding: 9px 12px; font-size: 11px; }
.prompt-viewer-button:hover { background: #e7eee0; }
summary { cursor: pointer; }
.source-details > div { background: #eff3e8; border-radius: 10px; margin-top: 10px; padding: 14px; }
.source-entry { margin-bottom: 10px; }
.source-entry a, .source-entry span { display: block; line-height: 1.6; overflow-wrap: anywhere; }
.source-entry span { font-size: 10px; margin-top: 3px; }
.speech-controls { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.speech-controls span { font-size: 10px; color: var(--muted); }
.typing .dots { display: flex; gap: 5px; padding: 14px 0; }
.typing .dots i { height: 5px; width: 5px; border-radius: 50%; background: #91a780; animation: pulse 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .2s; }
.typing .dots i:nth-child(3) { animation-delay: .4s; }
.typing-label { font-size: 11px; color: var(--muted); }

.prompt-viewer { flex: 0 0 min(520px,42vw); height: 100%; overflow-y: auto; border-left: 1px solid var(--border); background: #f1f4eb; padding: 28px; box-shadow: -14px 0 40px #3049360c; }
.prompt-viewer:focus { outline: none; }
.prompt-viewer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.prompt-viewer-header h2 { margin: 8px 0 0; font-size: 28px; }
.prompt-viewer > p { color: var(--muted); font-size: 11px; line-height: 1.7; }
.prompt-meta { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin: 22px 0; font-size: 11px; }
.prompt-meta dt { color: var(--muted); }.prompt-meta dd { margin: 0; overflow-wrap: anywhere; }
.prompt-viewer h3 { margin: 24px 0 10px; font: 18px var(--serif); }
.prompt-viewer pre { margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: #fffefa; color: #29352d; white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Preferences and support remain available in dialogs. */
dialog { border: 1px solid var(--border); border-radius: 20px; width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 26px; background: var(--bg); color: var(--ink); box-shadow: 0 20px 80px #22372125; }
dialog::backdrop { background: #27372155; backdrop-filter: blur(5px); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; }
.section-kicker { font-size: 9px; letter-spacing: 1.4px; color: var(--muted); }
h2 { font: 400 32px/1.2 var(--serif); letter-spacing: -.8px; margin: 16px 0 25px; }
dialog label { display: block; font-size: 12px; margin: 19px 0 8px; }
dialog select, dialog input { width: 100%; background: var(--paper); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 13px; }
dialog input:focus { outline: 2px solid #9aac8b; outline-offset: 1px; }
dialog label span { color: var(--muted); font-size: 10px; }
dialog p { font-size: 12px; line-height: 1.8; color: var(--muted); }
.advanced-settings { margin: 22px 0; border-block: 1px solid var(--border); padding: 15px 0; font-size: 12px; }
.mode-pill { display: inline-flex; margin-top: 15px; font-size: 11px; }
.field-note { font-size: 11px; }
.privacy-note { font-size: 11px; line-height: 1.8; background: #edf2e5; padding: 14px; border-radius: 9px; margin: 22px 0; color: #65775a; }
.primary-button { background: var(--green); color: white; border: 0; border-radius: 10px; padding: 14px 18px; width: 100%; }
.secondary-button, .google-button { background: var(--paper); color: var(--ink); border: 1px solid var(--border); border-radius: 10px; padding: 13px 18px; width: 100%; margin-top: 10px; }
.google-button { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; background: #fff; border-color: #cbd3c5; font-weight: 600; box-shadow: 0 1px 2px #29352d12; }
.google-button:hover { background: #f8faf6; border-color: #aebca5; box-shadow: 0 2px 8px #29352d15; }
.google-button:active { transform: translateY(1px); box-shadow: none; }
.google-logo { width: 20px; height: 20px; flex: 0 0 20px; }
.outcome-options { display: flex; gap: 8px; margin: 18px 0 8px; }
.outcome-options button { flex: 1; border-radius: 10px; padding: 12px 8px; }
.skip-outcome { display: block; width: 100%; border: 0; background: none; color: var(--muted); padding: 12px 8px 2px; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.skip-sign-in { display: block; width: 100%; border: 0; background: none; color: var(--muted); padding: 14px 8px 5px; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.conversation-item { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; border-bottom: 1px solid var(--border); padding: 14px 0; }
.conversation-open { min-width: 0; border: 0; background: none; padding: 0; text-align: left; }
.conversation-open strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conversation-open span { display: block; color: var(--muted); font-size: 10px; margin-top: 6px; }
.conversation-delete { border: 0; background: none; color: #8a5048; font-size: 11px; }
.conversation-empty { padding: 20px 0; color: var(--muted); }
.preference-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; margin-top: 20px; }
.preference-actions button { border: 0; background: none; padding: 4px 0; font-size: 11px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.support-resource { background: #edf2e5; border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin: 20px 0; }
.support-resource strong { font-size: 12px; display: block; }
.support-resource > a { font: 32px var(--serif); display: block; margin-top: 14px; text-decoration: none; }
.support-resource .source-link { font-family: inherit; font-size: 11px; text-decoration: underline; }
.support-resource > .support-secondary-number { font: 15px/1.4 inherit; margin-top: 8px; text-decoration: underline; }
.behind { margin-top: 15px; }
#pipeline-details { overflow-wrap: anywhere; }
#pipeline-details dl { font-size: 11px; line-height: 1.6; }
#pipeline-details dt { margin-top: 10px; }
#pipeline-details dd { margin: 3px 0; color: var(--muted); }
@keyframes hand-reach-upper { 0%,100% { transform: translate(4px, -3px); } 50% { transform: translate(-2px, 3px); } }
@keyframes hand-reach-lower { 0%,100% { transform: translate(-4px, 3px); } 50% { transform: translate(2px, -3px); } }
@keyframes breath-expand { 0%,100% { transform: scale(.92); opacity: .65; } 50% { transform: scale(1.07); opacity: 1; } }
@keyframes halo-breathe { 0%,100% { transform: scale(.95); opacity: .65; } 50% { transform: scale(1.05); opacity: 1; } }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,80%,100% { opacity: .35; } 40% { opacity: 1; } }
@media (max-width: 600px) {
  .opening-layout { padding: max(28px, env(safe-area-inset-top)) 26px max(28px, env(safe-area-inset-bottom)); }
  .opening-brand { font-size: 30px; gap: 8px; }
  .opening-center { padding-top: 28px; }
  .opening-title { font-size: clamp(32px, 8.8vw, 42px); letter-spacing: -1.2px; }
  .talk-panel { padding: 19px; border-radius: 22px; }
  .talk-actions button { min-height: 54px; }
  .topbar { padding: 16px 20px; }
  .brand { font-size: clamp(24px, 6.5vw, 29px); white-space: nowrap; }
  .prompt-viewer { position: fixed; inset: 0; z-index: 12; width: 100%; height: 100dvh; padding: 22px; border-left: 0; }
  .topbar-controls .icon-button { width: 36px; }
  .topbar-controls { gap: 3px; }
  .account-button { padding: 0 9px; font-size: 10px; min-height: 36px; }
  .feedback-button { width: 36px; height: 36px; padding: 0; font-size: 0; }
  .feedback-button::after { content: "?"; font-size: 14px; font-weight: 700; }
  .conversation-area { padding: 0 20px; }
  .welcome { padding-bottom: 45px; }
  .welcome h1 em { font-weight: 400; color: #7a9268; }
.welcome p { max-width: 240px; }
  .composer-wrap { padding: 12px 14px max(14px, env(safe-area-inset-bottom)); }
  .composer { gap: 4px; padding: 9px 8px 9px 14px; border-radius: 19px; }
  .composer textarea { font-size: 16px; }
  .composer-tools { gap: 2px; }
  .composer button { width: 36px; height: 40px; }
  .composer #language-hint-button { min-width: 32px; padding: 0 3px; }
  #language-label { font-size: 8px; letter-spacing: 0; }
  .message { gap: 9px; }
  .message-text { font-size: 14px; }
  .message-body { max-width: 90%; }
  .voice-disclosure, .mode-notice { font-size: 9px; }
}
@media (max-width: 400px) {
  .topbar { padding: 12px; }
  .brand { font-size: 24px; }
  .topbar-controls { gap: 1px; }
  .topbar-controls .icon-button, .feedback-button, #account-button { width: 32px; height: 32px; min-height: 32px; padding: 0; }
  #account-button { font-size: 0; }
  #account-button::after { content: "●"; color: #7a9268; font-size: 10px; }
  #history-button { display: none !important; }
}
@media (max-height: 650px) {
  .opening-layout { padding-block: 16px; }
  .opening-center { padding: 12px 0 6px; }
  .connection-scene { width: 125px; margin: 12px 0 8px; }
  .opening-title { font-size: 32px; margin-top: 8px; }
  .opening-bottom { padding-top: 12px; }
  .talk-panel { padding: 14px 18px; }
  .talk-panel > p { margin-top: 10px; }
  .talk-actions button { min-height: 46px; }
  .opening-hint { margin-top: 12px; }
  .welcome { padding: 20px 0; }
}
@media (max-height: 480px) and (min-width: 600px) {
  .opening-layout { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; max-width: 850px; align-content: center; }
  .opening-header { grid-column: 1 / -1; }
  .opening-center { padding-top: 18px; }
  .opening-title { font-size: 29px; }
  .connection-scene { width: 135px; margin: 14px 0 10px; }
  .opening-bottom { align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
