:root { color-scheme: dark; --bg: #212121; --surface: #303030; --text: #ececec; --muted: #b4b4b4; --line: #414141; font: 16px/1.6 'Segoe UI', system-ui, sans-serif; }
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #555 transparent; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; color: var(--text); background: var(--bg); }
button, input, textarea { font: inherit; }
button { color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
button:hover { background: #ffffff08; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, summary:focus-visible { outline: 2px solid #eee; outline-offset: 3px; }
.primary { background: #f5f5f5; color: #171717; border-color: #f5f5f5; font-weight: 600; }
.primary:hover { background: #ddd; }
.quiet { border: 0; color: var(--muted); }
p, h1, h2 { margin-top: 0; }
h2 { font-size: 20px; font-weight: 550; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.topbar { height: 64px; flex: 0 0 auto; padding: 0 28px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 21px; letter-spacing: -.04em; font-weight: 550; }
.tools-menu { position: relative; }
.tools-menu > summary { list-style: none; cursor: pointer; font-size: 14px; color: var(--muted); padding: 8px 12px; border-radius: 8px; }
.tools-menu > summary::-webkit-details-marker { display: none; }
.tools-popover { position: absolute; right: 0; top: 42px; z-index: 10; width: 200px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px #0007; }
.tools-popover button { display: block; width: 100%; text-align: left; border: 0; font-size: 14px; }
#notice:empty { display: none; }
#notice { flex-shrink: 0; margin: 0; padding: 8px 24px; font-size: 14px; }
.error { color: #f4c197; }
.workspace { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.deck-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 32px 24px; }
.empty { margin: 15vh auto 0; text-align: center; max-width: 500px; }
.empty h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 500; margin-bottom: 12px; letter-spacing: -.025em; }
.empty p { font-size: 15px; color: var(--muted); }
.conversation-wrap { width: min(740px, 100%); margin: 0 auto; }
#older-chat { display: block; margin: 0 auto 28px; font-size: 13px; }
.chat-turn { margin-bottom: 34px; }
.chat-message { font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.chat-message p { white-space: pre-wrap; margin: 0 0 14px; }
.user-message { width: fit-content; max-width: 85%; margin: 0 0 26px auto; padding: 12px 18px; background: var(--surface); border-radius: 20px 20px 5px 20px; }
.user-message p { margin: 0; }
.assistant-message { padding: 0 2px; }
.speaker { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.65; }
#chat-progress:empty { display: none; }
.composer { flex-shrink: 0; padding: 12px 24px 28px; max-height: 48%; overflow-y: auto; }
.composer form { width: min(740px, 100%); margin: 0 auto; display: flex; align-items: flex-end; gap: 12px; border: 1px solid var(--line); border-radius: 24px; padding: 10px 12px 10px 20px; background: var(--surface); }
.composer form:focus-within { border-color: #999; }
.composer textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 180px; margin: 0; padding: 8px 0; resize: none; border: 0; background: transparent; color: var(--text); line-height: 1.5; }
.composer textarea:focus { outline: none; }
textarea::placeholder, input::placeholder { color: #aaa; }
.composer .primary { flex: 0 0 auto; border-radius: 20px; padding: 9px 16px; font-size: 14px; }
.connection-hint { margin: 12px auto 0; text-align: center; color: var(--muted); font-size: 12px; }
.connection-hint button { font-size: 12px; color: var(--text); padding: 0 4px; text-decoration: underline; }
dialog { width: min(600px, 94vw); max-height: 88dvh; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
dialog::backdrop { background: #000a; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin-bottom: 12px; }
.dialog-heading h2 { margin: 0; }
dialog label { display: block; margin: 14px 0 6px; font-size: 14px; }
dialog input { display: block; width: 100%; border: 1px solid #555; background: #171717; color: var(--text); border-radius: 8px; padding: 10px; margin-bottom: 12px; }
dialog input:focus { outline: 1px solid #ccc; }
dialog summary { cursor: pointer; }
dialog .primary { width: 100%; margin-top: 8px; }
#ai-disconnect { display: block; margin: 12px auto 0; }
#ai-error:empty { display: none; }
.subscription-price { font-size: 36px; font-weight: 600; margin-bottom: 8px; letter-spacing: -.03em; }
.subscription-price span { font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: normal; }
.button-link { display: block; text-align: center; border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; text-decoration: none; }
.button-link.quiet:hover { color: var(--text); text-decoration: underline; }
.button-link:focus-visible { outline: 2px solid #eee; outline-offset: 3px; }
#billing-dialog { max-width: 440px; }
#billing-start { margin-bottom: 12px; }
#billing-manage { display: block; width: 100%; margin: 8px 0 18px; }
.history-entry { border-top: 1px solid var(--line); padding: 16px 0; overflow-wrap: anywhere; }
.history-entry .hint { margin: 0 0 6px; font-size: 12px; }
.history-entry summary { font-size: 15px; }
.history-content { white-space: pre-wrap; margin: 12px 0 0; }
[hidden] { display: none !important; }
@media (max-width: 560px) {
  .topbar { padding: 0 16px; }
  .empty { margin-top: 12vh; }
  .empty p { max-width: 260px; margin: 0 auto; }
  .deck-scroll { padding: 24px 20px; }
  .user-message { max-width: 92%; padding: 10px 15px; }
  .composer { padding: 10px 12px 16px; }
  .composer form { padding: 9px 10px 9px 16px; gap: 8px; }
  .composer .primary { padding: 9px 13px; }
  .chat-message { font-size: 15px; }
}
