/* ==========================================================================
   TaxHelp — design system
   ========================================================================== */
:root {
  --bg: #FFF8EE; --bg-2: #FFF1DC; --card: #FFFFFF; --card-2: #FFFCF6;
  --ink: #1B1F3B; --ink-2: #4A4F6A; --muted: #8A8FA8; --line: #EDE6D8;
  --mint: #149B78; --mint-2: #1FB88A; --mint-soft: #DDF5EC; --mint-ink: #0E7C66;
  --coral: #FF6B57; --coral-soft: #FFE3DE; --coral-ink: #C2392A;
  --sun: #FFC93C; --sun-soft: #FFF2C6; --sun-ink: #8A5A00;
  --lav: #7C6CF6; --lav-soft: #E9E6FF; --lav-ink: #4B3DC9;
  --sky: #3AA9F5; --sky-soft: #E1F1FF; --sky-ink: #1B6FB0;
  --shadow: 0 10px 30px rgba(27, 31, 59, .08), 0 2px 6px rgba(27, 31, 59, .05);
  --shadow-lg: 0 24px 60px rgba(27, 31, 59, .14);
  --r: 20px; --r-sm: 12px;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12152A; --bg-2: #171B33; --card: #1C213E; --card-2: #20264A;
    --ink: #F4F1EA; --ink-2: #C9CBDA; --muted: #8E93B0; --line: #2C3258;
    --mint-soft: #123A32; --mint-ink: #6FE3BF;
    --coral-soft: #3F1F1D; --coral-ink: #FF9C8D;
    --sun-soft: #3E3312; --sun-ink: #FFD86B;
    --lav-soft: #26224A; --lav-ink: #B5ABFF;
    --sky-soft: #14304A; --sky-ink: #86CBFF;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  background-image: radial-gradient(1200px 600px at 10% -10%, var(--mint-soft) 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, var(--lav-soft) 0%, transparent 55%);
  background-attachment: fixed;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { font-family: var(--font-display); font-variation-settings: 'SOFT' 100; line-height: 1.1; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); font-weight: 900; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); font-weight: 800; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--mint-ink); }
em { font-style: italic; color: var(--mint-ink); }
strong { font-weight: 800; }
img { max-width: 100%; }
input, select, button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
::selection { background: var(--sun); color: #1B1F3B; }

/* ---------- Buttons / chips / tags ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 0; border-radius: 999px; padding: .8rem 1.4rem; font-weight: 800; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, background .15s; white-space: nowrap; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--mint-2), var(--mint)); color: #fff; box-shadow: 0 8px 20px rgba(20, 155, 120, .3); }
.btn-secondary { background: var(--card); color: var(--ink); box-shadow: var(--shadow); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1.5px solid var(--line); }
.btn-sm { padding: .5rem .95rem; font-size: .9rem; }
.btn-lg { padding: 1rem 1.7rem; font-size: 1.05rem; }
.icon-btn { background: transparent; border: 0; font-size: 1.1rem; padding: .4rem .5rem; border-radius: 10px; color: var(--ink-2); }
.icon-btn:hover { background: var(--bg-2); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { border: 1.5px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 999px; padding: .45rem .9rem; font-weight: 700; font-size: .9rem; transition: all .15s; }
.chip:hover { border-color: var(--mint-2); color: var(--mint-ink); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (prefers-color-scheme: dark) { .chip.active { background: var(--mint-2); color: #0b2a22; border-color: var(--mint-2); } }
.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: .28rem .6rem; border-radius: 999px; }
.tag-new { background: var(--mint-soft); color: var(--mint-ink); }
.tag-changed { background: var(--sky-soft); color: var(--sky-ink); }
.tag-ended { background: var(--coral-soft); color: var(--coral-ink); }
.tag-permanent { background: var(--lav-soft); color: var(--lav-ink); }
.tag-coming { background: var(--sun-soft); color: var(--sun-ink); }
.tag-watch { background: var(--bg-2); color: var(--ink-2); border: 1px dashed var(--muted); }

/* ---------- Nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; height: var(--nav-h); display: flex; align-items: center; gap: 1rem; padding: 0 clamp(1rem, 3vw, 2rem); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--font-display); font-weight: 900; font-size: 1.35rem; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 10px; }
.nav-links { display: flex; gap: .2rem; margin-left: .5rem; }
.nav-links a { color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: .92rem; padding: .45rem .7rem; border-radius: 999px; }
.nav-links a:hover { background: var(--bg-2); color: var(--ink); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.xp-pill { display: inline-flex; align-items: center; gap: .55rem; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: .35rem .8rem .35rem .9rem; font-size: .82rem; font-weight: 800; color: var(--ink); }
.xp-track { width: 84px; height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.xp-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sun), var(--coral)); border-radius: 99px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.xp-num { color: var(--muted); }
@media (max-width: 1000px) { .nav-links { display: none; } }
@media (max-width: 640px) { .xp-level, #btnChatTop { display: none; } .nav { gap: .5rem; } }

/* ---------- Layout ---------- */
.section { max-width: 1160px; margin: 0 auto; padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2rem); scroll-margin-top: var(--nav-h); }
.section-head { max-width: 760px; margin-bottom: 2rem; }
.kicker { font-weight: 800; color: var(--coral); letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; margin-bottom: .5rem; }
.sub { color: var(--ink-2); font-size: 1.08rem; }
.js-reveal .section { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js-reveal .section.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .section { opacity: 1; transform: none; transition: none; } * { animation: none !important; } html { scroll-behavior: auto; } }

/* ---------- Hero ---------- */
.hero { max-width: 1160px; margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 4vw, 2rem) 1rem; display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: center; }
.eyebrow { display: inline-block; background: var(--sun-soft); color: var(--sun-ink); font-weight: 800; font-size: .8rem; padding: .35rem .8rem; border-radius: 999px; margin-bottom: 1rem; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 560px; }
.hero-cta { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.4rem 0 1.8rem; }
.profile-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.profile-label { font-size: .92rem; color: var(--ink-2); margin-bottom: .6rem; }
.hero-art { display: flex; justify-content: center; }
.penny-art { width: 100%; max-width: 520px; height: auto; overflow: visible; }
.float { animation: bob 4s ease-in-out infinite; transform-origin: center; }
.float-slow { animation: bob 6s ease-in-out infinite; }
.badge-float { animation: bob 5s ease-in-out infinite; }
.badge-float.b2 { animation-delay: -1.5s; } .badge-float.b3 { animation-delay: -3s; }
.sparkle { animation: twinkle 2.4s ease-in-out infinite; transform-origin: center; }
.sparkle.s2 { animation-delay: -1.2s; }
.blob { animation: morph 12s ease-in-out infinite alternate; transform-origin: center; }
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
@keyframes twinkle { 0%, 100% { opacity: .4; transform: scale(.8) rotate(0) } 50% { opacity: 1; transform: scale(1.15) rotate(20deg) } }
@keyframes morph { from { transform: rotate(-3deg) scale(1) } to { transform: rotate(4deg) scale(1.04) } }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero-art { order: -1; } .penny-art { max-width: 340px; } }

/* ---------- Dates ticker ---------- */
.dates { max-width: 1160px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.dates-track { display: flex; gap: .7rem; overflow-x: auto; padding: .5rem 0 1rem; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.dates-track::-webkit-scrollbar { display: none; }
.date-pill { flex: 0 0 auto; scroll-snap-align: start; display: flex; align-items: center; gap: .7rem; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .5rem .9rem .5rem .6rem; box-shadow: var(--shadow); font-size: .9rem; }
.date-pill .dd { display: grid; place-items: center; min-width: 44px; height: 44px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 900; font-family: var(--font-display); line-height: 1; padding: 0 .4rem; }
.date-pill .dd small { font-size: .6rem; font-weight: 700; letter-spacing: .05em; }
.date-pill.soon .dd { background: var(--coral); color: #fff; }
.date-pill.today .dd { background: var(--sun); color: #1B1F3B; }
.date-pill b { display: block; }
.date-pill span { color: var(--muted); font-size: .8rem; }

/* ---------- Numbers ---------- */
.segmented { display: inline-flex; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px; margin-top: .6rem; }
.segmented button { border: 0; background: transparent; padding: .5rem 1.2rem; border-radius: 999px; font-weight: 800; color: var(--ink-2); }
.segmented button.active { background: var(--ink); color: var(--bg); }
@media (prefers-color-scheme: dark) { .segmented button.active { background: var(--mint-2); color: #0b2a22; } }
.year-law { color: var(--muted); font-size: .9rem; margin-top: .6rem; }
.figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.fig { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.fig::after { content: ''; position: absolute; inset: auto -30px -30px auto; width: 90px; height: 90px; border-radius: 50%; background: var(--accent, var(--mint-soft)); opacity: .6; }
.fig-label { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .35rem; }
.fig-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; line-height: 1.15; }
.fig-note { color: var(--ink-2); font-size: .86rem; margin-top: .35rem; }
.fig-delta { display: inline-block; margin-top: .5rem; font-size: .75rem; font-weight: 800; padding: .2rem .55rem; border-radius: 999px; background: var(--mint-soft); color: var(--mint-ink); }
.fig-delta.down { background: var(--coral-soft); color: var(--coral-ink); }
.fig table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: .4rem; }
.fig td { padding: .15rem 0; border-bottom: 1px dashed var(--line); }
.fig td:last-child { text-align: right; font-weight: 700; }

/* ---------- Journey ---------- */
.journey { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; counter-reset: stop; }
.stop { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; transition: transform .2s, border-color .2s; position: relative; }
.stop:hover { transform: translateY(-3px); }
.stop.done { border-color: var(--mint-2); }
.stop.done::before { content: '✓ done'; position: absolute; top: 12px; right: 12px; background: var(--mint); color: #fff; font-size: .7rem; font-weight: 900; padding: .25rem .55rem; border-radius: 999px; letter-spacing: .05em; }
.stop-head { display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.2rem; width: 100%; background: transparent; border: 0; text-align: left; }
.stop-num { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--sun-soft); font-size: 1.4rem; }
.stop.done .stop-num { background: var(--mint-soft); }
.stop-title { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.stop-xp { color: var(--muted); font-size: .8rem; font-weight: 800; }
.stop-body { display: none; padding: 0 1.2rem 1.2rem; }
.stop.open .stop-body { display: block; animation: fadeUp .3s ease; }
.stop-blurb { color: var(--ink-2); }
.checklist { list-style: none; margin: .8rem 0; padding: 0; display: grid; gap: .35rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .6rem; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); font-size: .92rem; cursor: pointer; }
.check input { margin-top: .2rem; accent-color: var(--mint); width: 18px; height: 18px; flex: 0 0 auto; }
.check input:checked + span { text-decoration: line-through; color: var(--muted); }
.mistake { background: var(--coral-soft); border-left: 4px solid var(--coral); border-radius: 10px; padding: .7rem .9rem; font-size: .92rem; color: var(--ink); margin: .6rem 0 1rem; }
.mistake b { color: var(--coral-ink); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

/* ---------- Changes ---------- */
.filters { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.search { flex: 1 1 220px; max-width: 320px; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: .55rem 1rem; }
.legend { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.changes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.1rem; }
.change-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.15rem 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .7rem; animation: fadeUp .35s ease both; }
.change-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.change-years { color: var(--muted); font-size: .8rem; font-weight: 700; }
.change-head { display: flex; align-items: center; gap: .7rem; }
.change-head .emoji { font-size: 1.7rem; width: 48px; height: 48px; display: grid; place-items: center; background: var(--bg-2); border-radius: 14px; flex: 0 0 auto; }
.change-head h3 { margin: 0; font-size: 1.15rem; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.diff-col { border-radius: 12px; padding: .7rem .8rem; font-size: .88rem; line-height: 1.45; }
.diff-col b { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .3rem; }
.diff-col.before { background: var(--bg-2); color: var(--ink-2); }
.diff-col.after { background: var(--mint-soft); color: var(--ink); }
.diff-col.after b { color: var(--mint-ink); }
.change-form { display: flex; align-items: center; gap: .5rem; font-size: .86rem; background: var(--sun-soft); color: var(--sun-ink); border-radius: 10px; padding: .5rem .7rem; font-weight: 700; }
.change-who { font-size: .88rem; color: var(--ink-2); }
.impact { display: flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--muted); font-weight: 800; }
.impact .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.impact .dot.on { background: var(--coral); }
.change-tip { border-top: 1px dashed var(--line); padding-top: .6rem; font-size: .9rem; }
.change-tip summary { cursor: pointer; font-weight: 800; color: var(--lav-ink); list-style: none; }
.change-tip summary::before { content: '💡 '; }
.change-tip p { margin: .5rem 0 0; color: var(--ink-2); }
.empty { color: var(--muted); padding: 2rem; text-align: center; grid-column: 1/-1; }
@media (max-width: 480px) { .diff { grid-template-columns: 1fr; } }

/* ---------- Form 1040 explorer ---------- */
.form-explorer { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.4rem; align-items: start; }
.form-paper { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 1rem; display: grid; gap: .3rem; position: relative; }
.form-paper::before { content: 'Form 1040 (2025) · U.S. Individual Income Tax Return'; display: block; font-family: var(--font-display); font-weight: 900; font-size: 1rem; padding: .3rem .5rem .8rem; border-bottom: 2px solid var(--ink); margin-bottom: .4rem; }
.form-line { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: .6rem; border: 1.5px solid transparent; background: var(--card-2); border-radius: 10px; padding: .55rem .6rem; text-align: left; transition: all .15s; }
.form-line:hover { border-color: var(--mint-2); }
.form-line.active { background: var(--mint-soft); border-color: var(--mint); }
.line-no { font-family: var(--font-display); font-weight: 800; font-size: .95rem; color: var(--ink-2); }
.form-line.active .line-no { color: var(--mint-ink); }
.line-label { font-size: .92rem; font-weight: 700; }
.line-box { width: 70px; height: 24px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); position: relative; }
.form-line.changed .line-box::after { content: ''; position: absolute; right: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 0 rgba(255, 107, 87, .6); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 107, 87, .6) } 70% { box-shadow: 0 0 0 9px rgba(255, 107, 87, 0) } 100% { box-shadow: 0 0 0 0 rgba(255, 107, 87, 0) } }
.form-detail { position: sticky; top: calc(var(--nav-h) + 1rem); background: var(--ink); color: var(--bg); border-radius: var(--r); padding: 1.4rem; box-shadow: var(--shadow-lg); min-height: 240px; }
@media (prefers-color-scheme: dark) { .form-detail { background: var(--card-2); color: var(--ink); border: 1px solid var(--line); } }
.fd-line { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; opacity: .7; }
.fd-title { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; margin: .3rem 0 .7rem; }
.fd-why { font-size: .98rem; line-height: 1.55; opacity: .92; }
.fd-note { margin-top: .9rem; display: inline-flex; gap: .4rem; align-items: center; background: var(--coral); color: #fff; font-weight: 800; font-size: .82rem; padding: .4rem .75rem; border-radius: 999px; }
@media (max-width: 860px) { .form-explorer { grid-template-columns: 1fr; } .form-detail { position: static; } }

/* ---------- Calculators ---------- */
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.tab { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: .6rem 1.1rem; font-weight: 800; color: var(--ink-2); }
.tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (prefers-color-scheme: dark) { .tab.active { background: var(--mint-2); color: #0b2a22; border-color: var(--mint-2); } }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp .3s ease; }
.calc { display: grid; grid-template-columns: 1fr 1.1fr; gap: 1.3rem; align-items: start; }
.calc-inputs { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.calc-inputs .wide { grid-column: 1 / -1; }
.field { display: grid; gap: .3rem; }
.field label { font-size: .8rem; font-weight: 800; color: var(--ink-2); }
.field small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.field input, .field select { width: 100%; border: 1.5px solid var(--line); background: var(--card-2); border-radius: 10px; padding: .6rem .7rem; font-weight: 700; }
.field input:focus, .field select:focus { border-color: var(--mint); outline: none; }
.money { position: relative; }
.money::before { content: '$'; position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 800; }
.money input { padding-left: 1.5rem; }
.calc-results { display: grid; gap: .9rem; }
.result-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.result-card.hero-result { background: linear-gradient(135deg, var(--mint-2), var(--mint)); color: #fff; border: 0; }
.result-card.hero-result.owe { background: linear-gradient(135deg, #FF8A78, var(--coral)); }
.result-label { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.result-big { font-family: var(--font-display); font-size: 2.4rem; font-weight: 900; line-height: 1.1; }
.result-rows { display: grid; gap: .35rem; margin-top: .4rem; }
.result-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .92rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.result-row b { font-family: var(--font-display); }
.result-row.total { border-bottom: 0; font-weight: 800; }
.layers { display: flex; height: 26px; border-radius: 999px; overflow: hidden; background: var(--bg-2); margin: .6rem 0 .4rem; }
.layer { height: 100%; min-width: 2px; transition: width .4s; }
.r10 { background: #9BE7CB } .r12 { background: #5FD3A8 } .r22 { background: #FFC93C } .r24 { background: #FFA53C } .r32 { background: #FF7E5F } .r35 { background: #E8556D } .r37 { background: #7C6CF6 }
.layer-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .78rem; color: var(--ink-2); }
.layer-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }
.compare { background: var(--lav-soft); color: var(--ink); border-radius: var(--r); padding: 1rem 1.2rem; font-size: .95rem; }
.compare b { color: var(--lav-ink); }
.verdict { border-radius: var(--r); padding: 1rem 1.2rem; font-weight: 700; }
.verdict.good { background: var(--mint-soft); color: var(--mint-ink); }
.verdict.warn { background: var(--sun-soft); color: var(--sun-ink); }
.growth-chart { width: 100%; height: 180px; display: block; }
.growth-chart path.area { fill: var(--mint-soft); }
.growth-chart path.line { fill: none; stroke: var(--mint); stroke-width: 3; }
.growth-chart text { font-size: 11px; fill: var(--muted); font-weight: 700; }
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .calc-inputs { grid-template-columns: 1fr; } }

/* swipe game */
.swipe-stage { max-width: 520px; margin: 0 auto; text-align: center; }
.swipe-card { background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 2.2rem 1.6rem; box-shadow: var(--shadow-lg); animation: dealIn .35s ease; }
.swipe-card .emoji { font-size: 4rem; line-height: 1; margin-bottom: .8rem; }
.swipe-card h3 { font-size: 1.5rem; }
.swipe-card.correct { border-color: var(--mint); background: var(--mint-soft); }
.swipe-card.wrong { border-color: var(--coral); background: var(--coral-soft); }
.swipe-why { color: var(--ink-2); font-size: .95rem; margin-top: .6rem; }
.swipe-actions { display: flex; justify-content: center; gap: .8rem; margin-top: 1.2rem; }
.btn-yes { background: var(--mint); color: #fff; }
.btn-no { background: var(--coral); color: #fff; }
.swipe-score { margin-top: 1rem; color: var(--muted); font-weight: 800; }
@keyframes dealIn { from { opacity: 0; transform: translateY(14px) rotate(-2deg) } to { opacity: 1; transform: none } }

/* ---------- Plan ---------- */
#planProfile { margin-bottom: 1.4rem; }
.plan-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.1rem; }
.plan-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.plan-when { font-family: var(--font-display); font-weight: 900; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.plan-when span { font-size: .72rem; font-weight: 800; background: var(--sun-soft); color: var(--sun-ink); padding: .2rem .5rem; border-radius: 999px; font-family: var(--font-body); }
.plan-item { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.plan-item:last-child { border-bottom: 0; }
.plan-item .pi { flex: 0 0 auto; font-size: 1.1rem; }
.plan-item b { display: block; }
.plan-item span { color: var(--ink-2); }
.plan-actions { margin-top: 1.2rem; display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- History ---------- */
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem .6rem; box-shadow: var(--shadow); margin-bottom: 1.4rem; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; font-size: .92rem; }
.chart-readout { font-family: var(--font-display); font-weight: 800; color: var(--coral); font-size: 1.1rem; }
#rateChart { width: 100%; height: 240px; display: block; touch-action: none; }
#rateChart .rate-area { fill: var(--mint-soft); }
#rateChart .rate-line { fill: none; stroke: var(--mint); stroke-width: 3; stroke-linejoin: round; }
#rateChart .grid { stroke: var(--line); stroke-width: 1; }
#rateChart text { font-size: 12px; fill: var(--muted); font-weight: 700; }
#rateChart .cursor { stroke: var(--coral); stroke-width: 2; stroke-dasharray: 4 4; }
#rateChart .cursor-dot { fill: var(--coral); }
#rateChart .evt { fill: var(--sun); stroke: var(--sun-ink); stroke-width: 1.5; }
.history-rail { display: flex; gap: 1rem; overflow-x: auto; padding: .3rem .2rem 1.2rem; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.history-card { flex: 0 0 280px; scroll-snap-align: start; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); position: relative; }
.history-card .yr { font-family: var(--font-display); font-weight: 900; font-size: 1.9rem; color: var(--mint-ink); line-height: 1; }
.history-card .em { position: absolute; top: 1rem; right: 1rem; font-size: 1.6rem; }
.history-card h3 { margin: .4rem 0 .3rem; font-size: 1.1rem; }
.history-card p { margin: 0; color: var(--ink-2); font-size: .9rem; }
.history-card.now { border-color: var(--coral); }

/* ---------- Quiz ---------- */
.quiz-box { max-width: 720px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.5rem; box-shadow: var(--shadow); }
.quiz-progress { display: flex; gap: 4px; margin-bottom: 1rem; }
.quiz-progress i { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.quiz-progress i.ok { background: var(--mint); } .quiz-progress i.bad { background: var(--coral); } .quiz-progress i.cur { background: var(--sun); }
.quiz-q { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; margin-bottom: 1rem; }
.quiz-opts { display: grid; gap: .6rem; }
.opt { text-align: left; border: 1.5px solid var(--line); background: var(--card-2); border-radius: 12px; padding: .8rem 1rem; font-weight: 700; transition: all .15s; }
.opt:hover:not(:disabled) { border-color: var(--mint-2); transform: translateX(3px); }
.opt.correct { background: var(--mint-soft); border-color: var(--mint); color: var(--mint-ink); }
.opt.wrong { background: var(--coral-soft); border-color: var(--coral); color: var(--coral-ink); }
.opt:disabled { cursor: default; opacity: .8; }
.quiz-why { margin-top: 1rem; background: var(--sun-soft); color: var(--ink); border-radius: 12px; padding: .8rem 1rem; font-size: .95rem; animation: fadeUp .3s ease; }
.quiz-foot { margin-top: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.quiz-result { text-align: center; }
.quiz-result .score { font-family: var(--font-display); font-size: 3rem; font-weight: 900; color: var(--mint-ink); }

/* ---------- Install ---------- */
.install-card { background: linear-gradient(135deg, var(--card), var(--card-2)); border: 1px solid var(--line); border-radius: 28px; padding: clamp(1.4rem, 4vw, 2.6rem); box-shadow: var(--shadow-lg); display: grid; grid-template-columns: 1.2fr .8fr; gap: 2rem; align-items: center; }
.install-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .2rem 0 1rem; }
.itab { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: .45rem .9rem; font-weight: 800; font-size: .85rem; color: var(--ink-2); }
.itab.active { background: var(--lav); color: #fff; border-color: var(--lav); }
.install-steps { margin: 0 0 1rem; padding: 0; list-style: none; display: grid; gap: .5rem; }
.install-steps li { display: flex; gap: .8rem; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; font-size: .95rem; }
.install-steps .step-n { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--lav-soft); color: var(--lav-ink); display: grid; place-items: center; font-weight: 900; font-size: .85rem; }
.install-steps kbd { font-family: inherit; background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .4rem; font-weight: 800; }
.install-state { color: var(--mint-ink); font-weight: 800; margin: .6rem 0 0; }
.install-art { display: flex; justify-content: center; }
.phone { width: 220px; height: 440px; border-radius: 40px; background: var(--ink); padding: 14px; box-shadow: var(--shadow-lg); position: relative; }
.phone-notch { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 90px; height: 26px; background: var(--ink); border-radius: 0 0 16px 16px; z-index: 2; }
.phone-screen { width: 100%; height: 100%; border-radius: 28px; background: linear-gradient(160deg, #DDF5EC, #E9E6FF); display: grid; place-items: center; align-content: center; gap: .5rem; font-weight: 800; color: #1B1F3B; }
.phone-icon { width: 76px; height: 76px; border-radius: 20px; overflow: hidden; box-shadow: 0 8px 20px rgba(0, 0, 0, .18); animation: bob 4s ease-in-out infinite; }
.phone-icon img { display: block; width: 100%; height: 100%; }
@media (max-width: 860px) { .install-card { grid-template-columns: 1fr; } .phone { width: 180px; height: 360px; } }

/* ---------- Glossary ---------- */
.glossary { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem; }
.gl { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .8rem 1rem; }
.gl summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; justify-content: space-between; }
.gl summary::after { content: '+'; color: var(--muted); }
.gl[open] summary::after { content: '−'; }
.gl p { margin: .5rem 0 0; color: var(--ink-2); font-size: .92rem; }

/* ---------- Footer ---------- */
.footer { max-width: 1160px; margin: 2rem auto 0; padding: 2.5rem clamp(1rem, 4vw, 2rem) 6rem; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.footer ul { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .3rem; }
.footer strong { color: var(--ink); }
.fine { font-size: .8rem; color: var(--muted); }
.copyright { margin-top: 2rem; color: var(--muted); font-size: .85rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Mobile tab bar ---------- */
.tabbar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom)); grid-template-columns: repeat(5, 1fr); }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 800; color: var(--ink-2); text-decoration: none; background: transparent; border: 0; padding: .3rem 0; }
.tabbar span { font-size: 1.3rem; line-height: 1; }
@media (max-width: 760px) { .tabbar { display: grid; } body { padding-bottom: 76px; } }

/* ---------- Chat ---------- */
.chat-fab { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 60; display: inline-flex; align-items: center; gap: .6rem; background: var(--ink); color: var(--bg); border: 0; border-radius: 999px; padding: .6rem 1.1rem .6rem .6rem; font-weight: 800; box-shadow: var(--shadow-lg); transition: transform .15s; }
.chat-fab:hover { transform: translateY(-2px) scale(1.02); }
.fab-face { width: 40px; height: 40px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; font-size: 1.3rem; animation: bob 3s ease-in-out infinite; }
@media (prefers-color-scheme: dark) { .chat-fab { background: var(--mint-2); color: #0b2a22; } }
@media (max-width: 760px) { .chat-fab { display: none; } } /* phones use the tab bar's Penny button */
.chat-panel { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 70; width: min(420px, calc(100vw - 2.4rem)); height: min(640px, calc(100vh - 3rem)); background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: chatIn .25s ease; }
@keyframes chatIn { from { opacity: 0; transform: translateY(16px) scale(.98) } to { opacity: 1; transform: none } }
@media (max-width: 760px) { .chat-panel { right: 0; bottom: 0; left: 0; width: 100%; height: 100dvh; border-radius: 0; } }
.chat-head { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: var(--card-2); }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; font-size: 1.3rem; }
.chat-title { display: flex; flex-direction: column; line-height: 1.15; flex: 1; }
.chat-title strong { font-family: var(--font-display); font-size: 1.1rem; }
.chat-title span { font-size: .75rem; color: var(--muted); }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; scroll-behavior: smooth; }
.msg { max-width: 88%; padding: .7rem .9rem; border-radius: 16px; font-size: .95rem; line-height: 1.5; animation: fadeUp .25s ease; }
.msg.bot { align-self: flex-start; background: var(--bg-2); border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }
@media (prefers-color-scheme: dark) { .msg.me { background: var(--mint-2); color: #0b2a22; } }
.msg p { margin: 0 0 .5em; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: .3em 0 .5em; padding-left: 1.2em; }
.msg li { margin: .15em 0; }
.msg-meta { display: flex; gap: .5rem; align-items: center; margin-top: .45rem; font-size: .7rem; color: var(--muted); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.msg-meta button { border: 0; background: var(--lav-soft); color: var(--lav-ink); border-radius: 999px; padding: .2rem .6rem; font-size: .72rem; font-weight: 800; text-transform: none; letter-spacing: 0; }
.typing { display: inline-flex; gap: 4px; padding: .3rem 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s } .typing i:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%, 80%, 100% { opacity: .25 } 40% { opacity: 1 } }
.chat-chips { display: flex; gap: .4rem; overflow-x: auto; padding: .4rem 1rem; scrollbar-width: none; }
.chat-chips::-webkit-scrollbar { display: none; }
.chat-chips .chip { flex: 0 0 auto; font-size: .8rem; padding: .35rem .75rem; }
.chat-form { display: flex; gap: .5rem; padding: .6rem 1rem; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; border: 1.5px solid var(--line); background: var(--card-2); border-radius: 999px; padding: .65rem 1rem; }
.chat-form input:focus { outline: none; border-color: var(--mint); }
.chat-fine { margin: 0; padding: 0 1rem .7rem; font-size: .7rem; color: var(--muted); }

/* ---------- Modal / toast / confetti ---------- */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(27, 31, 59, .45); display: grid; place-items: center; padding: 1rem; backdrop-filter: blur(4px); }
.modal-card { background: var(--card); border-radius: 24px; width: min(560px, 100%); max-height: 86vh; overflow: auto; padding: 1.4rem; box-shadow: var(--shadow-lg); animation: chatIn .25s ease; }
.modal-card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.badges-summary { background: var(--bg-2); border-radius: 14px; padding: .9rem 1rem; margin-bottom: 1rem; font-size: .95rem; }
.badges-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.badge-card { text-align: center; border: 1.5px dashed var(--line); border-radius: 16px; padding: .9rem .6rem; opacity: .55; filter: grayscale(1); }
.badge-card.earned { opacity: 1; filter: none; border-style: solid; border-color: var(--sun); background: var(--sun-soft); }
.badge-icon { font-size: 2rem; }
.badge-name { font-weight: 900; font-size: .9rem; margin-top: .3rem; }
.badge-desc { font-size: .75rem; color: var(--ink-2); }
.toast { position: fixed; left: 50%; top: calc(var(--nav-h) + 12px); transform: translate(-50%, -20px); z-index: 90; background: var(--ink); color: var(--bg); padding: .7rem 1.1rem; border-radius: 999px; font-weight: 800; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .3s; font-size: .92rem; max-width: calc(100vw - 2rem); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-color-scheme: dark) { .toast { background: var(--sun); color: #1B1F3B; } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }
