/* Layout: one narrow column, a manila case folder holding a single paper sheet per stage; telegrams are tape strips pasted on paper. Single deliberate paper look. */
:root {
  --manila: #E3D29C;
  --sheet: #F5EEDA;
  --tape: #FCF9EF;
  --form: #EADFC1;
  --line: #C6B482;
  --ink: #1D2521;
  --ink-soft: #5B5845;
  --stamp: #B42318;
  --money: #2E5E4E;
  --money-pale: #D7E0CB;
  --shadow: rgba(70, 52, 12, .45);
  --f-display: 'Rubik Mono One', 'Arial Black', Impact, sans-serif;
  --f-body: 'PT Serif', Georgia, 'Times New Roman', serif;
  --f-mono: 'PT Mono', 'Courier New', monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { background: var(--manila); color: var(--ink); }
body { margin: 0; padding-top: max(14px, env(safe-area-inset-top)); }
[hidden] { display: none !important; }
body {
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.5;
  padding-inline: 16px;
  padding-block: 14px 40px;
  -webkit-tap-highlight-color: transparent;
}
.app { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* case header */
.case {
  display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: center;
  font-family: var(--f-mono); font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
}
.bens { display: flex; align-items: baseline; gap: 6px; }
.bens b { font-family: var(--f-display); font-weight: 400; font-size: 16px; color: var(--stamp); font-variant-numeric: tabular-nums; }
.bens.pop { animation: pop .6s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.prog { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.prog span { height: 6px; background: var(--line); }
.prog span.done { background: var(--ink); }
.prog span.now { background: var(--stamp); }

/* sheet */
.sheet {
  background: var(--sheet);
  padding: 22px 18px 24px;
  box-shadow: 0 1px 0 var(--line), 0 12px 26px -16px var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
  border-radius: 2px;
  animation: slide .35s ease both;
}
@keyframes slide { from { transform: translateY(8px); } to { transform: none; } }
h1, h2 { font-family: var(--f-display); font-weight: 400; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 25px; }
h2 { font-size: 22px; }
p { margin: 0; }
.eyebrow { font-family: var(--f-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.head { display: flex; flex-direction: column; gap: 4px; }
.stamp {
  align-self: flex-start;
  font-family: var(--f-display); font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--stamp); border: 3px solid var(--stamp); padding: 6px 10px;
  transform: rotate(-4deg); opacity: .92;
}
.stamp.closed { color: var(--money); border-color: var(--money); animation: thump .5s ease both; }
@keyframes thump { 0% { transform: rotate(-4deg) scale(1.8); opacity: .2; } 100% { transform: rotate(-4deg) scale(1); opacity: .92; } }

.ben i { font-style: normal; color: var(--stamp); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Bender speech */
.say .who { font-family: var(--f-mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-right: 4px; }

/* telegram */
.tg { background: var(--form); border: 1px solid var(--line); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.tg-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-family: var(--f-display); font-size: 11px; letter-spacing: .08em; color: var(--ink-soft); padding-bottom: 4px; border-bottom: 1px dashed var(--line); }
.tg-line { background: var(--tape); font-family: var(--f-mono); font-size: 15px; line-height: 1.4; padding: 3px 8px; box-shadow: 0 1px 0 var(--line); }
.tg-from { text-align: right; font-family: var(--f-mono); font-size: 14px; }

/* controls */
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--stamp); outline-offset: 2px; }
.btn {
  font-family: var(--f-display); font-size: 15px; letter-spacing: .04em;
  background: var(--ink); color: var(--sheet); border: 0; border-radius: 3px;
  padding: 16px 18px; width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn.red { background: var(--stamp); }
.opts { display: grid; gap: 8px; }
.opt {
  font-family: var(--f-body); font-size: 17px; text-align: left;
  background: var(--tape); border: 1.5px solid var(--ink); border-radius: 3px; padding: 12px 14px;
}
.opt.wrong { border-color: var(--stamp); color: var(--ink-soft); text-decoration: line-through; }
.opt.right { background: var(--money); border-color: var(--money); color: var(--tape); }
.opt.right .ben i { color: var(--tape); }
.fb { font-style: italic; }
.fb:empty { display: none; }
.link { background: none; border: 0; padding: 4px 0; align-self: flex-start; font-family: var(--f-mono); font-size: 13px; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.hint { font-family: var(--f-mono); font-size: 14px; background: var(--tape); border: 1px dashed var(--line); padding: 8px 10px; }
.next { display: flex; flex-direction: column; gap: 12px; }

/* fuel */
.gauge-wrap { display: flex; flex-direction: column; gap: 6px; }
.gauge { height: 30px; border: 2px solid var(--ink); background: var(--tape); position: relative; overflow: hidden; }
.gauge .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--money); }
.gauge-scale { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 12px; color: var(--ink-soft); }
.hold { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.hold.on { background: var(--money); }

/* clock */
.clock { width: 220px; max-width: 72%; aspect-ratio: 1; margin: 0 auto; display: block; }
.clock .face { fill: var(--tape); stroke: var(--ink); stroke-width: 5; }
.clock .tick { stroke: var(--ink); stroke-width: 1.4; }
.clock .tick.big { stroke-width: 3.2; }
.clock .num { font-family: var(--f-body); font-size: 15px; font-weight: 700; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.clock .hand { stroke: var(--ink); stroke-linecap: round; }
.clock .hand.m { stroke: var(--stamp); }
.clock .pin { fill: var(--ink); }
.clock.ring { animation: swing .18s ease-in-out 8 alternate; }
@keyframes swing { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
.digi { font-family: var(--f-display); font-size: 34px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.ctrls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ctrl { display: flex; align-items: center; justify-content: space-between; gap: 6px; border: 1.5px solid var(--ink); background: var(--tape); padding: 6px; }
.ctrl { min-width: 0; }
.ctrl span { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ctrl button { flex: none; width: 40px; height: 44px; font-size: 22px; line-height: 1; background: var(--ink); color: var(--sheet); border: 0; border-radius: 2px; }

/* tiger */
.mood { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-block: 1px dashed var(--line); padding-block: 10px; }
.roar { font-family: var(--f-display); font-size: 17px; }
.pips { display: flex; gap: 6px; }
.pip { width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 50%; }
.pip.on { background: var(--money); border-color: var(--money); }
.q { font-weight: 700; }

/* safe */
.code { display: flex; gap: 10px; justify-content: center; }
.code span { width: 58px; height: 70px; border: 2px solid var(--ink); background: var(--tape); font-family: var(--f-display); font-size: 32px; display: grid; place-items: center; }
.code.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pad button { height: 56px; font-family: var(--f-display); font-size: 20px; background: var(--tape); border: 1.5px solid var(--ink); border-radius: 3px; }
.pad .ok { background: var(--ink); color: var(--sheet); }

/* puzzle */
.puz { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; max-width: 320px; margin: 0 auto; transition: gap .5s ease; }
.puz.solved { gap: 0; }
.tile { position: relative; overflow: hidden; aspect-ratio: 1; border: 0; padding: 0; background: var(--money-pale); max-width: 100%; }
.tile svg { position: absolute; width: 200%; height: 200%; display: block; }
.tile.sel { outline: 4px solid var(--stamp); outline-offset: -4px; z-index: 1; }
.caption { text-align: center; font-family: var(--f-mono); font-size: 15px; }

/* final */
.tally { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--f-mono); font-size: 13px; border: 1.5px solid var(--ink); background: var(--tape); padding: 3px 8px; }
.chip i { font-style: normal; color: var(--stamp); }
.sign { font-family: var(--f-mono); font-size: 14px; color: var(--ink-soft); text-align: right; }

footer { display: flex; justify-content: center; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
