:root {
  color-scheme: light;
  --bg: #f3efe7;
  --surface: #fbf9f4;
  --surface-strong: #ffffff;
  --text: #26332d;
  --muted: #68746e;
  --line: rgba(38, 51, 45, .13);
  --accent: #476b59;
  --accent-soft: #dce7df;
  --warm: #b97852;
  --danger: #9a514d;
  --shadow: 0 18px 55px rgba(48, 55, 49, .10);
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 32px;
  --space: clamp(20px, 5vw, 36px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(255,255,255,.9), transparent 36%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  min-height: 72px;
  padding: max(18px, env(safe-area-inset-top)) var(--space) 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { color: inherit; text-decoration: none; display: flex; gap: 10px; align-items: center; font-weight: 650; letter-spacing: -.02em; }
.brand-orb { position: relative; width: 28px; height: 28px; flex: 0 0 28px; display: block; overflow: hidden; border-radius: 50%; background: var(--accent); box-shadow: inset -4px -5px 8px rgba(20,45,32,.2), 0 4px 12px rgba(38,51,45,.14); }
.brand-orb::after { content: ""; position: absolute; width: 8px; height: 8px; left: 7px; top: 6px; border-radius: 50%; background: rgba(243,239,231,.9); }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.45); cursor: pointer; }

main { min-height: 0; padding: 12px var(--space) calc(94px + env(safe-area-inset-bottom)); }
.screen { height: 100%; min-height: 0; animation: appear .4s ease both; }
.authenticated { overflow: hidden; }
.screen-centered { display: grid; place-content: center; text-align: center; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: .76rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.5rem, 9vw, 4.7rem); font-weight: 400; line-height: .98; letter-spacing: -.045em; }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 7vw, 3.2rem); font-weight: 400; line-height: 1.05; letter-spacing: -.035em; }
.lead { max-width: 33rem; color: var(--muted); line-height: 1.65; font-size: 1.03rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.login-card { width: min(100%, 480px); padding: clamp(26px, 7vw, 48px); background: rgba(251,249,244,.84); border: 1px solid rgba(255,255,255,.72); border-radius: var(--radius-lg); box-shadow: var(--shadow); backdrop-filter: blur(12px); text-align: left; }
.field { display: grid; gap: 8px; margin: 30px 0 14px; }
.field label { font-size: .82rem; color: var(--muted); font-weight: 650; }
.field input { width: 100%; height: 54px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-strong); padding: 0 16px; outline: none; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(71,107,89,.12); }

.primary-button, .secondary-button, .vote-button { min-height: 54px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 700; transition: transform .16s ease, background .16s ease, opacity .16s ease; }
.primary-button { width: 100%; padding: 0 24px; background: var(--accent); color: white; box-shadow: 0 10px 24px rgba(71,107,89,.22); }
.secondary-button { padding: 0 22px; background: var(--accent-soft); color: var(--accent); }
.primary-button:hover, .vote-button:hover, .secondary-button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: wait; transform: none !important; }
.form-note { margin: 14px 2px 0; min-height: 1.4em; font-size: .88rem; color: var(--muted); line-height: 1.5; }

.home { display: grid; align-content: center; justify-items: center; text-align: center; }
.intro-orb { width: 84px; height: 84px; margin-bottom: 28px; border-radius: 50%; background: linear-gradient(145deg, #f6d6b6, #cba27c); box-shadow: inset -12px -16px 25px rgba(113,69,41,.15), 0 18px 40px rgba(113,69,41,.14); }
.home .lead { margin-bottom: 34px; }
.home .primary-button { width: auto; min-width: 210px; }

.impulse { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: clamp(16px, 4vh, 30px); overflow: hidden; }
.impulse-copy { min-height: 0; align-self: center; text-align: center; overflow: hidden; }
.impulse-text { max-width: 660px; margin: 0 auto; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 5.8vh, 4.5rem); font-weight: 400; line-height: 1.12; letter-spacing: -.035em; text-wrap: balance; }
.word { opacity: 0; filter: blur(3px); animation: word-in .48s ease forwards; }
.vote-area { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vote-button { padding: 12px 16px; border: 1px solid var(--line); background: rgba(255,255,255,.5); }
.vote-button.helpful { color: white; background: var(--accent); border-color: var(--accent); }

.glass-screen { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.glass-screen header { margin-bottom: clamp(12px, 2.5vh, 24px); }
.glass-screen header h2 { margin-bottom: 10px; }
.glass-screen header .lead { margin-bottom: 0; font-size: clamp(.86rem, 2vh, 1.03rem); line-height: 1.45; }
.glass-wrap { display: grid; place-items: center; min-height: 0; }
.jar {
  position: relative;
  width: min(84vw, 360px);
  height: min(100%, 410px);
}
.glass {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 3px solid rgba(71,107,89,.38);
  border-top: 0;
  border-radius: 6px 6px 28px 28px;
  background: linear-gradient(90deg, rgba(255,255,255,.4), rgba(255,255,255,.08) 40%, rgba(255,255,255,.28));
  box-shadow: inset 15px 0 24px rgba(255,255,255,.38);
  touch-action: none;
}
.glass-lid {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  width: 100%;
  height: 24px;
  border: 3px solid #385747;
  border-radius: 7px 7px 4px 4px;
  background: var(--accent);
}
.orb { position: absolute; z-index: 1; display: grid; place-items: center; border-radius: 50%; background: var(--orb, #9db7a8); color: rgba(31,50,40,.78); box-shadow: inset -6px -9px 14px rgba(25,55,40,.13), 0 5px 12px rgba(38,51,45,.1); font-size: .68rem; font-weight: 750; cursor: grab; will-change: transform; user-select: none; }
.orb:active { cursor: grabbing; }
.motion-button { position: absolute; z-index: 20; top: 36px; left: 50%; min-height: 40px; padding: 0 16px; border: 1px solid rgba(71,107,89,.22); border-radius: 999px; background: rgba(251,249,244,.94); color: var(--accent); transform: translateX(-50%); font-size: .78rem; font-weight: 750; white-space: nowrap; }
.glass-empty { position: absolute; z-index: 1; inset: 0; display: grid; place-content: center; padding: 40px; text-align: center; color: var(--muted); line-height: 1.55; }

.bottom-nav { position: fixed; z-index: 10; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(calc(100% - 32px), 360px); height: 64px; padding: 6px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid rgba(255,255,255,.8); border-radius: 999px; background: rgba(250,248,242,.88); box-shadow: 0 14px 36px rgba(38,51,45,.13); backdrop-filter: blur(18px); }
.bottom-nav a { border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); text-decoration: none; font-size: .86rem; font-weight: 700; }
.bottom-nav a.active { color: var(--text); background: var(--surface-strong); box-shadow: 0 3px 10px rgba(38,51,45,.08); }

.toast { position: fixed; z-index: 20; top: max(18px, env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -20px); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px; background: var(--text); color: white; opacity: 0; pointer-events: none; transition: .25s ease; font-size: .88rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loader { width: 28px; height: 28px; margin: 0 auto 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }
@keyframes word-in { to { opacity: 1; filter: blur(0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
@media (max-width: 440px) { .vote-area { grid-template-columns: 1fr; } }
@media (max-height: 700px) {
  .topbar { min-height: 62px; padding-top: max(12px, env(safe-area-inset-top)); }
  main { padding-top: 4px; padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .impulse .eyebrow { margin-bottom: 8px; }
  .vote-button { min-height: 48px; }
  .glass-screen header .lead { display: none; }
  .glass-screen header h2 { font-size: clamp(1.7rem, 5vh, 2.4rem); }
  .bottom-nav { height: 58px; }
}
