/* Jen's Plinko: her site's near-black, magenta and JetBrains Mono.
   The board is the hero; everything around it is type on calm space. */
:root {
  --bg: #09090b;
  --raised: #131316;
  --raised-2: #1c1c20;
  --fg: #f4f4f5;
  --fg-2: #a1a1aa;
  --muted: #77777f;
  --line: rgba(244, 244, 245, 0.08);
  --line-2: rgba(244, 244, 245, 0.16);
  --pink: #ff2ea4;
  --pink-hover: #ff5cb8;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 14px/1.5 "JetBrains Mono", ui-monospace, Consolas, monospace;
}
button, a.topup { font: inherit; cursor: pointer; }

/* Backdrop: a dim CRT screen, like jen2dfd.com's — a cool tone shift toward the bottom,
   fine scanlines, and darker edges */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(244, 244, 245, 0.028) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 120% 90% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(to bottom, #09090b 0%, #0b0d12 60%, #0e1219 100%);
}
.app { position: relative; }

/* Chalk pieces: the scattered magenta glyphs from jen2dfd.com's background */
.chalk { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.chalk span {
  position: absolute; color: var(--pink); font-weight: 500; line-height: 1;
  text-shadow: 0 0 3px rgba(255, 46, 164, 0.55); user-select: none;
}

/* Calm left column, board takes the rest */
.app {
  display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 48px;
  max-width: 1440px; min-height: 100vh; margin: 0 auto; padding: 32px;
}
.side { display: flex; flex-direction: column; gap: 40px; min-width: 0; }

.brand { display: flex; align-items: center; gap: 12px; }
.logo-coin { width: 32px; height: 32px; }
h1 { margin: 0; font-size: 20px; font-weight: 600; }
.mode { font-size: 12px; color: var(--muted); }

.label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.value {
  display: inline-block; font-size: 44px; line-height: 1.05; font-weight: 500;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; transform-origin: left center;
}
.value.bump { animation: bump 240ms var(--ease); }
@keyframes bump { 40% { transform: scale(1.04); } }

.wallet { display: flex; flex-direction: column; gap: 16px; }
.taken { padding-top: 24px; border-top: 1px solid var(--line); }
.taken .value { font-size: 64px; color: var(--pink); letter-spacing: -0.03em; }

/* Buttons */
.topup, .drop, .quiet {
  display: flex; align-items: center; justify-content: center; border: 0; border-radius: 0;
  text-decoration: none; font-weight: 500; line-height: 1;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease), transform 100ms var(--ease), opacity 150ms var(--ease);
}
.topup { height: 48px; padding: 0 20px; background: var(--fg); color: var(--bg); font-size: 14px; font-weight: 600; }
.topup:hover { background: #ffffff; }
.drop { flex: 1; height: 56px; background: var(--pink); color: var(--bg); font-size: 16px; font-weight: 600; }
.drop:hover { background: var(--pink-hover); }
.quiet { height: 56px; padding: 0 16px; background: transparent; color: var(--fg-2); border: 1px solid var(--line-2); font-size: 14px; }
.quiet:hover { color: var(--fg); border-color: rgba(244, 244, 245, 0.32); }
.topup:active, .drop:active, .quiet:active { transform: scale(0.98); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
:focus-visible { outline: 1px solid var(--pink); outline-offset: 3px; }

/* Bet picker: a segmented track */
.controls { display: flex; flex-direction: column; gap: 8px; }
.bets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--raised); margin-bottom: 8px; }
.bets button {
  height: 36px; border: 0; border-radius: 0; background: transparent; color: var(--fg-2);
  font-weight: 500; font-variant-numeric: tabular-nums;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.bets button:hover { color: var(--fg); }
.bets button[aria-pressed="true"] { background: var(--raised-2); color: var(--fg); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.drop-row { display: flex; gap: 8px; }

/* Recent drops */
.history { min-height: 0; }
.history-head { display: flex; justify-content: space-between; align-items: baseline; }
.global { font-size: 12px; color: var(--muted); }
.global b { font-weight: 500; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.log { list-style: none; margin: 8px 0 0; padding: 0 12px 0 0; max-height: 320px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--raised-2) transparent; }
.log li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; height: 32px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--fg-2); font-variant-numeric: tabular-nums;
}
.log .m { color: var(--fg); }
.log li.big .m { color: var(--pink); }
.log li.topup-row .m { color: var(--fg); }
.log li.empty { color: var(--muted); }

/* The board */
.stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-width: 0; }
#board { display: block; width: 100%; max-width: 860px; height: min(calc(100vh - 112px), 900px); min-height: 480px; }
.rule { margin: 0; font-size: 12px; color: var(--muted); }

/* Dialog */
dialog {
  border: 1px solid var(--line-2); border-radius: 0; background: var(--raised); color: var(--fg);
  width: min(440px, calc(100vw - 32px)); padding: 28px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
dialog[open] { animation: rise 240ms var(--ease); }
dialog::backdrop { background: rgba(9, 9, 11, 0.8); }
dialog h2 { margin: 0 0 20px; font-size: 20px; font-weight: 600; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 12px; margin: 0 0 24px; color: var(--fg-2); }
.steps b { color: var(--fg); font-weight: 500; }
.code {
  display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 8px;
  font-size: 18px; font-weight: 500; letter-spacing: 0.04em; color: var(--fg);
  background: var(--bg); border: 1px dashed var(--line-2); border-radius: 0; padding: 12px 16px;
}
.code::after { content: "copy"; font-size: 12px; letter-spacing: 0; color: var(--muted); }
.code.copied::after { content: "copied"; color: var(--pink); }
.dialog-actions { display: flex; flex-direction: column; gap: 8px; }
.dialog-actions .quiet { height: 48px; }
.waiting { margin: 16px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* Broke */
.broke { position: fixed; inset: 0; background: rgba(9, 9, 11, 0.88); display: grid; place-items: center; padding: 16px; z-index: 5; }
.broke[hidden] { display: none; }
.broke-card { text-align: center; width: min(400px, 100%); animation: rise 300ms var(--ease); }
.broke-card h2 { margin: 0 0 8px; font-size: 44px; line-height: 1.05; font-weight: 600; letter-spacing: -0.02em; }
.cursor { color: var(--pink); }
.broke-card p { margin: 0 0 28px; color: var(--fg-2); }
.broke-card p b { color: var(--pink); font-weight: 500; }
.broke-card .topup { width: 100%; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 10; }

/* Phones: numbers, controls, board, then the log */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; gap: 32px; padding: 20px 16px 32px; }
  .side { display: contents; }
  .brand { order: 1; }
  .wallet { order: 2; }
  .controls { order: 3; }
  .stage { order: 4; }
  .history { order: 5; }
  #board { height: auto; aspect-ratio: 1 / 1.05; min-height: 0; }
  .value { font-size: 36px; }
  .taken .value { font-size: 52px; }
}
