:root {
  --rh-red: #ee0000;
  --rh-red-dark: #a60000;
  --rh-red-light: #f56e6e;
  --rh-red-lighter: #f9a8a8;
  --rh-red-lightest: #fef0f0;
  --rh-red-pale: #fce3e3;
  --rh-white: #ffffff;
  --rh-gray-10: #f2f2f2;
  --rh-gray-30: #c7c7c7;
  --rh-gray-50: #707070;
  --rh-gray-70: #383838;
  --rh-teal: #63bdbd;
  --rh-teal-light: #daf2f2;
  --rh-orange: #f5921b;
  --rh-orange-light: #ffe8cc;
  --rh-purple: #876fd4;
  --rh-purple-light: #ece6ff;
  --rh-yellow: #dca614;
  --rh-yellow-light: #fff4cc;
  --shadow: 0 12px 40px rgba(238, 0, 0, 0.12);
  --radius: 18px;
  --reel-item-height: 100px;
  --reel-cycle-duration: 0.5s;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Red Hat Text", "Segoe UI", sans-serif;
  color: var(--rh-gray-70);
  min-height: 100vh;
}

body:has(.vegas-floor) {
  background:
    radial-gradient(circle at 15% 10%, rgba(238, 0, 0, 0.35), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(135, 111, 212, 0.4), transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(245, 146, 27, 0.2), transparent 35%),
    linear-gradient(180deg, #120818 0%, #1f0d2e 35%, #2a1038 70%, #120818 100%);
}

.vegas-floor {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem 3rem;
  position: relative;
  overflow-x: hidden;
}

.vegas-floor::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.25;
  pointer-events: none;
}

.slot-cabinet {
  position: relative;
  width: min(100%, 760px);
  z-index: 1;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.55));
}

.slot-cabinet__top {
  padding: 0.85rem 1rem 0.35rem;
  border-radius: 28px 28px 0 0;
  background: linear-gradient(180deg, #5a5a62 0%, #2f2f36 55%, #1d1d22 100%);
  border: 4px solid #c9a227;
  border-bottom: none;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 0 24px rgba(238, 0, 0, 0.35);
}

.slot-cabinet__bulb-row {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.slot-cabinet__bulb-row--reverse .slot-cabinet__bulb {
  animation-direction: reverse;
}

.slot-cabinet__bulb {
  flex: 1;
  max-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6b0, var(--rh-yellow) 45%, #9a6d00 100%);
  box-shadow: 0 0 10px rgba(255, 220, 80, 0.85);
  animation: bulb-chase 1.2s linear infinite;
}

.slot-cabinet__bulb:nth-child(odd) {
  background: radial-gradient(circle at 35% 30%, #ffd0d0, var(--rh-red) 50%, #7a0000 100%);
  box-shadow: 0 0 10px rgba(255, 60, 60, 0.85);
  animation-delay: 0.15s;
}

@keyframes bulb-chase {
  0%, 100% { opacity: 0.35; transform: scale(0.88); }
  50% { opacity: 1; transform: scale(1); }
}

.slot-cabinet__sign {
  text-align: center;
  padding: 0.35rem 0 0.55rem;
}

.slot-cabinet__sign-glow {
  display: inline-block;
  font-size: clamp(1.6rem, 4.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff4cc;
  text-shadow:
    0 0 8px #ff5555,
    0 0 18px #ee0000,
    0 0 32px rgba(238, 0, 0, 0.85),
    0 0 48px rgba(135, 111, 212, 0.55);
  animation: neon-pulse 2.2s ease-in-out infinite;
}

@keyframes neon-pulse {
  0%, 100% { opacity: 0.92; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.15); }
}

.slot-cabinet__body {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  background: linear-gradient(90deg, #1a1a20, #3b3b44 12%, #555560 50%, #3b3b44 88%, #1a1a20);
  border-left: 4px solid #c9a227;
  border-right: 4px solid #c9a227;
  padding: 0.35rem 0;
}

.slot-cabinet__side {
  background: linear-gradient(180deg, #6a6a74, #2a2a30 45%, #1a1a1f);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
}

.slot-cabinet__base {
  height: 42px;
  border-radius: 0 0 22px 22px;
  background: linear-gradient(180deg, #3a3a42, #141418);
  border: 4px solid #c9a227;
  border-top: 2px solid #8a7018;
  box-shadow: inset 0 8px 16px rgba(0, 0, 0, 0.45);
  position: relative;
}

.slot-cabinet__coin-tray {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 42%;
  height: 18px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(180deg, #0a0a0c, #222228);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.8);
}

.machine {
  width: 100%;
  background:
    linear-gradient(180deg, #fff5f5 0%, #ffffff 18%, #fff0f0 100%);
  border-left: 3px solid #b8860b;
  border-right: 3px solid #b8860b;
  padding: 1.1rem 1rem 1.25rem;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.65),
    inset 0 -12px 24px rgba(238, 0, 0, 0.08);
}

.machine__top {
  text-align: center;
  margin-bottom: 1rem;
}

.machine__marquee {
  display: inline-block;
  margin-bottom: 0.65rem;
  padding: 0.35rem 1.25rem;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0.28em;
  font-size: 0.82rem;
  color: #fff4cc;
  background: linear-gradient(180deg, #3f0000, #a60000);
  border: 2px solid #f5c542;
  box-shadow:
    0 0 12px rgba(238, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  animation: neon-pulse 1.8s ease-in-out infinite;
}

.machine__lights {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.machine__lights span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--rh-yellow);
  box-shadow: 0 0 10px rgba(220, 166, 20, 0.55);
  animation: blink 1.4s infinite ease-in-out;
}

.machine__lights span:nth-child(2) { animation-delay: 0.2s; background: var(--rh-teal); }
.machine__lights span:nth-child(3) { animation-delay: 0.4s; background: var(--rh-red); }
.machine__lights span:nth-child(4) { animation-delay: 0.6s; background: var(--rh-purple); }
.machine__lights span:nth-child(5) { animation-delay: 0.8s; background: var(--rh-orange); }

@keyframes blink {
  0%, 100% { opacity: 0.45; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1); }
}

.machine__window {
  position: relative;
  background: linear-gradient(180deg, #1a1020, #2d1838);
  border: 5px solid #d4af37;
  border-radius: 14px;
  padding: 1rem;
  box-shadow:
    inset 0 0 24px rgba(0, 0, 0, 0.65),
    0 0 18px rgba(238, 0, 0, 0.35);
}

.reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.65rem;
}

.reel-slot {
  padding: 3px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--rh-orange), var(--rh-red-dark));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.reel {
  position: relative;
  height: var(--reel-item-height);
  overflow: hidden;
  border-radius: 13px;
  background: linear-gradient(180deg, #fff8f8 0%, var(--rh-white) 45%, #fff8f8 100%);
  border: 2px solid var(--rh-red-lighter);
}

.reel::before,
.reel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 22px;
  z-index: 2;
  pointer-events: none;
}

.reel::before {
  top: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
}

.reel::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
}

.reel__strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.reel__strip--idle {
  transform: translate3d(0, 0, 0);
}

.reel__strip--cycle {
  animation: reel-cycle var(--reel-cycle-duration) linear infinite;
}

@keyframes reel-cycle {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, calc(-1 * var(--reel-item-height) * 8), 0); }
}

.reel__symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--reel-item-height);
  flex-shrink: 0;
  padding: 0.35rem;
}

.reel__symbol svg {
  display: block;
  width: calc(var(--reel-item-height) - 1.25rem);
  height: calc(var(--reel-item-height) - 1.25rem);
  max-width: 90%;
  max-height: 90%;
}

.symbol-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  color: var(--rh-red-dark);
  text-transform: uppercase;
}

.reels__payline {
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(238, 0, 0, 0.35);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
  pointer-events: none;
  z-index: 3;
}

.machine__controls {
  margin-top: 1.25rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.6rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  color: var(--rh-white);
  background: linear-gradient(180deg, var(--rh-red), var(--rh-red-dark));
  box-shadow:
    0 8px 20px rgba(238, 0, 0, 0.45),
    0 0 16px rgba(238, 0, 0, 0.35);
}

.btn--primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 24px rgba(238, 0, 0, 0.55),
    0 0 22px rgba(238, 0, 0, 0.45);
}

.btn--lever {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-width: 220px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn__lever-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2b0, #d4af37 55%, #8a7018 100%);
  box-shadow: 0 0 8px rgba(255, 220, 100, 0.8);
}

.btn--ghost {
  color: var(--rh-red-dark);
  background: var(--rh-white);
  border: 2px solid var(--rh-red-lighter);
}

.player-form {
  display: grid;
  gap: 0.9rem;
  padding: 1.1rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fff5f5);
  border: 2px solid #d4af37;
  box-shadow: inset 0 0 0 1px rgba(238, 0, 0, 0.15);
}

.player-form__title {
  margin: 0;
  text-align: center;
  color: var(--rh-red-dark);
  font-size: 1.15rem;
}

.player-form__subtitle {
  margin: 0;
  text-align: center;
  color: var(--rh-gray-50);
  font-size: 0.92rem;
}

.player-form__fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.player-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}

.player-form input {
  border: 2px solid var(--rh-gray-30);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  width: 100%;
  min-height: 44px;
}

.player-form input:focus {
  outline: 2px solid var(--rh-red-lighter);
  border-color: var(--rh-red);
}

.form-error {
  margin: 0;
  color: var(--rh-red-dark);
  font-size: 0.92rem;
}

.result-banner {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 30;
  width: min(100% - 2rem, 520px);
}

.result-banner[hidden] {
  display: none;
}

.result-banner__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: var(--rh-white);
  border: 3px solid var(--rh-red);
  box-shadow: var(--shadow);
}

.result-banner.winner .result-banner__content {
  background: linear-gradient(90deg, var(--rh-yellow-light), var(--rh-orange-light));
  border-color: var(--rh-orange);
}

.result-banner.winner #result-message {
  font-weight: 700;
  color: var(--rh-red-dark);
}

body:has(.admin-page) {
  background:
    radial-gradient(circle at 15% 10%, rgba(238, 0, 0, 0.2), transparent 28%),
    linear-gradient(180deg, #f8f8f8 0%, #ffffff 50%, var(--rh-red-lightest) 100%);
}

.admin-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.admin-page--wide {
  display: block;
  max-width: 1100px;
  margin: 0 auto;
}

.admin-card,
.admin-header,
.stats-grid,
.admin-table-wrap {
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--rh-red-pale);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-card {
  width: min(100%, 420px);
  padding: 1.5rem;
}

.admin-card__subtitle,
.admin-header p {
  color: var(--rh-gray-50);
}

.admin-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--rh-red);
  text-decoration: none;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.admin-header__actions {
  display: flex;
  gap: 0.65rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: transparent;
  border: none;
  box-shadow: none;
}

.stat-card {
  background: var(--rh-white);
  border: 2px solid var(--rh-red-pale);
  border-radius: 16px;
  padding: 1rem;
}

.stat-card--golf { border-color: var(--rh-teal); background: var(--rh-teal-light); }
.stat-card--hat { border-color: var(--rh-red-light); background: var(--rh-red-pale); }

.stat-card h2 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--rh-gray-50);
}

.stat-card__value {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--rh-red-dark);
}

.stat-card__meta {
  margin: 0.35rem 0 0;
  color: var(--rh-gray-50);
}

.admin-table-wrap {
  padding: 1rem 1.25rem 1.25rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.admin-table th,
.admin-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--rh-gray-10);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--rh-gray-50);
  font-weight: 700;
}

.row-winner {
  background: var(--rh-yellow-light);
}

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.alert--error {
  background: var(--rh-red-pale);
  color: var(--rh-red-dark);
  border: 1px solid var(--rh-red-light);
}

/* Tablet */
@media (max-width: 1024px) {
  .vegas-floor {
    padding: 1.5rem 0.85rem 2.5rem;
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  }

  .slot-cabinet {
    width: min(100%, 680px);
  }

  .machine {
    padding: 0.95rem 0.75rem 1rem;
  }

  .machine__window {
    padding: 0.75rem;
  }

  .player-form__fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .player-form__fields label:last-child {
    grid-column: 1 / -1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Large phone / small tablet */
@media (max-width: 768px) {
  :root {
    --reel-item-height: 88px;
  }

  .slot-cabinet__sign-glow {
    letter-spacing: 0.08em;
    font-size: clamp(1.35rem, 5vw, 2rem);
  }

  .slot-cabinet__top {
    padding: 0.65rem 0.65rem 0.3rem;
    border-radius: 22px 22px 0 0;
  }

  .reels {
    gap: 0.45rem;
  }

  .machine__marquee {
    letter-spacing: 0.18em;
    font-size: 0.75rem;
    padding: 0.3rem 0.9rem;
  }

  .btn--lever {
    width: 100%;
    min-height: 48px;
  }

  .result-banner {
    bottom: max(1rem, env(safe-area-inset-bottom));
    width: min(100% - 1rem, 520px);
  }

  .result-banner__content {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table {
    min-width: 640px;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .vegas-floor {
    padding: 1rem 0.5rem 1.75rem;
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
    align-items: flex-start;
    padding-top: max(1rem, env(safe-area-inset-top));
  }

  .slot-cabinet {
    filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.5));
  }

  .slot-cabinet__body {
    grid-template-columns: 10px 1fr 10px;
  }

  .slot-cabinet__bulb-row {
    gap: 0.2rem;
    margin-bottom: 0.4rem;
  }

  .slot-cabinet__bulb {
    max-width: 11px;
    height: 11px;
  }

  .slot-cabinet__base {
    height: 34px;
    border-radius: 0 0 16px 16px;
  }

  :root {
    --reel-item-height: 76px;
  }

  .reels {
    gap: 0.3rem;
  }

  .reel-slot {
    padding: 2px;
    border-radius: 12px;
  }

  .reel {
    border-radius: 10px;
  }

  .reel::before,
  .reel::after {
    height: 16px;
  }

  .machine__window {
    border-width: 4px;
    padding: 0.55rem;
    border-radius: 12px;
  }

  .reels__payline {
    left: 0.55rem;
    right: 0.55rem;
  }

  .machine__lights span {
    width: 11px;
    height: 11px;
  }

  .player-form {
    padding: 0.85rem;
  }

  .player-form__fields {
    grid-template-columns: 1fr;
  }

  .player-form__fields label:last-child {
    grid-column: auto;
  }

  .player-form input {
    font-size: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Small mobile */
@media (max-width: 380px) {
  :root {
    --reel-item-height: 64px;
  }

  .slot-cabinet__sign-glow {
    letter-spacing: 0.04em;
    font-size: 1.2rem;
  }

  .slot-cabinet__bulb {
    max-width: 9px;
    height: 9px;
  }

  .reels {
    gap: 0.2rem;
  }

  .machine__marquee {
    letter-spacing: 0.12em;
    font-size: 0.68rem;
  }

  .btn {
    font-size: 0.92rem;
    padding: 0.85rem 1.1rem;
  }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .vegas-floor {
    place-items: start center;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .slot-cabinet__top {
    padding-top: 0.45rem;
    padding-bottom: 0.2rem;
  }

  .slot-cabinet__bulb-row--reverse {
    display: none;
  }

  :root {
    --reel-item-height: 64px;
  }

  .machine__top {
    margin-bottom: 0.5rem;
  }

  .machine__lights {
    margin-bottom: 0.35rem;
  }
}
