@import url('https://fonts.googleapis.com/css2?family=Gelasio:wght@400&family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800;1,700;1,800&display=swap');

:root {
  --cream: #f5ebdf;
  --rust: #c04e2a;
  --maroon: #661414;
  --ink: #351d1d;
  --clay: #b58777;
  --blush: #e6cbbd;
  --paper: #f8f2eb;
  --good: #3f7d4e;
  --logo: 'Gelasio', Georgia, serif;
  --serif: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #1d0a0a; color: var(--ink); font-family: var(--sans); }
body { display: flex; justify-content: center; overscroll-behavior: none; }

.stage {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100dvh;
  background: var(--cream);
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.screen { position: absolute; inset: 0; z-index: 10; background: var(--cream); display: flex; flex-direction: column; padding: 28px 24px; overflow-y: auto; touch-action: pan-y; }
.screen.center { justify-content: center; }
.screen.dark { background: var(--maroon); color: var(--cream); }
.hidden { display: none !important; }

.brand { font-family: var(--logo); font-size: 22px; color: var(--rust); }
.dark .brand { color: var(--cream); }
.eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--clay); font-weight: 600; }
.dark .eyebrow { color: var(--blush); }

h1, h2, h3 { font-family: var(--serif); font-weight: 800; margin: 0; line-height: 1.1; letter-spacing: -0.02em; }
h1 { font-size: clamp(32px, 9vw, 40px); color: var(--rust); }
.dark h1 { color: var(--cream); }
h2 { font-size: 26px; color: var(--rust); }
.dark h2 { color: var(--cream); }
h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
em { font-style: italic; }
p { line-height: 1.5; margin: 0; }
.muted { color: var(--clay); font-size: 14px; }
.dark .muted { color: var(--blush); }
.small { font-size: 12px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 0 20px;
  border: 0; border-radius: 999px; background: var(--rust); color: #fff;
  font: 600 17px var(--sans); cursor: pointer; transition: transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn.ghost { background: transparent; color: var(--rust); border: 1.5px solid var(--blush); }
.dark .btn { background: var(--cream); color: var(--maroon); }
.dark .btn.ghost { background: transparent; color: var(--cream); border-color: rgba(255,255,255,0.3); }
.btn:disabled { opacity: 0.45; }

.card { background: var(--paper); border: 1px solid var(--blush); border-radius: 18px; padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.spacer { flex: 1; min-height: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 14px; border-radius: 999px; border: 1.5px solid var(--blush); background: var(--paper);
  font: 500 15px var(--sans); color: var(--ink); cursor: pointer;
}
.chip.on { background: var(--rust); border-color: var(--rust); color: #fff; }

.fact { border-left: 3px solid var(--rust); padding: 12px 14px; background: var(--paper); border-radius: 0 14px 14px 0; }
.fact h3 { font-size: 18px; margin-bottom: 4px; }
.fact p { font-size: 15px; }
.source { display: block; margin-top: 8px; font-size: 11.5px; color: var(--clay); line-height: 1.4; text-decoration: none; }
.source::before { content: 'Source: '; font-weight: 600; }

input.field {
  width: 100%; min-height: 50px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--blush);
  background: #fff; font: 16px var(--sans); color: var(--ink);
}
input.field:focus { outline: 2px solid var(--rust); border-color: transparent; }

.hud { position: absolute; left: 0; right: 0; top: 0; padding: 12px 14px; display: flex; gap: 10px; align-items: center; z-index: 5; pointer-events: none; }
.pill { background: rgba(255,255,255,0.75); backdrop-filter: blur(6px); border-radius: 999px; padding: 6px 12px; font: 600 13px var(--sans); color: var(--ink); }
.meter { height: 10px; border-radius: 999px; background: rgba(53,29,29,0.12); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--rust); border-radius: inherit; transition: width 0.15s; }

.toast {
  position: absolute; left: 50%; top: 22%; transform: translate(-50%, 0); z-index: 20;
  max-width: 86%; padding: 10px 16px; border-radius: 14px; background: var(--ink); color: var(--cream);
  font: 600 14px var(--sans); text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, -6px); }

.disclaimer { font-size: 11px; color: var(--clay); text-align: center; line-height: 1.4; }
.dark .disclaimer { color: var(--blush); }

@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
.pop { animation: pop 0.35s ease-out both; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.rise { animation: rise 0.4s ease-out both; }
