html, body { height: 100%; overflow: hidden; }
button { min-height: 48px; border: 1px solid transparent; border-radius: 12px; padding: 11px 18px; font-weight: 600; background: var(--mist); color: var(--plum-deep); transition: background .15s ease, box-shadow .15s ease; }
button:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--card-border); }
button:disabled { opacity: .52; }
button.primary, button.send { background: #73466a; color: #fff; }
button.primary:hover:not(:disabled), button.send:hover:not(:disabled) { background: #58314f; box-shadow: none; }
button.ghost, button.quiet { background: transparent; color: var(--muted); border-color: var(--card-border); }
button.text-button { background: transparent; padding-inline: 10px; }
button svg { width: 20px; height: 20px; flex-shrink: 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; }
.noscript { position: fixed; inset: 24px; z-index: 200; background: var(--card); padding: 32px; }
.page { max-width: 1120px; height: 100vh; height: var(--app-height, 100dvh); margin: 0 auto; display: flex; flex-direction: column; min-width: 0; }
.page.chat-page { max-width: 840px; background: var(--card); border-inline: 1px solid var(--card-border); }
.masthead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 32px; flex-shrink: 0; }
.brand { color: var(--ink); font-family: var(--brand); font-size: 2rem; font-weight: 600; letter-spacing: -.04em; line-height: 1.1; text-decoration: none; margin: 0; }
.brand small { display: block; font-family: var(--body); font-size: 0.75rem; letter-spacing: .01em; line-height: 1.4; font-weight: 500; color: var(--muted); margin-top: 5px; }
.header-link { font-size: 0.875rem; min-height: 44px; display: inline-flex; align-items: center; padding: 8px; }
.chat-page .masthead { padding: 18px 24px; border-bottom: 1px solid var(--card-border); }
.chat-page .brand { font-size: 1.75rem; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.header-actions button { font-size: 0.875rem; padding: 9px 12px; min-height: 44px; }
.scroll-area { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scroll-padding: 20px; }
.setup { max-width: 1120px; margin: 0 auto; padding: 28px 32px 32px; }
.welcome-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 64px; align-items: center; min-height: min(640px, 76vh); padding-block: 12px 36px; }
.eyebrow { color: var(--plum-deep); font-size: 0.75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 16px; }
.welcome-copy h1 { margin: 0 0 20px; font-size: clamp(2.125rem, 4.4vw, 3.0625rem); line-height: 1.12; letter-spacing: -.045em; font-weight: 650; max-width: 14ch; }
.welcome-copy h1 span { color: var(--plum-deep); }
.welcome-copy > p:not(.eyebrow) { font-size: 1.0625rem; color: var(--muted); max-width: 39ch; margin: 0 0 24px; line-height: 1.65; }
.example { border-left: 3px solid var(--plum); padding: 2px 0 2px 20px; margin-top: 32px; max-width: 380px; }
.example .example-label { display: block; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 650; color: var(--muted); margin-bottom: 5px; }
.example p { margin: 0 0 14px; font-size: 0.9375rem; }
.example .kinder-example { color: var(--plum-deep); font-weight: 600; }
.example small { font-size: 0.6875rem; color: var(--muted); }
.welcome-actions { background: var(--card); padding: 28px; border: 1px solid var(--card-border); border-radius: 24px; box-shadow: var(--shadow); }
.welcome-actions h2 { font-size: 1.3125rem; margin: 0 0 5px; letter-spacing: -.025em; }
.welcome-actions > p { color: var(--muted); margin: 0 0 24px; font-size: 0.875rem; }
.choice-card { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 16px; margin: 0 0 12px; padding: 18px; border: 1px solid var(--card-border); background: var(--card); color: var(--ink); text-align: left; }
.choice-card.primary-choice { background: #73466a; color: #fff; border-color: #73466a; }
.choice-card .choice-title { display: block; font-size: 1rem; line-height: 1.4; }
.choice-card .choice-description { display: block; font-size: 0.8125rem; font-weight: 400; margin-top: 3px; color: var(--muted); }
.choice-card.primary-choice .choice-description { color: #f8eaf3; }
.choice-arrow { font-size: 1.375rem; font-weight: 400; }
.returning-choice { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--card-border); }
.returning-choice button { display: block; width: 100%; background: transparent; padding: 10px 0; font-size: 0.875rem; }
.welcome-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 0.75rem; margin-top: 20px; }
.welcome-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.setup-footer { color: var(--muted); font-size: 0.75rem; line-height: 1.7; max-width: 720px; margin: 12px auto 0; text-align: center; }
.setup-footer p { margin: 8px 0; }
.setup-footer a { display: inline-block; padding: 5px 2px; }
.setup-panel { max-width: 480px; margin: 12px auto 40px; }
.back-button { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 24px; background: transparent; padding: 8px 0; color: var(--muted); min-width: 70px; }
.setup-panel h1 { font-size: 1.875rem; line-height: 1.2; letter-spacing: -.03em; margin: 0 0 12px; }
.setup-panel .step-copy { color: var(--muted); font-size: 0.9375rem; line-height: 1.6; margin: 0 0 28px; }
.field { margin-bottom: 24px; }
.field label { display: block; font-size: 0.9375rem; font-weight: 600; margin-bottom: 8px; }
input[type=text], input:not([type]), textarea { border: 1px solid var(--control-border); border-radius: 12px; padding: 13px 15px; color: var(--ink); background: var(--card); width: 100%; min-height: 52px; font-size: 1rem; line-height: 1.5; box-shadow: none; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[aria-invalid=true] { border-color: var(--danger); }
.field-hint { color: var(--muted); font-size: 0.8125rem; margin: 8px 0 0; }
.code-input { text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; font-size: 1.4375rem !important; }
.setup-panel form > button.primary { width: 100%; }
.step-note { padding: 14px 16px; margin: 24px 0 0; border-radius: 12px; background: var(--mist); color: var(--plum-deep); font-size: 0.8125rem; }
.err { color: var(--danger); font-size: 0.875rem; line-height: 1.5; margin: 10px 0 0; }
.err:empty { display: none; }
.setup-notice, .status-bar { font-size: 0.8125rem; padding: 12px 18px; color: var(--ink); background: var(--mist); border-bottom: 1px solid var(--card-border); flex-shrink: 0; }
.setup-notice { max-width: 680px; margin: 0 auto 24px; border-radius: 12px; }
.status-bar:empty { display: none; }
.waiting { max-width: 520px; padding: 48px 24px; margin: 0 auto; text-align: center; }
.waiting-symbol { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: var(--mist); color: var(--plum-deep); margin: 0 auto 24px; }
.waiting-symbol svg { width: 28px; height: 28px; }
.waiting h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.025em; margin: 0 0 12px; }
.waiting > p { font-size: 0.9375rem; color: var(--muted); margin: 0 0 24px; }
.invitation-card { background: var(--mist); border-radius: 20px; padding: 24px; margin: 28px 0 20px; }
.invitation-card .field-label { font-size: 0.75rem; font-weight: 600; color: var(--plum-deep); }
.big-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(1.875rem, 9vw, 2.75rem); letter-spacing: .16em; margin: 10px 0 22px; color: var(--ink); }
.actions-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.actions-row button { display: inline-flex; gap: 8px; align-items: center; }
.waiting .waiting-status { font-size: 0.8125rem; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 22px 0; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--plum); }
.save-banner { margin: 16px 20px 0; padding: 14px 16px; border-radius: 14px; background: var(--mist); display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.save-banner .banner-copy { font-size: 0.8125rem; line-height: 1.5; }
.save-banner strong { display: block; color: var(--plum-deep); margin-bottom: 2px; }
.save-banner button { white-space: nowrap; font-size: 0.8125rem; padding: 10px 12px; background: var(--card); }
.journal-tabs { display: flex; gap: 4px; padding: 6px; background: var(--paper); border-bottom: 1px solid var(--card-border); flex-shrink: 0; }
.jtab { flex: 1; min-width: 0; border-radius: 10px; color: var(--muted); background: transparent; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.875rem; }
.jtab.active { background: var(--card); color: var(--plum-deep); box-shadow: 0 1px 5px rgba(30, 20, 40, .07); }
.jtab.private.active { box-shadow: inset 0 0 0 1px var(--plum); }
.jtab svg { width: 17px; height: 17px; }
.jt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--plum); }
.context-strip { padding: 12px 24px; border-bottom: 1px solid var(--card-border); background: var(--card); flex-shrink: 0; }
.context-strip strong { font-size: 0.8125rem; display: block; line-height: 1.4; }
.context-strip p { font-size: 0.75rem; color: var(--muted); margin: 3px 0 0; }
.context-strip.private-context { background: var(--mist); }
.context-strip.private-context strong { color: var(--plum-deep); }
.chat { padding: 24px; min-height: 100%; }
.empty { text-align: center; margin: 44px auto; max-width: 340px; padding: 24px 0; }
.empty-symbol { color: var(--plum); display: block; margin: 0 auto 16px; width: 36px; height: 36px; }
.empty h2 { font-size: 1.3125rem; letter-spacing: -.025em; margin: 0 0 10px; }
.empty p { font-size: 0.875rem; color: var(--muted); margin: 0; }
.day-divider { display: flex; align-items: center; gap: 12px; margin: 8px 0 24px; color: var(--muted); font-size: 0.6875rem; }
.day-divider:before, .day-divider:after { content: ""; flex: 1; height: 1px; background: var(--card-border); }
.msg { max-width: 92%; margin: 0 0 22px; }
.msg.from-self { margin-left: auto; }
.msg .speaker { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin: 0 0 7px; padding-inline: 2px; font-size: 0.6875rem; color: var(--muted); }
.msg.from-self .speaker { justify-content: flex-end; }
.msg .name { color: var(--ink); font-weight: 600; font-size: 0.75rem; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px 17px; border-radius: 16px 16px 16px 4px; background: var(--paper); font-size: 1rem; line-height: 1.6; }
.msg.from-self .body { background: var(--mist); border-radius: 16px 16px 4px 16px; }
.msg.counselor { max-width: 100%; border-left: 2px solid var(--plum); padding-left: 16px; margin-block: 30px; }
.msg.counselor .body { padding: 0; border-radius: 0; background: transparent; white-space: normal; }
.msg.counselor .body p { margin: 0 0 14px; white-space: pre-wrap; }
.msg.counselor .body p:last-child { margin-bottom: 0; }
.badge { color: var(--plum-deep); font-size: 0.625rem; font-weight: 600; border-radius: 100px; background: var(--mist); padding: 2px 7px; }
.correction { font-size: 0.75rem; color: var(--muted); margin-top: 6px; }
.correction summary { cursor: pointer; padding: 8px 2px; min-height: 32px; }
.original-text { display: block; margin: 2px 0 0; padding: 8px 12px; border-left: 2px solid var(--card-border); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.sources { font-size: 0.75rem; margin-top: 12px; }
.sources-label { font-weight: 600; margin-bottom: 4px; }
.sources a { display: inline-block; margin: 0 12px 6px 0; }
.scroll-bottom { position: sticky; display: none; left: calc(100% - 60px); bottom: 12px; min-width: 44px; min-height: 44px; padding: 10px; border-radius: 100px; background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--card-border); }
.scroll-bottom.show { display: inline-flex; }
.composer { padding: 16px 24px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--card-border); background: var(--card); flex-shrink: 0; }
.composer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.composer-label { display: block; font-size: 0.8125rem; font-weight: 600; }
.modes { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--card-border); border-radius: 12px; }
.modes button { font-size: 0.75rem; min-height: 36px; padding: 7px 12px; background: transparent; color: var(--muted); border-radius: 8px; }
.modes button.active { background: var(--mist); color: var(--plum-deep); }
.composer textarea { resize: none; min-height: 72px; max-height: min(160px, 24dvh); padding: 12px 14px; font-size: 1rem; }
.composer .actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.composer .right { display: flex; align-items: center; gap: 10px; }
.send-hint, .quota-note { font-size: 0.6875rem; color: var(--muted); margin: 0; }
.quota-note { margin-top: 10px; line-height: 1.4; }
.hint { font-size: 0.75rem; color: var(--muted); }
.private-compose-label { color: var(--plum-deep); display: flex; align-items: center; gap: 8px; }
.private-compose-label svg { width: 16px; height: 16px; }
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(24, 14, 30, .55); }
.modal-overlay.show { display: flex; }
.modal { width: 100%; max-width: 600px; max-height: calc(var(--app-height, 100dvh) - 40px); display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain; background: var(--card); border: 1px solid var(--card-border); border-radius: 24px; box-shadow: var(--shadow); }
.modal header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid var(--card-border); flex-shrink: 0; }
.modal header > div { min-width: 0; }
.modal h2 { overflow-wrap: anywhere; font-size: 1.375rem; line-height: 1.25; letter-spacing: -.03em; margin: 0; }
.modal .sub { font-size: 0.8125rem; line-height: 1.5; color: var(--muted); margin-top: 6px; }
.close-x { flex-shrink: 0; background: transparent; border: none; min-width: 44px; min-height: 44px; padding: 8px; color: var(--muted); font-size: 1.75rem; font-weight: 400; line-height: 1; margin: -8px -8px 0 0; }
.modal > .body { padding: 22px 24px; overflow-y: auto; min-height: min(12rem, 45dvh); flex: 1 1 auto; scroll-padding: 18px; }
.modal .body > p { margin: 0 0 16px; font-size: 0.9375rem; }
.modal .body > p:last-child { margin-bottom: 0; }
.modal footer { padding: 16px 24px; border-top: 1px solid var(--card-border); display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; flex-shrink: 0; }
.modal footer button { font-size: 0.875rem; }
.modal .blank { padding: 32px 8px; color: var(--muted); text-align: center; font-size: 0.875rem; }
.modal pre { font: 0.9375rem/1.65 var(--body); margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-original { color: var(--muted); white-space: pre-wrap; font-size: 0.875rem; margin: 12px 0 0; }
#preview-original-details summary { font-size: 0.8125rem; color: var(--muted); cursor: pointer; padding: 10px 0; }
#preview-edit { margin-top: 18px; }
#preview-edit label { font-size: 0.875rem; font-weight: 600; display: block; margin-bottom: 8px; }
#preview-text { min-height: 150px; max-height: 32dvh; resize: vertical; }
#preview-edit .pair-help { margin: 10px 0 16px; }
#preview-use-original { font-size: 0.8125rem; min-height: 44px; padding: 9px 12px; }
.safety-note { padding: 16px; border-left: 3px solid var(--danger); background: var(--rose); white-space: pre-wrap; font-size: 0.9375rem; }
.pair-section { margin-bottom: 28px; }
.kicker { font-size: 0.875rem; font-weight: 650; margin-bottom: 8px; }
.kicker.private { color: var(--plum-deep); }
.pair-help { font-size: 0.8125rem; color: var(--muted); line-height: 1.6; margin: 0 0 14px; }
.pair-value { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--card-border); padding: 8px; border-radius: 12px; }
.pair-value .v { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; padding: 6px; font-size: 0.75rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pair-value.big .v { font-size: 1.5rem; letter-spacing: .1em; }
.pair-value button { padding: 8px 10px; min-height: 44px; font-size: 0.8125rem; }
.pair-links { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8125rem; }
.pair-links a { padding: 8px 0; }
.danger-row { border-top: 1px solid var(--card-border); margin-top: 22px; padding-top: 22px; }
.danger-help { font-size: 0.8125rem; color: var(--muted); margin-bottom: 12px; line-height: 1.6; }
.danger-row button { font-size: 0.8125rem; background: transparent; border-color: var(--card-border); color: var(--danger); }
.consent-section { margin: 0 0 18px; }
.consent-section:last-child { margin-bottom: 0; }
.consent-section h3 { font-size: 0.875rem; margin: 0 0 6px; }
.consent-section p { font-size: 0.875rem; color: var(--muted); margin: 0; line-height: 1.6; }
.modal .consent-footer { display: block; }
.consent-choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--mist); border-radius: 12px; color: var(--ink); font-size: 0.8125rem; line-height: 1.55; cursor: pointer; }
.consent-choice input { width: 22px; height: 22px; min-width: 22px; accent-color: #73466a; margin: 0; }
.consent-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.consent-actions button { padding: 10px 14px; }
@media (min-width: 900px) { .chat-page { box-shadow: 0 0 60px -40px rgba(43,24,52,.25); } }
@media (max-width: 760px) {
  .masthead { padding: 22px 20px; }
  .setup { padding: 16px 20px 28px; }
  .welcome-layout { display: flex; flex-direction: column; align-items: stretch; min-height: 0; gap: 28px; padding-bottom: 24px; }
  .welcome-copy h1 { font-size: 2.25rem; max-width: 17ch; margin-bottom: 16px; }
  .welcome-copy > p:not(.eyebrow) { font-size: 0.9375rem; margin-bottom: 0; }
  .example { display: none; }
  .welcome-actions { padding: 0; border: 0; box-shadow: none; background: transparent; border-radius: 0; }
  .welcome-actions h2 { font-size: 1.125rem; }
  .welcome-actions > p { margin-bottom: 16px; }
  .choice-card { padding: 16px; }
  .welcome-note { margin-top: 14px; }
  .setup-footer { font-size: 0.6875rem; }
  .setup-panel { margin-top: 0; }
  .chat-page .masthead { padding: 14px 16px; gap: 10px; }
  .header-actions { gap: 4px; }
  .header-actions button { font-size: 0.75rem; padding: 8px 10px; }
  .context-strip { padding: 10px 18px; }
  .chat { padding: 20px 16px; }
  .composer { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  .composer-top { flex-wrap: wrap; gap: 8px; }
  .composer .actions { gap: 8px; }
  .composer .right { margin-left: auto; }
  .send-hint { display: none; }
  .save-banner { margin: 14px 16px 0; gap: 12px; align-items: flex-start; }
  .save-banner .banner-copy { font-size: 0.75rem; }
  .modal-overlay { padding: 12px; }
  .modal { max-height: calc(var(--app-height, 100dvh) - 24px); border-radius: 20px; }
  .modal header { padding: 20px 20px 16px; }
  .modal > .body { padding: 18px 20px; }
  .modal footer { padding: 14px 20px; }
  .modal header > div { min-width: 0; }
.modal h2 { overflow-wrap: anywhere; font-size: 1.3125rem; }
  .modal footer button { font-size: 0.8125rem; padding: 10px 13px; }
  .waiting { padding: 36px 20px; }
}
@media (max-width: 360px) {
  .header-actions button { padding: 8px; font-size: 0.6875rem; }
  .chat-page .brand { font-size: 1.625rem; }
  .composer-label { font-size: 0.75rem; }
  .modes { width: 100%; }
  .modes button { flex: 1; }
  .save-banner { flex-wrap: wrap; }
  .modal header, .modal > .body, .modal footer { padding-inline: 16px; }
}
@media (max-height: 650px) {
  .chat-page .masthead { padding-block: 8px; }
  .context-strip p { display: none; }
  .composer { padding-block: 8px; }
  .composer textarea { min-height: 52px; max-height: 96px; }
  .quota-note { margin-top: 6px; }
  .modal { display: block; }
  .modal > .body { overflow: visible; }
}

.mobile-example { display: none; }
@media (max-width:760px) { .mobile-example { display: block; margin-top: 14px; font-size: 0.8125rem; } .mobile-example summary { min-height: 44px; padding: 12px 0; color: var(--plum-deep); cursor: pointer; } .mobile-example p { margin: 12px 0; } .mobile-example p span { display: block; font-size: 0.6875rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; } .mobile-example small { color: var(--muted); } }

.page { overflow-y: auto; overflow-x: hidden; }
.composer { max-height: 52%; overflow-y: auto; }
.chat-page .scroll-area { min-height: 72px; }
@media (max-height:650px) { .chat-page .scroll-area { min-height: 40px; } }
