/* ============================================================
   AVASTHA — The Token Slot Machine ("the old way")
   Pixel-art cabinet (generated by assets/gen_sprites.py), scaled
   with image-rendering: pixelated. Layout: LED counters left,
   machine center (buttons mounted on the cabinet), spec right.
   ============================================================ */

:root {
  --red: #FF4438;
  --red-dim: rgba(255, 68, 56, 0.14);
  --led-glow: 0 0 14px rgba(62, 207, 142, 0.35);
  --px-out: #1A120C;
  --pixel-font: "Press Start 2P", var(--mono);
}

/* compact hero so machine + handle fit one window */
.p-hero { padding-top: 110px; padding-bottom: 30px; }
.p-hero h1 { margin-bottom: 16px; }

/* ---------------------------------------------------------- */
/* Layout: counters | machine | spec                           */
/* ---------------------------------------------------------- */

.casino-wrap {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 280px;
  gap: clamp(18px, 2.5vw, 32px);
  align-items: stretch;
}
@media (max-width: 1100px) {
  .casino-wrap { grid-template-columns: 1fr; }
}

/* LED counters, vertical on the left */
.counter-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: center;
}
@media (max-width: 1100px) {
  .counter-col { flex-direction: row; justify-content: center; }
  .counter-col .led { flex: 1; max-width: 220px; }
}
.led {
  background: var(--bg);
  border: 3px solid var(--px-out);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.06),
              inset 0 -4px 0 rgba(0, 0, 0, 0.45);
}
.led .led-label {
  display: block;
  font-family: var(--pixel-font);
  font-size: 8px;
  color: var(--ink-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.led .val {
  display: block;
  font-family: var(--pixel-font);
  font-size: 16px;
  color: var(--green);
  text-shadow: var(--led-glow);
  white-space: nowrap;
}
.led .val.bad {
  color: var(--red);
  text-shadow: 0 0 14px rgba(255, 68, 56, 0.4);
  animation: led-blink 0.8s steps(2) infinite;
}
@keyframes led-blink { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .led .val.bad { animation: none; } }

/* ---------------------------------------------------------- */
/* The machine                                                 */
/* ---------------------------------------------------------- */

.pixel-machine {
  position: relative;
  width: min(100%, 640px);
  margin: 0 auto;
  aspect-ratio: 112 / 140;
  container-type: inline-size;
}
.pixel-machine img {
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-select: none;
}
.pm-body {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.5));
}

/* handle: two-frame retro animation, pivot at the bracket bolt */
.pm-arm {
  position: absolute;
  left: 86.2%;
  width: 19.64%;
  display: block;
}
#armUp   { top: -2.5%; }
#armDown { top: 40.4%; display: none; }
.pixel-machine.pulled #armUp   { display: none; }
.pixel-machine.pulled #armDown { display: block; }

.lever-hit {
  position: absolute;
  left: 83%;
  top: -4%;
  width: 25%;
  height: 62%;
  cursor: pointer;
  outline: none;
}
.lever-hit:focus-visible { outline: 3px dashed var(--accent-bright); outline-offset: 4px; }

/* marquee text, centered on the gold arch */
.m-marquee {
  position: absolute;
  left: 10.7%;
  top: 4.3%;
  width: 78.6%;
  height: 8.6%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--pixel-font);
  font-size: 10px;
  font-size: clamp(7px, 2.4cqw, 16px);
  color: var(--px-out);
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* header plate under the marquee (sprite: x14 y26 w84 h10) */
.m-plate {
  position: absolute;
  left: 12.5%;
  top: 18.57%;
  width: 75%;
  height: 7.14%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 11px;
  font-size: clamp(8px, 2cqw, 15px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4A4238;
  pointer-events: none;
  white-space: nowrap;
}
.m-plate b { color: #B03A0E; font-weight: 600; }
.m-plate .nr { color: #B4261E; font-weight: 600; }

/* ---------------------------------------------------------- */
/* Screen overlay (sprite screen: x16 y44 w80 h56 of 112x140)  */
/* ---------------------------------------------------------- */

.m-screen {
  position: absolute;
  left: 14.29%;
  top: 31.43%;
  width: 71.43%;
  height: 40%;
  display: flex;
  flex-direction: column;
  gap: 3%;
  padding: 3.5% 3.5% 4%;
}

/* Claude-Code-style spinner line at the TOP of the screen */
.spin-status {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  font-size: clamp(8px, 2cqw, 15px);
  letter-spacing: 0.04em;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spin-status .star { color: var(--accent-bright); }
.spin-status .dim { color: var(--muted); }

/* white drum reels */
.reels {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4.5%;
  min-height: 0;
}
.reel {
  position: relative;
  background: #F7F3E8;
  border: 3px solid var(--px-out);
  border-radius: 10px;
  overflow: hidden;
  min-width: 0;
}
/* drum curvature: shaded top and bottom of each pane */
.reel::before, .reel::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 26%;
  z-index: 2;
  pointer-events: none;
}
.reel::before { top: 0; background: linear-gradient(rgba(26, 18, 12, 0.32), transparent); }
.reel::after  { bottom: 0; background: linear-gradient(transparent, rgba(26, 18, 12, 0.32)); }

.reel .sym {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--pixel-font);
  font-size: 20px;
  font-size: clamp(12px, 4.6cqw, 34px);
  color: #6B6558;
}
.reel .sym.win  { color: #17854E; }
.reel .sym.lose { color: #C2231A; }
.reel .sym.settled { animation: settle 0.3s cubic-bezier(0.2, 0.8, 0.3, 1.2); }
@keyframes settle {
  from { transform: translateY(-30%); }
  to   { transform: translateY(0); }
}

/* the spinning strip: 8 faces, seamless 2-face loop, motion blur */
.reel-strip {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 400%;
  display: none;
  flex-direction: column;
}
.reel-strip span {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--pixel-font);
  font-size: 20px;
  font-size: clamp(12px, 4.6cqw, 34px);
  border-bottom: 2px solid rgba(26, 18, 12, 0.15);
}
.reel-strip span:nth-child(odd)  { color: #17854E; }
.reel-strip span:nth-child(even) { color: #C2231A; }
.reel.spinning .reel-strip {
  display: flex;
  animation: drum 0.16s linear infinite;
  filter: blur(1.5px);
}
.reel.spinning .sym { opacity: 0; }
@keyframes drum { to { transform: translateY(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .reel.spinning .reel-strip { animation-duration: 0.5s; filter: none; }
  .reel .sym.settled { animation: none; }
}

/* ---------------------------------------------------------- */
/* Machine-mounted 3D buttons (sprite band: x12 y108 w88 h12)  */
/* ---------------------------------------------------------- */

.m-buttons {
  position: absolute;
  left: 10.71%;
  top: 77.14%;
  width: 78.57%;
  height: 8.57%;
  display: flex;
  gap: 3%;
  align-items: center;
  justify-content: center;
  padding: 0 2.5%;
}
.m-btn {
  font-family: var(--pixel-font);
  border: 3px solid var(--px-out);
  border-radius: 9px;
  cursor: pointer;
  height: 74%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0 3.5%;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.4),
              inset 0 -4px 0 rgba(0, 0, 0, 0.3),
              0 5px 0 var(--px-out);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.m-btn:active, .m-btn.pressed {
  transform: translateY(4px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25),
              inset 0 -2px 0 rgba(0, 0, 0, 0.3),
              0 1px 0 var(--px-out);
}
.m-btn[disabled] { opacity: 0.55; cursor: default; }
.m-btn.red {
  flex: 1;
  background: linear-gradient(#FF7A64, #C22B1C);
  color: #FFF3EE;
  font-size: 8px;
  font-size: clamp(5px, 1.35cqw, 10px);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
  letter-spacing: 0.08em;
}
.m-btn.cream {
  background: linear-gradient(#FFFDF6, #CFC7B4);
  color: var(--px-out);
  font-size: 8px;
  font-size: clamp(5px, 1.35cqw, 10px);
  letter-spacing: 0.08em;
  padding: 0 4%;
}
.m-btn.gold {
  aspect-ratio: 1.15 / 1;
  background: linear-gradient(#F7CB6A, #BB8A24);
  color: var(--px-out);
  font-size: 13px;
  font-size: clamp(8px, 2cqw, 16px);
}
.m-btn.gold.on {
  background: linear-gradient(#7FE8B4, #1F9E63);
  color: #06180F;
}

/* ---------------------------------------------------------- */
/* Pull log under the machine                                  */
/* ---------------------------------------------------------- */

.pull-log {
  margin: 26px auto 0;
  max-width: 640px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
  padding: 14px 16px;
  height: 150px; /* fixed: the log must never reflow the columns */
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.9;
  color: var(--muted);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-2) transparent;
}
.pull-log::-webkit-scrollbar { width: 8px; }
.pull-log::-webkit-scrollbar-thumb { background: var(--surface-2); }
.pull-log .l-cost { color: var(--ink-2); }
.pull-log .l-fail { color: var(--red); }
.pull-log .l-win { color: var(--green); }

/* ---------------------------------------------------------- */
/* Spec sheet (right column)                                   */
/* ---------------------------------------------------------- */

.spec-panel {
  border: 1px solid var(--line);
  background: var(--bg-raised);
  padding: 26px 24px;
  align-self: center;
}
.spec-panel .mono-label { display: block; margin-bottom: 6px; }
.spec-panel h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.5rem;
  margin-bottom: 18px;
}
.spec-list { list-style: none; display: flex; flex-direction: column; }
.spec-item {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
}
.spec-item .box {
  flex: none;
  width: 15px; height: 15px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--green);
  transform: translateY(2px);
}
.spec-item.done { color: var(--muted); text-decoration: line-through; }
.spec-item.done .box { border-color: rgba(62, 207, 142, 0.6); background: var(--green-dim); }
.spec-item.done .box::after { content: "✓"; }
.spec-progress {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.spec-progress b { color: var(--ink); }

/* ---------------------------------------------------------- */
/* Blowout overlay                                             */
/* ---------------------------------------------------------- */

.blowout {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 7, 6, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.blowout.on { display: flex; }
.blowout .b-inner { max-width: 760px; }
.blowout .b-status {
  font-family: var(--pixel-font);
  font-size: clamp(9px, 1.8vw, 13px);
  letter-spacing: 0.08em;
  color: var(--green);
  margin-bottom: 24px;
}
.blowout .b-total {
  font-family: var(--pixel-font);
  font-size: clamp(2.2rem, 9.5vw, 5.6rem);
  line-height: 1;
  color: var(--red);
  text-shadow: 0 0 40px rgba(255, 68, 56, 0.45);
  animation: shake 0.5s ease-in-out 2;
}
.blowout .b-total.good { color: var(--green); text-shadow: var(--led-glow); animation: none; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) { .blowout .b-total { animation: none; } }
.blowout .b-mult {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.6rem, 4.5vw, 2.6rem);
  color: var(--red);
  margin-top: 18px;
}
.blowout .b-mult.good { color: var(--green); }
.blowout .b-detail {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 18px;
}
.blowout .b-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  color: var(--ink);
  margin-top: 26px;
}
.blowout .b-ctas {
  margin-top: 34px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------- */
/* Below-machine thesis tie                                    */
/* ---------------------------------------------------------- */

.house-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  margin-bottom: clamp(48px, 7vh, 72px);
}
.house-cell {
  background: var(--bg-raised);
  padding: 22px 24px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-2);
}
.house-cell b { color: var(--accent-bright); font-weight: 600; }
