/* Carry.
 *
 * The bill is the set. It borrows just enough banking furniture — mono digits,
 * a card number, a due date — to feel like a real statement, then keeps the
 * arcade palette so nobody mistakes it for a bank app.
 *
 * Colour does the teaching before any word is read: money you keep is --gold,
 * money arriving is --volt, and interest is the ONLY thing on the page allowed
 * to be --hot. When that colour appears in the breakdown, that is the bad news
 * arriving, and it arrives with a tick.
 */

.screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(64px, calc(env(safe-area-inset-top) + 56px)) 16px max(16px, env(safe-area-inset-bottom));
}

.screen[hidden] { display: none; }

/* Play is a fixed-height frame: the beat scrolls inside it, the thumb pad
   never moves. Everything else grows with its content. */
#play { height: 100dvh; min-height: 0; }

/* ---------- intro ---------- */

#intro { justify-content: center; max-width: 520px; margin: 0 auto; }

.kicker {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--dim);
}

.title {
  margin: 0;
  font-size: clamp(52px, 17vw, 88px);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -0.05em;
  color: var(--gold);
}

.pitch {
  margin: 18px 0 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--dim);
  max-width: 38ch;
}

.pitch b { font-weight: 700; }

.quiz {
  margin-top: 22px;
  padding: 18px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.quiz-q {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.5;
}

.gold { color: var(--gold); }
.hot  { color: var(--hot); }
.volt { color: var(--volt); }

.guesses { display: grid; gap: 8px; }

.guess {
  display: block;
  width: 100%;
  min-height: 56px;
  text-align: left;
  padding: 13px 15px;
  border-radius: 13px;
  background: var(--panel-lift);
  border: 1.5px solid transparent;
  transition: border-color 0.14s, background 0.14s, transform 0.12s var(--ease-snap);
}

.guess:active { transform: scale(0.985); }

.guess[aria-checked="true"] {
  border-color: var(--gold);
  background: rgba(255, 197, 49, 0.1);
}

.guess-m { display: block; font-size: 16px; font-weight: 600; }

.guess-t {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: var(--dim);
}

.fine-more { margin-top: 14px; }

.fine-more summary {
  display: inline-block;
  padding: 10px 0;
  min-height: 44px;
  font-size: 12.5px;
  color: var(--dim);
  cursor: pointer;
}

.fine {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--dim);
}

.big-btn {
  margin-top: 22px;
  min-height: 56px;
  padding: 17px 26px;
  border-radius: 16px;
  background: var(--paper);
  color: var(--void);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 0.14s var(--ease-snap), opacity 0.2s;
}

.big-btn:active { transform: scale(0.97); }
.big-btn[disabled] { opacity: 0.32; cursor: default; }
.big-btn.slim { margin-top: 0; padding: 14px 22px; font-size: 16px; flex: 1; }

.ghost-btn {
  min-height: 48px;
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--dim);
  font-size: 15px;
  font-weight: 600;
}

.best { margin: 14px 0 0; font-size: 13.5px; color: var(--dim); }

/* ---------- hud ---------- */

.hud {
  display: flex;
  gap: 10px;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}

.hud-cell { flex: 1; min-width: 0; }
.hud-cell.hud-card { text-align: right; }

.hud-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

.hud-val {
  display: block;
  margin-top: 3px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hud-of { font-size: 13px; font-weight: 500; color: var(--dim); }

#cash.broke, #owed.broke { color: var(--hot); }

/* The credit score, 300-900. Never labelled while playing — it is a bar that
   moves, and the end screen is where it gets a name. */
.meter {
  max-width: 520px;
  width: 100%;
  margin: 10px auto 0;
  height: 4px;
  border-radius: 99px;
  background: var(--panel-lift);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--volt);
  transform-origin: left;
  transition: transform 0.6s var(--ease-out), background 0.4s;
}

.meter i.mid { background: var(--gold); }
.meter i.low { background: var(--hot); }

/* ---------- the scroller ---------- */

/* min-height:0 is what lets this flex child actually shrink instead of
   shoving the thumb pad off the bottom of the phone. */
.scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 0 6px;
}

.beat { animation: slide-in 0.3s var(--ease-out) both; }
.beat[hidden] { display: none; }

.beat-h {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- beat 1: salary ---------- */

.pay-in, .pay-left {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  font-size: 15px;
}

.pay-in {
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.pay-in span, .pay-left span { color: var(--dim); }

.pay-in b {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.beat-note {
  margin: 14px 0 10px;
  font-size: 13px;
  color: var(--dim);
}

.spend { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }

.spend li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: 14.5px;
}

.spend li span { color: var(--dim); }
.spend li b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Something you agreed to in an earlier month and now pay forever. */
.spend li span.added::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--gold);
  vertical-align: 2px;
}

.spend li .in { color: var(--volt); }

.pay-left {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.pay-left b {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--gold);
}

.pay-left b.hot { color: var(--hot); }

/* ---------- beat 2: the situation ---------- */

.sit-tag {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.sit-title {
  margin: 0;
  font-size: clamp(26px, 7.5vw, 34px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.sit-text {
  margin: 14px 0 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--dim);
  max-width: 34ch;
}

/* Anything longer than the situation itself lives in here, so the screen
   keeps its word budget and nobody reads a paragraph unasked. */
.sit-why { margin-top: 16px; }

.sit-why summary {
  display: inline-block;
  min-height: 44px;
  padding: 12px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold);
  cursor: pointer;
}

.sit-why p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dim);
}

/* ---------- beat 3: the bill ---------- */

.statement {
  padding: 20px 18px 18px;
  border-radius: 20px;
  background: linear-gradient(165deg, var(--panel-lift), var(--panel));
  border: 1px solid var(--line);
  box-shadow: 0 24px 56px -30px rgba(0, 0, 0, 0.9);
}

.stmt-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.stmt-brand {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--dim);
}

.stmt-card {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: var(--dim);
}

.stmt-label {
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

/* The hero. Everything else on the screen is smaller than this. */
.hero {
  margin: 4px 0 0;
  font-size: clamp(38px, 11.5vw, 54px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--gold);
}

.hero.jump { animation: jump 0.5s var(--ease-snap); }

@keyframes jump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.breakdown { margin-top: 14px; display: grid; gap: 1px; }

.bd {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  font-size: 14px;
  border-top: 1px solid rgba(58, 37, 96, 0.55);
}

.bd:first-child { border-top: 0; }
.bd-k { color: var(--dim); }
.bd-v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.bd.interest .bd-k, .bd.interest .bd-v { color: var(--hot); }
.bd.interest { animation: creep 0.6s var(--ease-out) both; }

@keyframes creep {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}

/* The pull affordance. It is the only door to the explanation, so it has to
   be a real thumb target even though it draws as a small pill — the pseudo
   element supplies the 44px hit area without bloating the row. */
.ask {
  position: relative;
  margin-left: 6px;
  padding: 2px 9px 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 45, 120, 0.55);
  background: rgba(255, 45, 120, 0.14);
  color: var(--hot);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: 1px;
}

.ask::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.ask:hover { background: rgba(255, 45, 120, 0.25); }

/* Three seconds on a bill with a charge on it and no tap: the one number
   that explains itself starts breathing. No tutorial, no modal. */
@keyframes ask-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 45, 120, 0); }
  50%      { box-shadow: 0 0 0 5px rgba(255, 45, 120, 0.22); }
}

.ask.nudge { animation: ask-pulse 1.6s ease-in-out infinite; }

/* Plain-English gloss next to a term we keep. */
.gloss {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--dim);
}

.due-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.due-right { text-align: right; }

.due {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.due-date { margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--dim); }

/* ---------- reaction ---------- */

/* Sits between the scroller and the thumb pad, so a tap always answers back
   without scrolling. flex-shrink:0 keeps it whole; the scroller gives up the
   room instead. */
.reaction {
  flex: 0 0 auto;
  max-width: 520px;
  width: 100%;
  margin: 12px auto 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel);
  border-left: 3px solid var(--dim);
  font-size: 14.5px;
  line-height: 1.45;
  animation: slide-in 0.3s var(--ease-out) both;
}

.reaction[hidden] { display: none; }
.reaction.good { border-left-color: var(--volt); }
.reaction.bad  { border-left-color: var(--hot); }
.reaction.warn { border-left-color: var(--gold); }

/* ---------- thumb pad ---------- */

.choose {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  max-width: 520px;
  width: 100%;
  margin: 12px auto 0;
}

/* One button spans the width — the "carry on" beats, where there is nothing
   to decide and the tap is only a pace-setter. */
.choose.one { grid-template-columns: 1fr; }

.choice {
  min-height: clamp(52px, 12vw, 64px);
  padding: 8px 10px;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  border: 1.5px solid var(--line);
  background: rgba(42, 24, 72, 0.6);
  transition: transform 0.12s var(--ease-snap), opacity 0.2s;
}

.choice:active { transform: scale(0.96); }
.choice[disabled] { opacity: 0.35; cursor: default; }

.choice-main { display: block; }

.choice-sub {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
}

/* The situation beat: spending and not-spending are told apart by weight,
   never by a colour that would grade the answer before it is made. */
.choice.spend { color: var(--paper); }
.choice.free  { color: var(--dim); }

.choice.go {
  grid-column: 1 / -1;
  color: var(--void);
  background: var(--paper);
  border-color: var(--paper);
}

.choice.full   { color: var(--volt); border-color: rgba(0, 229, 192, 0.4);  background: rgba(0, 229, 192, 0.09); }
.choice.min    { color: var(--gold); border-color: rgba(255, 197, 49, 0.4); background: rgba(255, 197, 49, 0.09); }
.choice.custom { color: var(--paper); }
.choice.none   { color: var(--hot);  border-color: rgba(255, 45, 120, 0.4); background: rgba(255, 45, 120, 0.09); }

/* ---------- sheets ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 5, 18, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.2s var(--ease-out) both;
}

.sheet[hidden] { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-card {
  width: 100%;
  max-width: 520px;
  max-height: 84dvh;
  overflow-y: auto;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  animation: rise 0.28s var(--ease-out) both;
}

@keyframes rise {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.sheet-h {
  margin: 0 0 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.slider {
  width: 100%;
  margin: 18px 0 0;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 99px;
  background: var(--panel-lift);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--panel);
  cursor: grab;
}

.slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--panel);
  cursor: grab;
}

.sheet-note {
  margin: 14px 0 18px;
  min-height: 2.8em;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--dim);
}

.sheet-btns { display: flex; gap: 10px; }

.why-body p { margin: 0 0 12px; font-size: 15px; line-height: 1.5; }
.why-body p:last-child { margin-bottom: 18px; }

.why-body .sum {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-lift);
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 14px;
  line-height: 1.6;
}

.why-body .num { color: var(--hot); font-weight: 700; }

/* ---------- ending ---------- */

#over { max-width: 520px; margin: 0 auto; }

.over-title {
  margin: 0 0 20px;
  font-size: clamp(28px, 8.5vw, 40px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.tally {
  padding: 4px 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.tally-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid rgba(58, 37, 96, 0.55);
}

.tally-row:first-child { border-top: 0; }
.tally-k { font-size: 14.5px; color: var(--dim); }

.tally-v {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.tally-v.hot { color: var(--hot); }
.tally-score .tally-v { color: var(--gold); }

.instead {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 45, 120, 0.1);
  border: 1px solid rgba(255, 45, 120, 0.3);
  font-size: 14.5px;
  line-height: 1.5;
}

.reveal-card {
  margin-top: 16px;
  padding: 18px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.trick {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.why-line {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--dim);
}

.why-line:last-child { margin-bottom: 0; }
.why-line.truth { color: var(--paper); }
.why-line.twist { margin-top: 10px; }
.why-line b { color: var(--paper); font-weight: 700; }

.lesson-lead {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.5;
}

.lesson-more { margin-top: 14px; }

.lesson-more summary {
  display: inline-block;
  min-height: 44px;
  padding: 12px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold);
  cursor: pointer;
}

.lesson-body p {
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--dim);
}

.lesson-body b { color: var(--paper); }

.text-link {
  display: block;
  margin: 16px 0 0;
  padding: 12px 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--dim);
}

.nojs {
  position: relative;
  z-index: 1;
  margin: 100px 20px;
  font-size: 16px;
  color: var(--dim);
}
