html { scroll-padding-top: 82px; }
body { padding-bottom: env(safe-area-inset-bottom); }
button, input, textarea, select { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #b8652e; outline-offset: 3px; }
.privacy-banner, .update-notice { padding: 20px; margin: 12px 24px; border: 1px solid #c9d6cc; background: #f4f7ef; border-radius: 16px; }
.privacy-banner p { line-height: 1.7; margin: 8px 0 16px; }
.privacy-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.privacy-banner a, .privacy-document a { color: #254f43; text-decoration: underline; }
.privacy-document { max-width: 800px; padding: 32px 24px; margin: auto; line-height: 1.85; }
.privacy-document h1 { font-size: 28px; }
.privacy-document h2 { font-size: 20px; margin-top: 28px; }
.account-tools { margin-top: 24px; }
.account-tools button { margin: 6px 8px 6px 0; min-height: 44px; }
.account-tools textarea, .account-tools input { width: 100%; }
.recovery-code { overflow-wrap: anywhere; user-select: all; font-family: monospace; }
.danger-button { color: #913c32; border: 1px solid #dcc0b6; border-radius: 10px; padding: 10px 16px; background: white; }
.consent-label { display: flex !important; gap: 10px; align-items: flex-start; line-height: 1.6; }
.consent-label input { width: auto !important; margin-top: 6px; }
.report-link { font-size: 12px; margin-top: 10px; }
[hidden] { display: none !important; }
@media (max-width: 650px) {
  input, textarea, select { font-size: 16px; }
  .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
  .privacy-banner, .update-notice { margin: 12px; padding: 16px; }
  .privacy-actions button { min-height: 44px; }
  .admin-shell { padding-left: 16px; padding-right: 16px; }
  .model-select { max-width: calc(100% - 56px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* Give the conversation the usable phone screen, while keeping learning below. */
@media (max-width: 1000px) {
  .chat-panel { height: max(600px, calc(100svh - 160px)); max-height: none; }
  .chat-header .mobile-only { width: 40px; height: 40px; }
}
@media (max-width: 650px) {
  .workspace { padding: 10px 8px 28px; gap: 24px; }
  .chat-panel { height: max(470px, calc(100vh - 150px)); height: max(470px, calc(100svh - 150px - env(safe-area-inset-bottom))); min-height: 0; border-radius: 16px; }
  .chat-header { padding: 12px 12px 10px; gap: 9px; }
  .chat-header h2 { font-size: 16px; }
  .chat-header #aiState { font-size: 11px; max-width: 155px; }
  .chat-header .icon-button { width: 40px; height: 40px; flex-shrink: 0; }
  .chat-context { padding: 8px 12px; font-size: 12px; }
  .chat-messages { padding: 16px 12px; gap: 18px; }
  .bubble { font-size: 16px; line-height: 1.85; padding: 13px 14px; }
  .message-label { font-size: 11px; }
  .starter-card { padding: 16px; }
  .starter-card h3 { font-size: 16px; }
  .starter-card p,.starter-actions button { font-size: 14px; }
  .starter-actions button { min-height: 44px; }
  .chat-shortcuts { padding: 8px 10px; gap: 6px; flex-wrap: nowrap; overflow-x: auto; }
  .chat-shortcuts button { font-size: 12px; min-height: 36px; padding: 7px 10px; flex-shrink: 0; }
  .chat-form { margin: 0 10px; padding: 10px; }
  .chat-form textarea { font-size: 16px; line-height: 1.65; min-height: 48px; }
  .composer-bottom .model-select { font-size: 12px; height: 42px; max-width: calc(100% - 52px); }
  .composer-bottom button { width: 44px; height: 44px; font-size: 24px; }
  .chat-footnote { font-size: 10px; padding: 7px 10px; }
  .chat-panel>.privacy-actions { padding: 0 12px 8px; gap: 12px; }
  .chat-panel>.privacy-actions .text-link { font-size: 11px; min-height: 30px; }
  .message .question-title { font-size: 15px; }
  .message .feedback,.message .primary { font-size: 13px; }
  .message .quiz-option { min-height: 50px; }
  .sidebar { height: calc(65px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .sidebar nav a { font-size: 10px; letter-spacing: -.3px; }
  .app-shell { padding-bottom: calc(65px + env(safe-area-inset-bottom)); }
  .topbar { padding-inline: 12px; }
  .chat-toggle { display: inline-flex; align-items: center; padding: 8px; font-size: 12px; min-height: 40px; }
  .profile-name { max-width: 64px; }
}
