/* Spamle slot machine: a compact, bright pixel cabinet standing in the meadow. */
.slot-stage {
  --ink: #2a1f3d;
  --cab: #ff5a5f;
  --cab-hi: #ff8c80;
  --cab-lo: #e13f4f;
  --cab-dk: #b02a3f;
  --gold: #ffd23f;
  --gold-hi: #fff1a8;
  --gold-lo: #e8a317;
  --lcd: #2b2545;
  --mint: #7dffc8;
  --chrome: #eef1f7;
  --chrome-lo: #c3cad9;
  --paper: #fffaf0;
}

.slot-stage .btn { white-space: normal; }
.slot-stage :focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- cabinet ---------- */
.slot-wrap {
  --lever: 40px;
  position: relative;
  width: 100%;
  max-width: calc(420px + var(--lever));
  margin: 0 auto;
  padding-right: calc(var(--lever) - 6px);
  filter: drop-shadow(0 6px 0 rgba(42, 31, 61, .22));
}
.slot-wrap:has(.slot-results) { max-width: calc(560px + var(--lever)); }

.slot-cabinet {
  position: relative;
  z-index: 1;
  padding: 0 12px 12px;
  border: 4px solid var(--ink);
  border-radius: 16px 16px 10px 10px;
  background: var(--cab);
  box-shadow: inset 6px 0 0 var(--cab-hi), inset -6px 0 0 var(--cab-lo), inset 0 -6px 0 var(--cab-dk);
  color: var(--ink);
}
.slot-cabinet::after {
  content: '';
  display: block;
  height: 10px;
  margin: 12px 22% 0;
  border: 3px solid var(--ink);
  border-radius: 2px 2px 8px 8px;
  background: var(--cab-dk);
  box-shadow: inset 0 3px 0 #7d1d30;
}

/* marquee with chasing bulbs */
.slot-marquee {
  position: relative;
  margin: 0 -12px 10px;
  padding: 15px 16px;
  border-bottom: 4px solid var(--ink);
  border-radius: 12px 12px 0 0;
  background: var(--gold);
  box-shadow: inset 0 4px 0 var(--gold-hi), inset 0 -4px 0 var(--gold-lo);
}
.slot-marquee::before,
.slot-marquee::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  height: 5px;
  background: repeating-linear-gradient(90deg, #fff 0 5px, transparent 5px 10px, #ff5a5f 10px 15px, transparent 15px 20px);
  animation: slot-bulbs .9s steps(1, end) infinite;
}
.slot-marquee::before { top: 4px; }
.slot-marquee::after { bottom: 5px; animation-direction: reverse; }
@keyframes slot-bulbs { 50% { background-position: 10px 0; } }

.slot-sign {
  display: grid;
  place-items: center;
  min-height: 52px;
  padding: 6px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: inset 0 -4px 0 #f1e3c4;
  text-align: center;
}
.slot-sign h2 {
  margin: 0;
  font: 700 clamp(19px, 4.6vw, 27px)/1.02 var(--font-pixel);
  letter-spacing: .01em;
  overflow-wrap: anywhere;
  color: var(--ink);
}

/* LCD meter */
.slot-meter {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--lcd);
  color: #fff6dc;
  font: 400 16px/1 var(--font-pixel);
  font-variant-numeric: tabular-nums;
  text-align: center;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, .25);
}
.slot-meter > * {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 38px;
  padding: 4px 6px;
}
.slot-meter > * + * { border-left: 2px dashed #4b4270; }
.slot-meter-round { color: #c9c2ea; }
.slot-clock { border: 0; background: transparent; color: var(--mint); font: inherit; min-width: 74px; }
.slot-clock b, .slot-score b { font-size: 26px; font-weight: 400; }
.slot-clock span { font-size: 12px; }
.slot-clock.think { color: #c9a7ff; cursor: pointer; }
.slot-clock.think:hover { background: #3a3260; }
.slot-clock.low { color: #ff8f9a; }
.slot-score b { color: var(--gold); }

.slot-track {
  height: 10px;
  margin: 6px 0 10px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 4px;
  background: #7d1d30;
}
.slot-clock-fill {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--mint) 0 6px, #4fe0a6 6px 8px);
  transform-origin: left;
}

/* reels */
.slot-reels {
  --reel-height: clamp(82px, 21vw, 100px);
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 4px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  box-shadow: inset 0 0 0 3px var(--gold);
}
.slot-reels::before,
.slot-reels::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 9px;
  height: 14px;
  margin-top: -7px;
  background: var(--gold);
  z-index: 2;
}
.slot-reels::before { left: -9px; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.slot-reels::after { right: -9px; clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.slot-reels[data-tone='rare'] { box-shadow: inset 0 0 0 3px #fff07a; }
.slot-reels[data-tone='wrong'] { box-shadow: inset 0 0 0 3px #ff8f9a; }
.slot-miss { animation: slot-miss .32s steps(2, end); }
@keyframes slot-miss { 25% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }

.slot-window { position: relative; min-width: 0; border-radius: 4px; overflow: hidden; outline: 3px solid transparent; outline-offset: -3px; }
.slot-viewport {
  height: var(--reel-height);
  overflow: hidden;
  background: linear-gradient(180deg, #c9d0e0 0 6px, #e7ebf3 6px 12px, #fff 12px calc(100% - 12px), #e7ebf3 calc(100% - 12px) calc(100% - 6px), #c9d0e0 calc(100% - 6px));
}
.slot-strip { height: 100%; display: grid; grid-auto-rows: 100%; }
.slot-rolling { animation: slot-roll .3s steps(6, end) forwards; }
.slot-window:nth-child(2) .slot-rolling { animation-duration: .38s; }
.slot-window:nth-child(3) .slot-rolling { animation-duration: .46s; }
@keyframes slot-roll { to { transform: translateY(-100%); } }

.slot-tile {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 4px;
  overflow: hidden;
  color: var(--ink);
  text-align: center;
  font: 700 clamp(13px, 3.2vw, 16px)/1 var(--font-pixel);
}
.slot-empty .slot-tile-name { font-size: clamp(34px, 8vw, 46px); color: var(--cab); text-shadow: 3px 3px 0 #ffd0cf; }
.slot-tile-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.slot-tile-points {
  padding: 2px 5px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--gold);
  font-size: 12px;
  line-height: 1;
}

.slot-symbol { flex: none; width: 22px; aspect-ratio: 4 / 3; }
.slot-symbol[data-fruit] {
  width: 30px;
  background-image: url('/assets/slot-fruits-v1.png');
  background-repeat: no-repeat;
  background-size: 400% 100%;
  image-rendering: pixelated;
}
.slot-symbol[data-fruit='banana'] { background-position: 33.333% 0; }
.slot-symbol[data-fruit='fig'] { background-position: 66.667% 0; }
.slot-symbol[data-fruit='lychee'] { background-position: 100% 0; }
.slot-bolt {
  width: 16px;
  aspect-ratio: 3 / 4;
  background: var(--c, var(--gold-lo));
  clip-path: polygon(50% 0, 100% 0, 75% 37.5%, 100% 37.5%, 25% 100%, 37.5% 56%, 0 56%);
}
.slot-tile.t-common .slot-bolt { background: #9aa0b4; }

.slot-latest { outline-color: var(--gold); }
.slot-hit { animation: slot-hit .72s steps(1, end); }
.slot-duplicate { animation: slot-duplicate .55s steps(1, end); }
@keyframes slot-hit { 0%, 66% { outline-color: #7dffc8; } 33% { outline-color: var(--gold); } }
@keyframes slot-duplicate { 0%, 66% { outline-color: #ff9d3a; } 33% { outline-color: #ffe08a; } }
.slot-spark::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  right: 12%;
  top: 16%;
  background: #ffe14d;
  box-shadow: -22px -6px #ff9d3a, 15px -4px #ffe14d, -15px 18px #ff5a5f, 12px 20px #7dffc8;
  animation: slot-spark .6s steps(6, end) .3s both;
  pointer-events: none;
}
@keyframes slot-spark {
  from { opacity: 1; transform: scale(.6); }
  to { opacity: 0; transform: scale(1.35) translate(6px, -10px); }
}

/* ---------- deck: answer entry and lobby button ---------- */
.slot-deck { position: relative; margin-top: 10px; }
.slot-lobby-controls { display: grid; justify-items: center; }
.slot-lobby-controls .btn { width: 100%; }
.slot-entry {
  --send-width: 92px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--send-width);
  gap: 6px;
  margin: 0;
}
.slot-entry input {
  width: 100%;
  height: 48px;
  padding: 0 30px 0 12px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font: 600 18px/1 var(--font-pixel);
  box-shadow: inset 0 3px 0 #e9e3f2;
}
.slot-entry input::placeholder { color: #8d84a3; }
.slot-entry input:focus { box-shadow: inset 0 3px 0 #e9e3f2, 0 0 0 3px var(--mint); }
.slot-entry.ok input { background: #e9fff4; }
.slot-entry.dup input { background: #fff3dc; }
.slot-entry.bad input { background: #ffe6e6; animation: nudge .32s; }
.slot-entry .slot-light {
  position: absolute;
  top: 50%;
  right: calc(var(--send-width) + 16px);
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  background: #d9d3e6;
  transform: translateY(-50%);
  pointer-events: none;
}
.slot-entry.ok .slot-light { background: #2fd27f; }
.slot-entry.dup .slot-light { background: #ff9d3a; }
.slot-entry.bad .slot-light { background: #ff5a5f; }
.slot-submit {
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--gold);
  box-shadow: inset 0 -4px 0 var(--gold-lo), inset 0 3px 0 var(--gold-hi);
  color: var(--ink);
  font: 700 17px/1 var(--font-pixel);
}
.slot-submit:hover { background: #ffdf6a; }
.slot-submit:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 var(--gold-lo); }
.slot-submit:disabled { opacity: .6; }

.slot-feedback {
  min-height: 34px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--lcd);
  color: #e8e2ff;
  font: 400 16px/1.2 var(--font-pixel);
  text-align: center;
  overflow-wrap: anywhere;
}
.slot-feedback[data-tone='correct'] { color: var(--mint); }
.slot-feedback[data-tone='rare'] { color: var(--gold); }
.slot-feedback[data-tone='wrong'] { color: #ff9aa4; }
.slot-feedback[data-tone='duplicate'] { color: #ffbf76; }

/* ---------- lever ---------- */
.slot-lever {
  position: absolute;
  z-index: 0;
  top: 92px;
  right: 0;
  width: var(--lever);
  height: 95px;
  padding: 0;
  border: 0;
  background: transparent;
}
.slot-lever-art { display: block; width: 100%; height: 100%; overflow: visible; }
.slot-lever .lv-rod { transform-box: fill-box; transform-origin: bottom; transition: transform .12s steps(2, end); }
.slot-lever .lv-ball { transition: transform .12s steps(2, end); }
button.slot-lever:hover .lv-ball { filter: brightness(1.08); }
button.slot-lever:active .lv-rod { transform: scaleY(.4); }
button.slot-lever:active .lv-ball { transform: translateY(13px); }
button.slot-lever:disabled { cursor: default; }
.slot-locked { pointer-events: none; }

/* ---------- panels below the machine ---------- */
.slot-history,
.slot-details,
.stage .legend {
  max-width: 420px;
  margin: 14px auto 0;
}
.slot-history,
.slot-details {
  padding: 0 14px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 14px;
}
.slot-history summary,
.slot-details summary { padding: 9px 0; cursor: pointer; font: 600 15px/1.2 var(--font-pixel); }
.slot-details p { margin: 0 0 12px; color: var(--ink2); }
.slot-details .rounds { margin-top: 2px; }
.slot-history .chips { margin: 0 0 12px; }
.slot-history .chips:empty::before { content: 'Your answers appear here.'; }
.stage .legend {
  padding: 6px 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  font-size: 13px;
}
.stage-panel {
  margin: 18px auto 0;
  padding: 14px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}
.stage-panel-title { margin: 0 0 10px; text-align: center; font: 700 18px/1.2 var(--font-pixel); }
.slot-stage .picker button[hidden] { display: none; }

/* results print on a paper slip inside the cabinet */
.slot-results {
  margin-top: 12px;
  padding: 16px clamp(10px, 3vw, 18px);
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: inset 0 -4px 0 #f1e3c4;
}
.slot-results .row { gap: 10px; }
.slot-results td { overflow-wrap: anywhere; }

@media (max-width: 520px) {
  .slot-wrap { --lever: 34px; }
  .slot-lever { top: 84px; height: 80px; }
  .slot-cabinet { padding: 0 9px 10px; }
  .slot-marquee { margin: 0 -9px 8px; padding: 13px 10px; }
  .slot-reels { gap: 4px; padding: 5px; }
  .slot-results .meter-lbl { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .slot-marquee::before, .slot-marquee::after { animation: none; }
  .slot-hit, .slot-duplicate, .slot-miss, .slot-entry.bad input { animation: none; }
  .slot-spark::after { content: none; }
  .slot-rolling { animation: none; transform: translateY(-100%); }
}
