:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #5d6678;
  --cream: #fffaf0;
  --paper: #ffffff;
  --orange: #ef6c35;
  --orange-dark: #b94318;
  --line: #ded7ca;
  --success: #2e7d5b;
  --danger: #a7372f;
  --shadow: 0 24px 70px rgba(20, 33, 61, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 85% 5%, #ffd8bd 0, transparent 28rem), var(--cream); }
button, textarea { font: inherit; }
button { cursor: pointer; }
.shell { width: min(960px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 64px; }
.masthead { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid rgba(20, 33, 61, 0.12); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; letter-spacing: -0.02em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: white; background: var(--ink); }
.privacy { display: inline-flex; align-items: center; gap: 14px; color: var(--muted); font-size: 0.875rem; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--success); }
.sign-out { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; font-size: 0.8rem; }
.sign-out:hover { border-color: var(--orange); color: var(--orange-dark); }
.hero { padding: 88px 0 48px; }
.eyebrow { margin: 0 0 12px; color: var(--orange-dark); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
h1 { max-width: 720px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.8rem, 8vw, 5.8rem); font-weight: 500; line-height: 0.98; letter-spacing: -0.055em; }
.intro { max-width: 650px; margin: 24px 0 36px; color: var(--muted); font-size: 1.1rem; line-height: 1.7; }
.ask-card { padding: 12px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
textarea { width: 100%; min-height: 112px; padding: 18px; resize: vertical; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 1.1rem; line-height: 1.5; }
textarea::placeholder { color: #8a8f99; }
textarea:focus-visible { border-radius: 12px; box-shadow: inset 0 0 0 2px var(--orange); }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px; }
#ask-button { display: inline-flex; align-items: center; gap: 28px; padding: 13px 18px; border: 0; border-radius: 12px; color: white; background: var(--orange); font-weight: 750; }
#ask-button:hover { background: var(--orange-dark); }
#ask-button:disabled { cursor: wait; opacity: 0.65; }
.index-status { color: var(--muted); font-size: 0.82rem; }
.suggestions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.answer-actions { display: flex; gap: 8px; }
.suggestions button, .copy-button { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: rgba(255,255,255,0.65); }
.suggestions button:hover, .copy-button:hover { border-color: var(--orange); }
.answer-section { margin-top: 20px; padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.answer-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 2rem; font-weight: 500; }
.answer { margin-top: 28px; color: #28344c; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.error { margin-top: 20px; padding: 18px 20px; border-left: 4px solid var(--danger); border-radius: 8px; color: var(--danger); background: #fff0ee; }
.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; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(239, 108, 53, 0.45); outline-offset: 3px; }
.auth-gate { display: grid; place-items: center; min-height: 100vh; color: var(--muted); font-size: 1rem; text-align: center; padding: 24px; }
.auth-gate[hidden] { display: none; }
.upload-section { margin-top: 40px; padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.upload-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; }
.upload-card h3 { margin: 0; font-size: 1rem; }
.upload-card input[type="text"] { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 0.95rem; }
.upload-card textarea { min-height: 120px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; font-size: 0.95rem; font-family: inherit; }
.upload-card input[type="file"] { font-size: 0.9rem; }
.upload-card button { align-self: flex-start; padding: 10px 16px; border: 0; border-radius: 10px; color: white; background: var(--orange); font-weight: 700; }
.upload-card button:hover { background: var(--orange-dark); }
.upload-card button:disabled { cursor: wait; opacity: 0.65; }
.uploads-gallery:not(:empty) { margin-top: 24px; }
.upload-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.upload-list li { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.9rem; color: var(--muted); }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.image-grid figure { margin: 0; }
.image-grid img { width: 100%; height: 100px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--cream); }
.image-grid figcaption { margin-top: 4px; font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .upload-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 960px); }
  .masthead { min-height: 72px; }
  .privacy { font-size: 0.75rem; }
  .hero { padding-top: 56px; }
  .form-footer { align-items: stretch; flex-direction: column; }
  #ask-button { justify-content: space-between; width: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .answer-section { animation: reveal 240ms ease-out; }
  @keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
}
