/* Minimum Payment.
 *
 * The statement is the set. It borrows just enough banking furniture - mono
 * digits, a card number, a due date - to feel like a real bill, then keeps
 * the arcade palette so nobody mistakes it for a bank app.
 *
 * Money is the hero number and carries --gold. Interest is the only thing
 * allowed to be --hot, so the colour arriving in the breakdown is itself the
 * bad news, before any word is read.
 */

.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: statement scrolls inside, thumb pad stays put.
   The other screens keep growing with their 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(42px, 13vw, 70px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.045em;
}

.title .pay {
  display: block;
  color: var(--gold);
}

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

.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); }

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

.guess {
  display: block;
  width: 100%;
  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 {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--dim);
}

.big-btn {
  margin-top: 22px;
  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; }

.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-score { 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 { color: var(--hot); }
#cibil.up { color: var(--volt); }
#cibil.down { color: var(--hot); }

/* The score meter: 300-900, the real CIBIL range. */
.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); }

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

/* The statement scrolls; the pad never does. min-height:0 is what lets this
   flex child actually shrink instead of shoving the buttons off the fold. */
.scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 0 6px;
}

.block { margin-bottom: 14px; }

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

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

.spend li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: 14.5px;
  animation: slide-in 0.34s var(--ease-out) both;
}

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

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

/* ---------- the statement ---------- */

.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 ---------- */

.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; }

/* Interest is the only --hot thing here, and it arrives with a tick. */
.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 (44px) even though it draws as a small pill. The pseudo
   element supplies the 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 statement with no tap: the one number that explains
   itself breathes, so she knows it can be pressed. 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; }

/* Inline plain-English gloss next to a real banking 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 her scrolling. flex-shrink:0 keeps it whole; the scroller above is
   what gives up the room. */
.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); }

/* ---------- choose ---------- */

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

.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;
  transition: transform 0.12s var(--ease-snap), opacity 0.2s;
}

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

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

.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); border-color: var(--line); background: rgba(42, 24, 72, 0.6); }
.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: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--gold);
  cursor: grab;
}

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

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

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

.why-body { font-size: 15px; line-height: 1.6; }
.why-body p { margin: 0 0 12px; }
.why-body p.fine, #lesson p.fine { font-size: 11.5px; line-height: 1.5; color: var(--dim); }
.why-body p:last-child { margin-bottom: 0; }
.why-body b { color: var(--gold); font-weight: 700; }
.why-body .num { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; color: var(--hot); }

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

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

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

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

.tally {
  padding: 6px 18px;
  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: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.tally-v.hot { color: var(--hot); }
.tally-score .tally-v { font-size: 19px; }

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

.instead[hidden] { display: none; }

.reveal-card {
  margin-top: 14px;
  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.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.why-line { margin: 0 0 9px; font-size: 15px; line-height: 1.55; }
.why-line:last-child { margin-bottom: 0; }
.why-line.truth { color: var(--paper); }
.why-line.truth b { color: var(--gold); }
.why-line.twist { color: var(--dim); font-size: 14px; }

#lesson p { margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
#lesson p:last-child { margin-bottom: 0; }
#lesson b { color: var(--gold); }

/* ---------- fold-aways ----------
 * One verdict line visible, the working behind a tap. Native <details>, so
 * there is no JS to keep in sync and the keyboard gets it for free. */

.lesson-lead { margin: 0 0 4px !important; font-size: 15.5px !important; }

.lesson-more summary,
.fine-more summary {
  display: inline-flex;
  align-items: center;
  /* 44px: the documented minimum tap target. Not the full --thumb height,
     which is sized for primary buttons and would leave a crater in prose. */
  min-height: 44px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
  list-style: none;
}

.lesson-more summary::-webkit-details-marker,
.fine-more summary::-webkit-details-marker { display: none; }

.lesson-more summary::after,
.fine-more summary::after { content: " \25BE"; }

.lesson-more[open] summary::after,
.fine-more[open] summary::after { content: " \25B4"; }

.lesson-more summary:hover,
.fine-more summary:hover { color: var(--paper); }

.lesson-body { padding-top: 2px; }
.lesson-more .why-line { margin: 2px 0 0; }
.fine-more .fine { margin-top: 2px; }

.text-link {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--dim);
  text-decoration: none;
}

.text-link:hover { color: var(--paper); }

@keyframes ss-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* Wider screens: the statement and the pad sit side by side is overkill for
   a 400px-first game, so we only relax the padding. */
@media (min-width: 560px) {
  .screen { padding-left: 20px; padding-right: 20px; }
}
