:root {
  color-scheme: dark;
  --bg: #050503;
  --ink: #f4e8d4;
  --muted: #d59a2f;
  --gold: #d99a21;
  --gold-2: #ffce58;
  --bronze: #6d3f10;
  --panel: rgba(12, 10, 7, 0.82);
  --panel-strong: rgba(20, 15, 8, 0.94);
  --line: rgba(255, 202, 82, 0.26);
  --danger: #ef4444;
  --radius: 8px;
  --wheel-size-desktop: 520px;
  --wheel-size-mobile: 430px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", "Roboto Condensed", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.28)),
    url("./assets/nuevo_fondo.png") center -110px / cover no-repeat,
    linear-gradient(180deg, #020201 0%, #060604 48%, #040b05 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 50% 82%, rgba(20, 84, 28, 0.42), transparent 26%),
    linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.32));
  mix-blend-mode: screen;
}

body::after {
  background-image:
    radial-gradient(#f8c34c 1px, transparent 1px),
    radial-gradient(#c77d13 1px, transparent 1px);
  background-position: 0 0, 20px 30px;
  background-size: 68px 74px, 96px 88px;
  opacity: 0.1;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-columns: 1fr 380px;
  gap: clamp(18px, 3vw, 42px);
  min-height: 100vh;
  padding: clamp(18px, 3vw, 42px);
}

.public-app .app-shell {
  grid-template-columns: 1fr;
}

.roulette-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  padding: clamp(16px, 3vh, 34px) 16px;
  overflow-x: hidden;
}

.hero-header {
  width: 100%;
  min-height: 128px;
  min-height: clamp(88px, 12vh, 128px);
  margin-bottom: 12px;
  margin-bottom: clamp(6px, 1.2vh, 12px);
  text-align: center;
  z-index: 2;
}

.hero-header h1,
.hero-header p {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.roulette-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 18px;
}

.roulette-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -32px;
  gap: 14px;
  margin-left: 0;
}

.admin-shell[aria-hidden="true"] {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.hero-panel {
  display: grid;
  align-content: start;
  justify-items: center;
  min-width: 0;
}

.admin-gate {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.admin-app:not(.is-locked) .admin-gate {
  display: none;
}

.gate-card {
  display: grid;
  gap: 14px;
  width: min(390px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-strong), rgba(8, 7, 5, 0.96));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  text-align: center;
}

.gate-card h1 {
  font-size: clamp(2.6rem, 12vw, 5rem);
}

.gate-card label {
  display: grid;
  gap: 6px;
  color: #e9b243;
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  text-align: left;
  text-transform: uppercase;
}

.gate-card input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(0, 0, 0, 0.42);
  padding: 0 12px;
  font-family: Arial, sans-serif;
  font-size: 1rem;
}

.gate-message {
  min-height: 1.2em;
  margin: 0;
  color: #f3c85c;
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
}

.wheel-stage {
  position: relative;
  width: 520px;
  height: 520px;
  width: var(--wheel-size-desktop);
  margin-top: 64px;
  transform: scale(0.95);
  transform-origin: center top;
  filter: drop-shadow(0 30px 46px rgba(0, 0, 0, 0.78));
}

.roulette-wheel,
#wheel {
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(var(--wheel-rotation, 0deg));
  transition: transform 5s cubic-bezier(0.1, 0.72, 0.12, 1);
}

.pointer {
  position: absolute;
  z-index: 3;
  top: -4%;
  left: 50%;
  width: 8.5%;
  height: 16%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #fff1a8, #b87212 52%, #5f3208);
  clip-path: polygon(50% 100%, 4% 0, 96% 0);
  border-radius: 7px;
  filter: drop-shadow(0 7px 5px rgba(0, 0, 0, 0.65));
}

.wheel-hub {
  position: absolute;
  top: 38%;
  right: 38%;
  bottom: 38%;
  left: 38%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 10px solid #b06c13;
  border-radius: 50%;
  color: #ffffff;
  background:
    radial-gradient(circle, #1c1b18 0 10%, #090909 48%, #000000 100%);
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.08), 0 0 24px rgba(255, 185, 45, 0.5);
  text-align: center;
  text-transform: uppercase;
}

.wheel-hub-button {
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  height: auto;
  top: 38%;
  right: 38%;
  bottom: 38%;
  left: 38%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 8;
  touch-action: manipulation;
  letter-spacing: 0;
}

.wheel-hub-button:focus {
  outline: none;
}

.wheel-hub-button:active {
  transform: scale(0.99);
}

.wheel-hub span {
  transform: rotate(0deg);
  font-size: 1.8rem;
  font-size: clamp(0.85rem, 2.2vw, 1.8rem);
  line-height: 1.02;
  color: #ffffff;
  font-weight: 900;
}

.spin-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 0;
}

.spin-button,
.add-button {
  border: 1px solid rgba(255, 229, 123, 0.7);
  border-radius: var(--radius);
  color: #11100b;
  background: linear-gradient(180deg, #ffe285, #d7961f 54%, #8f4f0d);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 12px 24px rgba(0, 0, 0, 0.42);
  cursor: pointer;
  text-transform: uppercase;
}

.spin-button {
  min-width: 220px;
  padding: 14px 32px 11px;
  font-size: 1.65rem;
}

.public-app .spin-button {
  padding: 13px 34px 10px;
  font-size: 1.5rem;
}

.spin-button.small {
  min-width: 140px;
  padding: 10px 20px 8px;
  font-size: 1.1rem;
}

.spin-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.status-text {
  display: none;
}

.winner-card {
  min-width: min(420px, calc(100vw - 32px));
  padding: 11px 16px 9px;
  border: 1px solid rgba(255, 218, 94, 0.42);
  border-radius: var(--radius);
  color: var(--gold-2);
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34);
  text-align: center;
  text-transform: uppercase;
}

.winner-card[hidden] {
  display: none;
}

.dashboard {
  align-self: center;
  max-height: calc(100vh - 84px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at top, rgba(255, 208, 92, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(24, 17, 10, 0.98), rgba(8, 7, 5, 0.97));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
}

.dashboard-head,
.dashboard-stats,
.prize-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-label,
.dashboard h2 {
  margin: 0;
  text-transform: uppercase;
}

.panel-label {
  color: var(--gold-2);
  font-size: 0.9rem;
}

.dashboard h2 {
  font-size: 2.1rem;
}

.icon-button,
.delete-button,
.toggle {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--gold-2);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  font-size: 1.4rem;
}

.prize-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 12px;
  margin: 18px 0 12px;
}

.prize-form label {
  display: grid;
  gap: 6px;
  color: #e9b243;
  font-family: Arial, sans-serif;
  font-size: 0.76rem;
  text-transform: uppercase;
}

.prize-form input,
.prize-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(0, 0, 0, 0.38);
  padding: 0 10px;
  font-family: Arial, sans-serif;
  font-size: 0.94rem;
}

.full-field {
  grid-column: 1 / -1;
}

.add-button {
  grid-column: 1 / -1;
  min-height: 44px;
  font-size: 1rem;
}

.dashboard-stats {
  padding: 10px 0 14px;
  color: #f7d16d;
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
}

.prize-list {
  display: grid;
  gap: 10px;
}

.prize-row {
  position: relative;
  min-height: 76px;
  padding: 10px;
  border: 1px solid rgba(255, 196, 74, 0.18);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.32);
}

.swatch {
  width: 12px;
  align-self: stretch;
  border-radius: 4px;
  background: var(--swatch);
  box-shadow: 0 0 12px color-mix(in srgb, var(--swatch), transparent 60%);
}

.prize-main {
  flex: 1;
  min-width: 0;
}

.prize-main input {
  width: 100%;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #dfa53b;
  font-family: Arial, sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.weight-input {
  width: 54px;
  min-height: 30px;
  border: 1px solid rgba(255, 196, 74, 0.22);
  border-radius: 5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
}

.toggle {
  width: 44px;
  height: 34px;
  color: #090805;
  background: linear-gradient(180deg, #ffd66c, #b87212);
}

.toggle.is-off {
  color: #95836b;
  background: rgba(255, 255, 255, 0.06);
}

.delete-button {
  width: 34px;
  height: 34px;
  color: #ffb3a9;
}

.result-dialog {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: 100%;
  max-width: 100vw;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
}

.result-dialog[open] {
  display: flex;
}

.result-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}

.result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(420px, calc(100vw - 32px));
  padding: 28px 22px 24px;
  background:
    radial-gradient(circle at top, rgba(255, 210, 88, 0.24), transparent 40%),
    linear-gradient(180deg, #1c1208, #080705);
  text-align: center;
  text-transform: uppercase;
}

.result-card p,
.result-card h2 {
  margin: 0;
}

.result-card p {
  color: var(--gold-2);
  font-family: Arial, sans-serif;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: none;
}

.result-card h2 {
  color: var(--gold);
  max-width: 100%;
  font-size: 2.5rem;
  font-size: clamp(1.2rem, 5vw, 2.5rem);
  line-height: 0.94;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-shadow: none;
}

.result-subtitle {
  margin: 0;
  font-size: 0.78rem;
}

.result-card .spin-button {
  min-width: 120px;
  font-size: 1.05rem;
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .dashboard {
    align-self: auto;
    max-height: none;
  }

  .roulette-page {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .wheel-stage {
    width: 380px;
    height: 380px;
    margin-top: 64px;
    transform: scale(0.95);
    transform-origin: center top;
  }
}

@media (max-width: 640px) {
  body {
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.28)),
      url("./assets/nuevo_fondo.png") center -48px / 760px auto no-repeat,
      linear-gradient(180deg, #020201 0%, #060604 48%, #040b05 100%);
  }

  .app-shell {
    padding: 16px;
  }

  .roulette-page {
    padding: 16px;
  }

  .hero-header {
    min-height: 126px;
    min-height: clamp(82px, 24vw, 126px);
    margin-bottom: 8px;
  }

  .wheel-stage {
    width: 380px;
    height: 380px;
    width: var(--wheel-size-mobile);
    margin-top: 64px;
    transform: scale(0.95);
    transform-origin: center top;
  }

  .roulette-controls {
    margin-top: -32px;
  }

  .status-text {
    max-width: 20rem;
    text-align: center;
  }

  .spin-button {
    min-width: 180px;
    font-size: 1.45rem;
  }

  .dashboard {
    padding: 14px;
  }
}
