/*
 * FLiP palette: seven equal, saturated brand colours. No pastels or tinted variants,
 * so colour only ever appears at full strength; everything else is neutral.
 */
:root {
  --bright: #00B4F0;
  --blue: #0032F0;
  --purple: #7828D2;
  --pink: #FF3CB4;
  --red: #FF3232;
  --orange: #FAAA00;
  --green: #00B400;

  --ground: #F1F5FB;
  --surface: #FFFFFF;
  --paper: #FFFFFF;
  --ink: #0B1220;
  --ink-muted: #57647F;
  --ink-faint: #8C99B3;
  --line: #DCE4F0;
  --line-strong: #AFC0DA;

  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --radius: 16px;
  /* ovos play lays its own close button over the top right corner of the embed. */
  --host-close: 60px;
  --col: 560px;
  --shadow: 0 1px 2px rgba(11, 18, 32, .06), 0 6px 20px rgba(11, 18, 32, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #070C1C;
    --surface: #101830;
    --paper: #E9EEF7;
    --ink: #E9F0FF;
    --ink-muted: #94A5C7;
    --ink-faint: #64759A;
    --line: #25324F;
    --line-strong: #3A4B72;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/1.5 var(--font-body);
  overflow-wrap: break-word;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------- Top bar ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 16px 10px;
  background: var(--ground);
}

.top-row {
  max-width: var(--col);
  margin: 0 auto 10px;
  padding-right: var(--host-close);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.top-title {
  font: 700 13px/1.2 var(--font-display);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.solo-top .top-title { visibility: hidden; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 14px 4px 10px;
  border: 0;
  border-radius: 99px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font: 700 15px/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
}
.pill svg { width: 18px; height: 18px; color: var(--blue); }
.pill[hidden] { display: none; }

.progress {
  max-width: var(--col);
  margin: 0 auto;
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
}
.progress li { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background .3s; }
.progress li.done { background: var(--ink-faint); }
.progress li.now { background: var(--blue); }

/* ---------- Layout ---------- */

.layout { padding: 8px 16px 0; }
.side { display: none; }

@media (min-width: 900px) and (orientation: landscape), (min-width: 1100px) {
  .top-row, .progress { max-width: 1060px; }
  .pill { display: none; }
  .layout {
    max-width: 1060px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 48px;
    align-items: start;
    padding-top: 16px;
  }
  .layout.solo { grid-template-columns: minmax(0, 1fr); }
  .layout.solo .side { display: none; }
  .side { display: block; position: sticky; top: 92px; padding-bottom: 32px; }
}

/* Tablets in landscape are short: keep the question and the result on one screen. */
@media (min-width: 900px) and (max-height: 900px) {
  .hero { padding: 0 0 16px; }
  .badge.xl { width: 64px; height: 64px; margin-bottom: 10px; }
  .badge.xl svg { width: 32px; height: 32px; }
  h2 { font-size: 30px; }
  .explain { margin-top: 8px; }
  .wg-pill { margin-top: 12px; }
  .opt { min-height: 58px; padding-top: 10px; padding-bottom: 10px; }
  .score { margin-top: 20px; }
  .score-value { font-size: 48px; }
}

/* ---------- Screen ---------- */

.screen {
  max-width: var(--col);
  margin: 0 auto;
}
.screen.anim { animation: enter .4s cubic-bezier(.2, .7, .3, 1) both; }
.screen.anim.back { animation-name: enter-back; }
@keyframes enter { from { opacity: 0; transform: translateX(24px); } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-24px); } }

.hero {
  text-align: center;
  padding: 12px 0 24px;
}

.badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--c, var(--bright));
  color: #fff;
}
.badge.dark { color: #0B1220; }
.badge svg { width: 24px; height: 24px; }

.badge.xl { width: 92px; height: 92px; margin-bottom: 16px; }
.badge.xl svg { width: 44px; height: 44px; stroke-width: 1.8; }
.screen.anim .badge.xl { animation: bounce .6s .1s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes bounce { from { transform: scale(.4); opacity: 0; } }

.kicker {
  font: 700 13px/1.3 var(--font-display);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(34px, 9vw, 52px); color: var(--green); }
h2 { font-size: clamp(28px, 7vw, 38px); margin-top: 6px; }
h1:focus, h2:focus { outline: none; }

.sub { margin-top: 6px; color: var(--ink-muted); font-size: 15px; }

.explain {
  max-width: 44ch;
  margin: 14px auto 0;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.wg-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin-top: 18px;
  padding: 8px 16px 8px 12px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 15px;
  text-align: left;
  line-height: 1.3;
}
.wg-pill .mini-heads { flex: 0 0 auto; }
.wg-pill strong { white-space: nowrap; font-family: var(--font-display); }

.mini-heads { display: inline-flex; gap: 2px; align-items: flex-end; height: 20px; }
.mini-heads i { width: 10px; height: 16px; border-radius: 5px 5px 2px 2px; background: var(--c); }

.q {
  margin: 0 0 12px;
  font: 700 19px/1.3 var(--font-display);
  text-align: center;
}

.block { margin-bottom: 28px; }

/* ---------- Option tiles ---------- */

.options { display: grid; gap: 10px; }

.opt {
  --on-ink: #fff;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 14px 18px 14px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  transition: background .2s, color .2s, transform .15s;
}
.opt:hover { transform: translateY(-1px); }
.opt:active { transform: scale(.98); }

.opt .dot {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
}
.opt .dot svg { width: 16px; height: 16px; stroke-width: 3; opacity: 0; }

.opt-label { display: block; font-weight: 700; line-height: 1.3; }
.opt-tag { display: block; margin-top: 2px; font-size: 14px; color: var(--ink-muted); }
.opt-amount { font: 800 19px/1.2 var(--font-display); white-space: nowrap; font-variant-numeric: tabular-nums; }
.opt-amount small { font: 600 13px/1 var(--font-body); margin-right: 3px; color: var(--ink-muted); }

.opt[aria-checked="true"] { background: var(--c); color: var(--on-ink); }
.opt[aria-checked="true"] .dot { border-color: var(--on-ink); background: var(--on-ink); color: var(--c); animation: pop .3s ease; }
.opt[aria-checked="true"] .dot svg { opacity: 1; }
.opt[aria-checked="true"] .opt-tag,
.opt[aria-checked="true"] .opt-amount small { color: inherit; opacity: .85; }
.options.dark-ink .opt { --on-ink: #0B1220; }
@keyframes pop { 50% { transform: scale(1.3); } }

.link {
  display: block;
  margin: 14px auto 0;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

/* ---------- Amount field ---------- */

.field { margin-top: 14px; text-align: center; }
.field-label { display: block; margin-bottom: 10px; font: 700 19px/1.3 var(--font-display); }
.field-hint { max-width: 40ch; margin: 8px auto 0; color: var(--ink-muted); font-size: 15px; }

.amount {
  display: inline-flex;
  align-items: stretch;
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.amount:focus-within { box-shadow: 0 0 0 3px var(--blue); }
.amount button {
  flex: 0 0 52px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: 700 26px/1 var(--font-display);
}
.amount button:active { background: var(--ground); }
.amount input {
  flex: 1;
  min-width: 0;
  padding: 12px 4px;
  border: 0;
  background: transparent;
  text-align: right;
  font: 800 26px/1.2 var(--font-display);
  font-variant-numeric: tabular-nums;
}
.amount input:focus { outline: none; }
.amount input::placeholder { color: var(--line-strong); }
.amount .unit { align-self: center; padding: 0 6px 0 4px; font: 800 22px/1 var(--font-display); color: var(--ink-faint); }

/* ---------- Chips ---------- */

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  min-width: 48px;
  min-height: 48px;
  padding: 8px 16px;
  border: 0;
  border-radius: 99px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font: 700 17px/1 var(--font-display);
  transition: background .2s, color .2s;
}
.chip[aria-checked="true"], .chip[aria-pressed="true"] { background: var(--blue); color: #fff; }
.chip.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }

/* ---------- Toggle ---------- */

.toggle {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
  padding: 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}
.switch {
  flex: 0 0 auto;
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 99px;
  background: var(--line-strong);
  transition: background .2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
}
.toggle[aria-checked="true"] .switch { background: var(--purple); }
.toggle[aria-checked="true"] .switch::after { transform: translateX(20px); }
.toggle strong { display: block; line-height: 1.3; }
.toggle .small { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 15px; }

/* ---------- Score ---------- */

.score {
  margin: 32px 0 0;
  text-align: center;
}
.score-label { display: block; font: 700 13px/1.3 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.score-value {
  display: block;
  margin-top: 2px;
  font: 800 clamp(44px, 12vw, 60px)/1.05 var(--font-display);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.score-value.empty { color: var(--line-strong); }
.score-sub { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--ink-muted); font-size: 15px; }

/* ---------- Tip ---------- */

.tip {
  display: flex;
  gap: 12px;
  max-width: 480px;
  margin: 24px auto 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise .35s ease both;
}
.tip .badge { width: 32px; height: 32px; --c: var(--orange); color: #0B1220; }
.tip .badge svg { width: 18px; height: 18px; }
.tip p { align-self: center; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  gap: 12px;
  margin: 28px -16px 0;
  padding: 24px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--ground) 40%);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 14px 24px;
  border: 0;
  border-radius: 99px;
  font: 700 18px/1 var(--font-display);
  white-space: nowrap;
  transition: transform .15s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; stroke-width: 2.5; }
.btn-primary { flex: 1; background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(0, 50, 240, .25); }
.btn-primary[disabled] { opacity: .3; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-round { flex: 0 0 56px; padding: 0; background: var(--surface); box-shadow: var(--shadow); }
.btn-soft { background: var(--surface); box-shadow: var(--shadow); }

/* ---------- Estimate ---------- */

.estimate { text-align: center; }
.estimate-value {
  display: block;
  margin: 4px 0 18px;
  font: 800 clamp(52px, 15vw, 72px)/1 var(--font-display);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.estimate-value.empty { color: var(--line-strong); }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, var(--pink) var(--p, 25%), var(--line) var(--p, 25%));
}
.range::-moz-range-track { height: 12px; border-radius: 6px; background: var(--line); }
.range::-moz-range-progress { height: 12px; border-radius: 6px; background: var(--pink); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 36px;
  height: 36px;
  margin-top: -12px;
  border-radius: 50%;
  border: 4px solid var(--pink);
  background: #fff;
  box-shadow: var(--shadow);
}
.range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; border: 4px solid var(--pink); background: #fff; }
.range-scale { display: flex; justify-content: space-between; color: var(--ink-faint); font-size: 14px; }

.reveal {
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.reveal-title { margin-bottom: 10px; font: 700 13px/1.3 var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.reveal-row { display: grid; grid-template-columns: 80px 1fr auto; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 15px; }
.reveal-row strong { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.reveal-bar { height: 14px; border-radius: 7px; background: var(--ground); overflow: hidden; }
.reveal-bar i { display: block; height: 100%; width: var(--w); border-radius: 7px; background: var(--c); animation: grow .8s .3s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes grow { from { width: 0; } }
.reveal p { margin-top: 6px; }

/* ---------- Start ---------- */

.start .hero { padding-top: 20px; }

.hero-art { position: relative; height: 120px; width: 220px; margin: 0 auto 20px; }
.hero-art .badge { position: absolute; }
.hero-art .a1 { left: 12px; top: 38px; width: 70px; height: 70px; }
.hero-art .a2 { left: 64px; top: 0; width: 96px; height: 96px; z-index: 1; box-shadow: 0 0 0 6px var(--ground); }
.hero-art .a3 { right: 12px; top: 44px; width: 64px; height: 64px; }
.hero-art .a1 svg { width: 32px; height: 32px; }
.hero-art .a2 svg { width: 46px; height: 46px; }
.hero-art .a3 svg { width: 30px; height: 30px; }
.screen.anim .hero-art .badge { animation: bounce .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.screen.anim .hero-art .a1 { animation-delay: .15s; }
.screen.anim .hero-art .a3 { animation-delay: .25s; }

.eyebrow {
  font: 700 14px/1.2 var(--font-display);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--bright);
  margin-bottom: 6px;
}

.lead { max-width: 40ch; margin: 16px auto 0; font-size: 19px; color: var(--ink-muted); text-wrap: pretty; }

details.story {
  margin: 0 0 32px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
details.story summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
details.story summary::-webkit-details-marker { display: none; }
details.story summary .chev { margin-left: auto; transition: transform .2s; color: var(--ink-muted); }
details.story[open] summary .chev { transform: rotate(90deg); }
details.story .story-body { padding: 0 16px 8px; color: var(--ink-muted); }
details.story .story-body p { margin-bottom: 12px; }

.people { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 520px) { .people { grid-template-columns: repeat(4, 1fr); } }

.person-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 110px;
  padding: 16px 8px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700;
  line-height: 1.25;
  transition: background .2s, color .2s, transform .15s;
}
.person-opt:active { transform: scale(.97); }
.person-opt[aria-checked="true"] { background: var(--blue); color: #fff; }
.person-opt[aria-checked="true"] .head { box-shadow: 0 0 0 2px #fff; }
.heads { display: flex; gap: 4px; height: 34px; align-items: flex-end; }
.head { width: 20px; height: 30px; border-radius: 10px 10px 4px 4px; background: var(--c); }
.person-opt[aria-checked="true"] .head { animation: hop .45s ease both; }
.person-opt[aria-checked="true"] .head:nth-child(2) { animation-delay: .05s; }
.person-opt[aria-checked="true"] .head:nth-child(3) { animation-delay: .1s; }
.person-opt[aria-checked="true"] .head:nth-child(4) { animation-delay: .15s; }
@keyframes hop { 40% { transform: translateY(-8px); } }

/* ---------- Monthly rows ---------- */

.mrows { display: grid; gap: 10px; }

.mrow {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.mrow .badge { width: 44px; height: 44px; }
.mrow .badge svg { width: 22px; height: 22px; }
.mrow-title { font: 700 17px/1.25 var(--font-display); }
.wg-link {
  display: inline-block;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mrow .amount { width: 120px; box-shadow: none; background: var(--ground); border-radius: 12px; }
.mrow .amount input { font-size: 20px; padding: 8px 2px; }
.mrow .amount .unit { font-size: 17px; padding-right: 10px; }
.mrow .chips { grid-column: 2 / -1; justify-content: flex-start; margin-top: 6px; }
.mrow details { grid-column: 2 / -1; margin-top: 4px; font-size: 15px; color: var(--ink-muted); }
.mrow summary { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 600; list-style: none; }
.mrow summary::-webkit-details-marker { display: none; }
.mrow summary svg { width: 16px; height: 16px; }
.mrow details p { margin-top: 4px; }

@media (max-width: 340px) {
  .mrow { grid-template-columns: 1fr auto; }
  .mrow .badge { display: none; }
  .mrow .chips, .mrow details { grid-column: 1 / -1; }
}

.left-over {
  max-width: 420px;
  margin: 16px auto 0;
  text-align: center;
  color: var(--ink-muted);
}
.left-over strong { display: block; color: var(--ink); font: 800 32px/1.2 var(--font-display); }
.left-over.minus strong { color: var(--red); }

/* ---------- Receipt ---------- */

.receipt {
  position: relative;
  padding: 22px 20px 26px;
  background: var(--paper);
  color: #0B1220;
  font: 400 14px/1.45 var(--font-mono);
  box-shadow: var(--shadow);
  border-radius: 6px 6px 0 0;
}
.receipt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 10px;
  background:
    linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 14px 10px repeat-x,
    linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 14px 10px repeat-x;
}

.r-head { text-align: center; padding-bottom: 12px; border-bottom: 2px dashed #AFC0DA; }
.r-head strong { display: block; font-weight: 600; letter-spacing: .14em; }
.r-head span { color: #57647F; font-size: 12px; }

.r-sec { margin: 14px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #57647F; }

.r-lines { list-style: none; margin: 0; padding: 0; }
.r-line {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 0;
}
.r-line::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 4px;
  bottom: 4px;
  width: 4px;
  border-radius: 0 2px 2px 0;
  background: var(--c);
  opacity: 0;
  transition: opacity .2s;
}
.r-line.active::before { opacity: 1; }
.r-line.active .r-name { font-weight: 600; }
.r-dots { flex: 1; border-bottom: 1px dotted #AFC0DA; transform: translateY(-4px); min-width: 12px; }
.r-amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-line.empty { color: #8C99B3; }
.r-line.new .r-amt { animation: print .5s ease both; }
@keyframes print { from { opacity: 0; transform: translateY(-4px); } }

.r-total {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid #0B1220;
  font-weight: 600;
}
.r-share {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 4px;
  background: #0B1220;
  color: #fff;
  font-weight: 600;
}
.r-note { margin-top: 4px; font-size: 12px; color: #57647F; }

.r-savings { margin-top: 16px; padding-top: 12px; border-top: 2px dashed #AFC0DA; }
.r-row { display: flex; justify-content: space-between; gap: 8px; }
.r-bar { height: 8px; margin: 8px 0 4px; border-radius: 4px; background: #DCE4F0; overflow: hidden; }
.r-bar i { display: block; height: 100%; border-radius: 4px; background: var(--green); transition: width .5s ease, background .3s; }
.r-bar i.near { background: var(--orange); }
.r-bar i.over { background: var(--red); }

.r-foot { margin-top: 16px; text-align: center; font-size: 12px; color: #8C99B3; letter-spacing: .06em; }

.side .receipt { max-height: calc(100vh - 140px); overflow: auto; }

/* ---------- Drawer ---------- */

.drawer {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  margin: auto auto 0;
  padding: 56px 16px calc(28px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--ground);
  color: var(--ink);
}
.drawer[open] { animation: slide-up .35s cubic-bezier(.2, .8, .3, 1) both; }
.drawer::backdrop { background: rgba(7, 12, 28, .5); }
@keyframes slide-up { from { transform: translateY(60px); opacity: 0; } }
.drawer-close {
  position: absolute;
  top: 10px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* ---------- Save as image ---------- */

.save { text-align: center; }
.save img { display: block; width: 100%; height: auto; border-radius: 12px; box-shadow: var(--shadow); }
.save .btn { width: 100%; margin-top: 18px; }
.save .field-hint { margin-top: 10px; }

/* ---------- Result ---------- */

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  padding: 18px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.stat span { display: block; font: 700 12px/1.3 var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.stat strong { display: block; margin: 4px 0 2px; font: 800 clamp(26px, 7.5vw, 36px)/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat small { display: block; font-size: 14px; color: var(--ink-muted); }

.verdict {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.verdict .badge { width: 32px; height: 32px; }
.verdict .badge svg { width: 18px; height: 18px; stroke-width: 3; }
.verdict p + p { margin-top: 6px; color: var(--ink-muted); }

.section-title { margin: 36px 0 14px; text-align: center; font: 800 24px/1.2 var(--font-display); }

.levers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lever { text-align: center; }
.lever .badge { width: 64px; height: 64px; margin-bottom: 8px; background: var(--line); color: var(--ink-faint); transition: background .3s; }
.lever .badge svg { width: 30px; height: 30px; }
.lever.on .badge { background: var(--green); color: #fff; }
.lever.on:nth-child(2) .badge { background: var(--bright); }
.lever.on:nth-child(3) .badge { background: var(--purple); }
.lever strong { display: block; font: 700 15px/1.25 var(--font-display); }
.lever small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-muted); }

.note { max-width: 46ch; margin: 16px auto 0; text-align: center; color: var(--ink-muted); }

.result .receipt { max-width: 420px; margin: 0 auto; }

.actions { display: grid; gap: 10px; margin-top: 40px; }
@media (min-width: 520px) { .actions { grid-template-columns: 1fr 1fr; } .actions .btn-primary { grid-column: 1 / -1; } }

.print-only { display: none; }

/* ---------- Confetti ---------- */

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti i {
  position: absolute;
  top: -14px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: fall var(--d, 1.6s) cubic-bezier(.25, .6, .5, 1) forwards;
}
@keyframes fall { to { transform: translate(var(--x, 0), 105vh) rotate(var(--r, 540deg)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}

/* ---------- Print: summary and receipt only ---------- */

@media print {
  @page { margin: 16mm; }
  :root { --ground: #fff; --surface: #fff; --paper: #fff; --ink: #000; --ink-muted: #333; --shadow: none; }
  body { background: #fff; }
  .top, .side, .drawer, .confetti, .no-print { display: none !important; }
  .layout { display: block !important; padding: 0; }
  .screen { max-width: none; animation: none !important; }
  .print-only { display: block; margin-bottom: 16px; }
  .stat, .verdict, .lever, .receipt { break-inside: avoid; border: 1px solid #000; }
  .receipt::after { display: none; }
}
