/* LUCKY CLAW — neon coin-op chrome */
:root {
  --neon-pink: #ff4fc3;
  --neon-cyan: #4fd8ff;
  --neon-gold: #ffd95e;
  --neon-green: #7dff9e;
  --cab-deep: #170c2c;
  --cab-mid: #241040;
  --cab-edge: #4a2a72;
  --led-on: #ffb340;
  --led-red: #ff5a4e;
  --deck-metal: #2a1650;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background:
    radial-gradient(1200px 700px at 50% -10%, #2c1650 0%, #150b28 55%, #0a0518 100%);
  color: #e8ddf8;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  justify-content: center;
  padding: 14px 10px 40px;
}

#cabinet {
  width: min(780px, 100%);
  display: flex;
  flex-direction: column;
  filter: drop-shadow(0 18px 50px rgba(80, 20, 140, 0.45));
}

#game {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 22px 22px 0 0;
  touch-action: none;
}

/* ---------- control deck ---------- */
#deck {
  position: relative;
  background:
    linear-gradient(180deg, #3a1e66 0%, #241040 38%, #180c30 100%);
  border: 3px solid var(--cab-edge);
  border-top: none;
  border-radius: 0 0 18px 18px;
  padding: 10px 14px 12px;
  box-shadow: inset 0 2px 0 rgba(190, 140, 255, 0.25), inset 0 -14px 30px rgba(0,0,0,0.5);
}
#deck::before { /* neon seam joining deck to case */
  content: "";
  position: absolute; left: 4%; right: 4%; top: -3px;
  height: 4px; border-radius: 4px;
  background: var(--neon-cyan);
  box-shadow: 0 0 14px var(--neon-cyan), 0 0 30px rgba(79,216,255,.5);
}
#deck.playing::before { background: var(--neon-gold); box-shadow: 0 0 16px var(--neon-gold); }

#ledRow {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 10px;
}

.led-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }

.led {
  min-width: 64px;
  padding: 4px 8px;
  text-align: center;
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--led-on);
  background: #0d0716;
  border: 2px solid #372055;
  border-radius: 8px;
  text-shadow: 0 0 8px rgba(255, 179, 64, .9), 0 0 18px rgba(255, 179, 64, .5);
  box-shadow: inset 0 0 14px rgba(0,0,0,.8);
}
.led.urgent { color: var(--led-red); text-shadow: 0 0 10px rgba(255,90,78,.95), 0 0 22px rgba(255,90,78,.55); animation: ledBlink .45s steps(2) infinite; }
.led.pop { animation: ledPop .3s ease-out; }
@keyframes ledBlink { 50% { opacity: .35; } }
@keyframes ledPop { 40% { transform: scale(1.18); } }
.led-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: #b9a2e0;
  font-weight: 700;
}

#msg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 10px;
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1.5px;
  color: #8ef2ff;
  text-shadow: 0 0 10px rgba(79,216,255,.7);
  background: #0d0716;
  border: 2px solid #372055;
  border-radius: 8px;
  box-shadow: inset 0 0 14px rgba(0,0,0,.8);
  min-height: 44px;
}
#msg.tick { animation: msgIn .25s ease-out; }
@keyframes msgIn { from { opacity: .2; } }

/* ---------- controls row ---------- */
#controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#joystick {
  position: relative;
  width: 118px; height: 118px;
  flex: 0 0 auto;
  touch-action: none;
  cursor: grab;
  border-radius: 50%;
}
#joystick:active { cursor: grabbing; }
#joyBase {
  position: absolute; inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 32%, #4a2a80 0%, #2a1650 62%, #180c30 100%);
  border: 3px solid #5a3a92;
  box-shadow: inset 0 -8px 18px rgba(0,0,0,.6), 0 4px 14px rgba(0,0,0,.5),
    0 0 18px rgba(79,216,255,.18);
}
#joyBase::after { /* gate cross */
  content: ""; position: absolute; inset: 16%;
  border-radius: 50%;
  background:
    linear-gradient(#0000 46%, rgba(0,0,0,.5) 46%, rgba(0,0,0,.5) 54%, #0000 54%),
    linear-gradient(90deg, #0000 46%, rgba(0,0,0,.5) 46%, rgba(0,0,0,.5) 54%, #0000 54%);
}
#joyStick {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  transition: transform .05s linear;
}
#joyStick::before { /* stick shaft */
  content: ""; position: absolute;
  left: -5px; top: -46px;
  width: 10px; height: 46px;
  border-radius: 6px;
  background: linear-gradient(90deg, #8f97b4, #d6dbe8 45%, #6a7190);
  box-shadow: 0 2px 6px rgba(0,0,0,.6);
}
#joyBall {
  position: absolute;
  left: -21px; top: -66px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9ecb 0%, #ff4fc3 45%, #a0106e 100%);
  box-shadow: 0 4px 10px rgba(0,0,0,.55), 0 0 16px rgba(255,79,195,.45),
    inset 0 -6px 10px rgba(0,0,0,.35);
}

#dropBtn {
  position: relative;
  flex: 0 0 auto;
  width: 132px; height: 132px;
  border-radius: 50%;
  border: 4px solid #6b1f2e;
  background: radial-gradient(circle at 50% 38%, #4a1522 0%, #300d18 70%);
  color: #ffd4d4;
  font-family: inherit;
  font-weight: 900;
  font-size: 19px;
  letter-spacing: 2px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 6px 16px rgba(0,0,0,.55);
}
#dropBtn .cap {
  position: absolute; inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #ff8f8f 0%, #e83a4e 48%, #8f1428 100%);
  box-shadow: inset 0 -10px 18px rgba(60,0,10,.6), inset 0 6px 10px rgba(255,255,255,.25);
  z-index: 0;
}
#dropBtn { isolation: isolate; }
#dropBtn::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; z-index: -1; }
#dropBtn > .cap { pointer-events: none; }
#dropBtn { font-size: 0; } /* label lives on the cap */
#dropBtn .cap::after {
  content: "DROP";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; letter-spacing: 2px;
  color: #fff0f0; text-shadow: 0 2px 4px rgba(80,0,15,.8);
}
#dropBtn.armed .cap {
  animation: armPulse 1s ease-in-out infinite;
}
@keyframes armPulse {
  0%, 100% { box-shadow: inset 0 -10px 18px rgba(60,0,10,.6), inset 0 6px 10px rgba(255,255,255,.25), 0 0 8px rgba(255,80,100,.4); }
  50% { box-shadow: inset 0 -10px 18px rgba(60,0,10,.6), inset 0 6px 10px rgba(255,255,255,.25), 0 0 30px rgba(255,80,100,.95); }
}
#dropBtn:active .cap { transform: scale(.94); }

#sideCol {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
  width: 132px;
}
#coinBtn, #muteBtn {
  font-family: inherit;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffe9c4;
  border-radius: 12px;
  border: 2px solid #6b4c9e;
  background: linear-gradient(180deg, #3a2166, #221040);
  cursor: pointer;
  padding: 10px 8px;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,.5), inset 0 1px 0 rgba(200,160,255,.3);
  touch-action: manipulation;
}
#coinBtn .slot {
  width: 6px; height: 22px; border-radius: 3px;
  background: #0b0616;
  border: 1px solid #8a6fb0;
  box-shadow: inset 0 0 4px #000, 0 0 6px rgba(255,217,94,.4);
}
#coinBtn { color: #ffd95e; }
#coinBtn.nudge { animation: nudgeX .4s ease-in-out; }
@keyframes nudgeX { 20%,60% { transform: translateX(-4px); } 40%,80% { transform: translateX(4px); } }
#coinBtn.ate .slot { animation: coinEat .6s ease-out; }
@keyframes coinEat {
  0% { box-shadow: inset 0 0 4px #000, 0 0 6px rgba(255,217,94,.4); }
  30% { box-shadow: inset 0 0 8px #ffd95e, 0 0 22px rgba(255,217,94,.95); background: #ffd95e; }
  100% { box-shadow: inset 0 0 4px #000, 0 0 6px rgba(255,217,94,.4); }
}
#coinBtn:active, #muteBtn:active { transform: translateY(1px); }

#muteBtn .spk {
  width: 14px; height: 14px;
  position: relative;
  display: inline-block;
  background: #8ef2ff;
  clip-path: polygon(0 35%, 35% 35%, 70% 5%, 70% 95%, 35% 65%, 0 65%);
}
#muteBtn::after {
  content: "";
  width: 12px; height: 12px;
  border: 2px solid #8ef2ff;
  border-left: none; border-bottom-color: transparent; border-top-color: transparent;
  border-radius: 0 12px 12px 0;
  margin-left: -6px;
}
#muteBtn.off { opacity: .55; }
#muteBtn.off::after { display: none; }
#muteBtn.off .spk { background: #889; }

#hint {
  margin-top: 10px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 2px;
  color: #8f79bd;
  font-weight: 700;
}

/* ---------- collection shelf ---------- */
#collectionWrap {
  margin-top: 14px;
  background: linear-gradient(180deg, #22103e, #150a26);
  border: 2px solid var(--cab-edge);
  border-radius: 14px;
  padding: 8px 12px 12px;
  box-shadow: inset 0 0 24px rgba(0,0,0,.55);
}
#collectionWrap h2 {
  font-size: 11px;
  letter-spacing: 4px;
  color: #b9a2e0;
  text-align: center;
  margin-bottom: 8px;
}
#collection {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 46px;
  align-items: center;
}
#collection .empty {
  color: #6d5a96;
  font-size: 12px;
  letter-spacing: 1px;
  font-style: italic;
}
.collect {
  display: flex; flex-direction: column; align-items: center;
  width: 64px;
  padding: 3px 2px 5px;
  border-radius: 10px;
  background: #0d0718;
  border: 1px solid #372055;
  animation: collectIn .45s cubic-bezier(.2,1.6,.4,1);
}
.collect canvas { width: 44px; height: 44px; }
.collect span {
  font-size: 8px; letter-spacing: .5px; color: #cbb8ee;
  text-align: center; line-height: 1.15;
}
.collect.rarity1 { border-color: #4fd8ff66; box-shadow: 0 0 8px rgba(79,216,255,.25); }
.collect.rarity2 { border-color: #ffd95e88; box-shadow: 0 0 12px rgba(255,217,94,.4); }
@keyframes collectIn { from { transform: scale(.2) rotate(-14deg); opacity: 0; } }

/* ---------- big outcome banner ---------- */
#banner {
  position: fixed;
  left: 50%; top: 34%;
  transform: translate(-50%, -50%) scale(.6);
  font-weight: 900;
  font-size: clamp(34px, 9vw, 74px);
  letter-spacing: 4px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  z-index: 30;
  -webkit-text-stroke: 2px rgba(20,5,30,.8);
}
#banner.show {
  animation: bannerIn 1.5s cubic-bezier(.2,1.4,.3,1) forwards;
}
#banner.win   { color: var(--neon-gold); text-shadow: 0 0 30px rgba(255,217,94,.9), 0 4px 0 #7a4a00; }
#banner.lucky { color: var(--neon-green); text-shadow: 0 0 30px rgba(125,255,158,.9), 0 4px 0 #0a5e28; }
#banner.miss  { color: #ff8a9e; text-shadow: 0 0 26px rgba(255,90,110,.8), 0 4px 0 #5e0a1e; }
#banner.warn  { color: var(--neon-cyan); text-shadow: 0 0 26px rgba(79,216,255,.8), 0 4px 0 #0a3e5e; }
#banner.info  { color: #d9c6ff; text-shadow: 0 0 24px rgba(160,120,255,.8), 0 4px 0 #2a1650; }
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.5) rotate(-4deg); }
  14% { opacity: 1; transform: translate(-50%,-50%) scale(1.08) rotate(1deg); }
  22% { transform: translate(-50%,-50%) scale(1); }
  78% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-56%) scale(.96); }
}

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  body { padding: 8px 6px 26px; }
  #ledRow { flex-wrap: wrap; gap: 6px; }
  #msg { order: 4; flex-basis: 100%; min-height: 38px; font-size: 12px; }
  .led { min-width: 54px; font-size: 21px; }
  .led-wrap { flex: 1; }
  #controls { gap: 8px; }
  #joystick { width: 100px; height: 100px; }
  #joyBall { left: -18px; top: -56px; width: 36px; height: 36px; }
  #joyStick::before { top: -40px; height: 40px; }
  #dropBtn { width: 108px; height: 108px; }
  #dropBtn .cap::after { font-size: 16px; }
  #sideCol { width: 106px; }
  #coinBtn, #muteBtn { font-size: 10px; padding: 9px 4px; }
  #hint { font-size: 8.5px; letter-spacing: 1.2px; }
}
@media (max-width: 380px) {
  #joystick { width: 88px; height: 88px; }
  #dropBtn { width: 96px; height: 96px; }
  #sideCol { width: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  #dropBtn.armed .cap, .led.urgent { animation: none; }
  #banner.show { animation-duration: .6s; }
}
