/* Overdraft. Design tokens locked off the approved avatar/banner art.
   Bezel = scratched beige-grey ATM plastic. Screen = near-black glass,
   amber header glow, red segmented balance glow. Receipt = aged dot-matrix paper.
   Three fonts, each tied to a real surface: DSEG14 for the lit alpha readout,
   DSEG7 for the lit money digits, Share Tech Mono for printed plastic/paper. */

@font-face {
  font-family: 'DSEG14 Classic';
  src: url('assets/fonts/dseg14-classic-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DSEG7 Classic';
  src: url('assets/fonts/dseg7-classic-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Share Tech Mono';
  src: url('assets/fonts/share-tech-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bezel-hi: #c3b78f;
  --bezel-mid: #a4966c;
  --bezel-low: #6f6448;
  --bezel-shadow: #362f20;
  --screw: #3c3524;
  --screen-bg: #0b0906;
  --screen-edge: #050403;
  --amber: #ffb24d;
  --amber-dim: #c47f2c;
  --red: #ff4433;
  --red-dim: #b02e22;
  --red-line: #9c2c20;
  --paper: #e9e1cd;
  --paper-shadow: #c9bf9e;
  --ink: #2c2418;
  --page-bg: #17130f;
  --page-bg-2: #0c0a08;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 36px;
  --radius-screen: 10px;
  --radius-key: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-5) var(--space-3) var(--space-4);
  font-family: 'Share Tech Mono', monospace;
  color: #d8cfb8;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 120, 40, 0.06), transparent 55%),
    repeating-linear-gradient(115deg, var(--page-bg) 0px, var(--page-bg) 26px, var(--page-bg-2) 26px, var(--page-bg-2) 27px);
}

.atm {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bezel {
  position: relative;
  width: 100%;
  padding: 26px 22px 20px;
  border-radius: 18px;
  background: linear-gradient(155deg, var(--bezel-hi) 0%, var(--bezel-mid) 55%, var(--bezel-low) 100%);
  box-shadow:
    0 18px 0 -6px var(--bezel-shadow),
    0 22px 30px rgba(0, 0, 0, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    inset 0 -10px 18px rgba(40, 33, 18, 0.45);
}

.screw {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8a7e5e, var(--screw) 70%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 255, 255, 0.15);
}
.screw.tl { top: 12px; left: 12px; }
.screw.tr { top: 12px; right: 12px; }
.screw.bl { bottom: 12px; left: 12px; }
.screw.br { bottom: 12px; right: 12px; }

.screen {
  position: relative;
  border-radius: var(--radius-screen);
  background: var(--screen-edge);
  padding: 3px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.5);
}

.screen-inner {
  position: relative;
  border-radius: 7px;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(120, 60, 10, 0.35), transparent 65%),
    var(--screen-bg);
  padding: var(--space-3) var(--space-3) var(--space-2);
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.85);
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 178, 77, 0.05) 0px,
    rgba(255, 178, 77, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
}

.header-row { text-align: center; margin-bottom: var(--space-2); }

.brand {
  font-family: 'DSEG14 Classic', monospace;
  font-size: clamp(1.7rem, 8vw, 2.5rem);
  letter-spacing: 0.05em;
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255, 178, 77, 0.9), 0 0 18px rgba(255, 140, 40, 0.55);
}

.balance-box {
  position: relative;
  border: 2px solid var(--red-line);
  border-radius: 2px;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  background: rgba(60, 10, 6, 0.12);
}

.balance {
  display: block;
  font-family: 'DSEG7 Classic', monospace;
  font-size: clamp(2.1rem, 11vw, 3.2rem);
  line-height: 1.1;
  text-align: center;
  color: var(--red);
  text-shadow: 0 0 6px rgba(255, 68, 51, 0.9), 0 0 22px rgba(255, 40, 20, 0.5);
}

.balance.flash { animation: balanceFlash 320ms ease-out; }
@keyframes balanceFlash {
  0% { text-shadow: 0 0 14px #fff, 0 0 34px var(--red); color: #fff2ea; }
  100% { text-shadow: 0 0 6px rgba(255, 68, 51, 0.9), 0 0 22px rgba(255, 40, 20, 0.5); color: var(--red); }
}

.entry-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: 'DSEG14 Classic', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--amber-dim);
  margin-bottom: var(--space-1);
}

.entry-value {
  font-family: 'DSEG7 Classic', monospace;
  font-size: 1rem;
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255, 178, 77, 0.7);
}

.status-line {
  font-family: 'DSEG14 Classic', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  word-spacing: 0.3em;
  color: var(--amber-dim);
  min-height: 1.4em;
  border-top: 1px dashed rgba(255, 178, 77, 0.25);
  padding-top: var(--space-1);
}

.session-row {
  display: flex;
  justify-content: space-between;
  font-family: 'DSEG14 Classic', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  word-spacing: 0.3em;
  color: rgba(255, 178, 77, 0.45);
  margin-top: var(--space-1);
}

.controls {
  margin-top: var(--space-4);
  width: 100%;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: var(--space-3);
}

.key {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: #2a2314;
  padding: 14px 0;
  border: none;
  border-radius: var(--radius-key);
  cursor: pointer;
  background: linear-gradient(180deg, #d8cca4 0%, #b7a877 55%, #9c8d5f 100%);
  box-shadow:
    0 4px 0 var(--bezel-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.key:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--bezel-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.key.wide {
  font-size: 0.85rem;
}
.key.clear { color: #6b1c14; }
.key.go {
  background: linear-gradient(180deg, #d68a52 0%, #b5602a 55%, #8f491d 100%);
  color: #2a1206;
}

.fast-cash {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: var(--space-3);
}

.fast-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: #d8cfb8;
  padding: 10px 4px;
  border: 1px solid rgba(216, 207, 184, 0.25);
  border-radius: var(--radius-key);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
}
.fast-btn:active { transform: translateY(2px); background: rgba(0, 0, 0, 0.45); }

.print-btn {
  width: 100%;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--amber);
  padding: 12px 0;
  border: 1px solid var(--amber-dim);
  border-radius: var(--radius-key);
  background: rgba(180, 100, 30, 0.08);
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
}
.print-btn:active { transform: translateY(2px); }

.receipt-wrap {
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 900ms cubic-bezier(0.2, 0.8, 0.2, 1);
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.45));
}
.receipt-wrap.open { max-height: 2400px; }

.receipt {
  margin-top: 4px;
  background: var(--paper);
  color: var(--ink);
  padding: var(--space-4) var(--space-3) var(--space-5);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  border-bottom: 3px dashed var(--paper-shadow);
  clip-path: polygon(
    0% 0%, 4% 2%, 8% 0%, 12% 2%, 16% 0%, 20% 2%, 24% 0%, 28% 2%, 32% 0%, 36% 2%,
    40% 0%, 44% 2%, 48% 0%, 52% 2%, 56% 0%, 60% 2%, 64% 0%, 68% 2%, 72% 0%, 76% 2%,
    80% 0%, 84% 2%, 88% 0%, 92% 2%, 96% 0%, 100% 2%, 100% 100%, 0% 100%
  );
}

.receipt .rline { display: block; }
.receipt .noise { color: #7c7362; }
.receipt .divider { border-top: 1px dashed var(--ink); margin: var(--space-2) 0; }
.receipt .big {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: var(--space-2);
}
.receipt .ca {
  cursor: pointer;
  text-decoration: underline dotted;
}
.receipt a { color: var(--ink); }

.foot {
  margin-top: var(--space-5);
  max-width: 460px;
  text-align: center;
  font-size: 0.68rem;
  color: rgba(216, 207, 184, 0.4);
  line-height: 1.5;
}

.sound-toggle {
  position: fixed;
  top: var(--space-3);
  right: var(--space-3);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: rgba(216, 207, 184, 0.55);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(216, 207, 184, 0.2);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
}

#error-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #b02e22;
  color: #fff2ea;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  padding: 10px 14px;
  z-index: 999;
  display: none;
}

@media (min-width: 640px) {
  .atm { max-width: 480px; }
}

@media (prefers-reduced-motion: reduce) {
  .receipt-wrap { transition: none; }
  .balance.flash { animation: none; }
  .key, .fast-btn, .print-btn { transition: none; }
}


/* the contract prints on the screen itself, not only on the receipt: it has to be readable
   without pressing anything (03_SITES, 2026-08-31). Same amber dot-matrix register. */
.card-row {
  margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, "Courier New", monospace;
  font-size: 10px; letter-spacing: 0.02em; color: #f0a23c; opacity: .92; word-break: break-all;
}
.ca-screen {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  border-bottom: 1px dotted currentColor;
}
