:root {
  --bg: #070b12;
  --bg-mid: #101826;
  --panel: rgba(22, 14, 8, 0.88);
  --panel-border: rgba(255, 176, 32, 0.45);
  --amber: #ffb020;
  --amber-bright: #ffd56a;
  --coral: #ff7a18;
  --coral-deep: #e85d04;
  --mint: #3ecf8e;
  --cream: #fff4e0;
  --muted: #c4a882;
  --metal: #d7dde8;
  --font-display: "Orbitron", sans-serif;
  --font-body: "Rajdhani", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font-body);
  background: #000;
  color: var(--cream);
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 420px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 55% at 50% 18%, rgba(255, 122, 24, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 40% at 50% 70%, rgba(62, 207, 142, 0.08), transparent 50%),
    linear-gradient(180deg, #0c121c 0%, #070b12 45%, #120a06 100%);
  box-shadow: 0 0 40px rgba(0,0,0,0.7);
}

#game-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,176,32,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,176,32,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 50% 35%, black 20%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Floating R$ coins */
.fx-coins {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.fx-coins span {
  position: absolute;
  color: rgba(255, 176, 32, 0.35);
  font-weight: 800;
  font-size: 14px;
  animation: coinFloat linear infinite;
}
@keyframes coinFloat {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.7; }
  100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

.top-rail {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 88%;
  z-index: 6;
  pointer-events: none;
}
.rail-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3a3f4a, #1a1e28);
  border: 1px solid rgba(255,176,32,0.35);
  box-shadow: 0 0 18px rgba(255,122,24,0.25), inset 0 1px 0 rgba(255,255,255,0.15);
}
.rail-brand strong {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--amber-bright);
}
.pix-badge {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--mint);
  text-shadow: 0 0 8px rgba(62,207,142,0.7);
}

#top-right-icons {
  position: absolute;
  top: 58px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 8;
}
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,176,32,0.4);
  background: rgba(28, 16, 8, 0.85);
  color: var(--amber-bright);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255,122,24,0.25);
  font-size: 0.95rem;
}
.icon-button:active { transform: scale(0.94); }

/* ===== ROULETTE ===== */
#roulette-stage {
  position: absolute;
  top: 8%;
  left: 0;
  width: 100%;
  height: 62%;
  z-index: 2;
}

#roulette-indicator {
  position: absolute;
  top: 2%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 42%;
  max-width: 160px;
  padding: 10px 8px 18px;
  text-align: center;
  background: linear-gradient(180deg, #4a505c, #1c212c 70%);
  clip-path: polygon(8% 0, 92% 0, 100% 62%, 50% 100%, 0 62%);
  border: 1px solid rgba(255,176,32,0.35);
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
}
#roulette-indicator span {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: var(--amber-bright);
}
.pointer-tip {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid #fff;
  filter: drop-shadow(0 0 4px var(--amber));
}

.wheel-disk {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  border-radius: 50%;
  will-change: transform;
}

#roulette-wheel {
  width: 88%;
  aspect-ratio: 1;
  z-index: 1;
  box-shadow:
    0 0 0 4px #2a1a0c,
    0 0 0 7px rgba(255,176,32,0.55),
    0 0 40px rgba(255,122,24,0.35),
    inset 0 0 30px rgba(0,0,0,0.5);
}

#bonus-wheel {
  width: 38%;
  aspect-ratio: 1;
  z-index: 3;
  box-shadow:
    0 0 0 3px rgba(255,176,32,0.5),
    0 0 24px rgba(255,122,24,0.35);
}

#roulette-wheel canvas,
#bonus-wheel canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
}

#roulette-wheel.swaying { animation: swayOuter 8s ease-in-out infinite; }
#bonus-wheel.swaying { animation: swayInner 8s ease-in-out infinite; }

@keyframes swayOuter {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  25% { transform: translate(-50%, -50%) rotate(20deg); }
  75% { transform: translate(-50%, -50%) rotate(-20deg); }
}
@keyframes swayInner {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  25% { transform: translate(-50%, -50%) rotate(-20deg); }
  75% { transform: translate(-50%, -50%) rotate(20deg); }
}

#bonus-indicator {
  position: absolute;
  top: 33%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 14px solid #fff;
  z-index: 5;
  filter: drop-shadow(0 0 6px var(--amber));
}

#hub-logo {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  width: 16%;
  aspect-ratio: 1;
  border-radius: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(0.38rem, 2vw, 0.52rem);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--amber-bright);
  background: radial-gradient(circle at 35% 30%, #3a2a18, #120a06 70%);
  border: 2px solid rgba(255,176,32,0.55);
  box-shadow: 0 0 16px rgba(255,122,24,0.4);
  pointer-events: none;
}

#bottom-wave {
  position: absolute;
  bottom: -8%;
  left: -10%;
  width: 120%;
  height: 28%;
  background:
    radial-gradient(ellipse 60% 80% at 30% 80%, rgba(232, 93, 4, 0.35), transparent 60%),
    radial-gradient(ellipse 50% 70% at 70% 90%, rgba(255, 176, 32, 0.2), transparent 55%);
  filter: blur(2px);
  z-index: 1;
  pointer-events: none;
}

/* ===== UI PANELS (helix layout) ===== */
.ui-panel {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 5px 12px;
  color: white;
  box-shadow: 0 0 14px rgba(255,122,24,0.15);
  backdrop-filter: blur(6px);
  text-align: left;
  z-index: 5;
}
.ui-panel .label {
  font-size: clamp(0.7rem, 2.5vw, 0.85rem);
  margin: 0;
  opacity: 0.9;
}
.ui-panel .value {
  font-size: clamp(0.95rem, 3.5vw, 1.15rem);
  font-weight: 800;
  color: var(--amber-bright);
  margin: 0;
}

#saldo-block { bottom: 11%; left: 5%; width: 25%; min-width: 90px; }
#ganho-block { bottom: 2%; left: 5%; width: 25%; min-width: 90px; }

.ui-button {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
}
.ui-button:active { transform: scale(0.96); }

#normal-button {
  bottom: 20%;
  left: 5%;
  width: 25%;
  min-width: 90px;
  padding: 8px 0;
  font-size: clamp(0.7rem, 2.8vw, 0.9rem);
}
#normal-button.flash {
  background: linear-gradient(135deg, rgba(255,122,24,0.55), rgba(255,176,32,0.25));
  border-color: var(--amber);
  color: var(--amber-bright);
}

#deposit-button {
  position: absolute;
  bottom: 28%;
  left: 5%;
  width: 25%;
  min-width: 90px;
  padding: 12px 0;
  font-size: clamp(0.75rem, 2.8vw, 0.95rem);
  background: linear-gradient(135deg, #ffd56a, #ff7a18);
  border: 2px solid #ffa94d;
  border-radius: 12px;
  color: #2a1400;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 122, 24, 0.55);
  z-index: 6;
  animation: depositPulse 2s ease-in-out infinite;
}
#deposit-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}
@keyframes depositPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(255,122,24,0.55); transform: scale(1); }
  50% { box-shadow: 0 6px 28px rgba(255,213,106,0.75); transform: scale(1.04); }
}

#deposit-arrow {
  position: absolute;
  bottom: 34%;
  left: 17%;
  transform: translateX(-50%);
  color: var(--amber);
  font-size: 1.4rem;
  z-index: 7;
  animation: arrowBounce 1.5s ease-in-out infinite;
  pointer-events: none;
  text-shadow: 0 2px 6px rgba(0,0,0,0.7);
}
@keyframes arrowBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

#giro-area {
  position: absolute;
  bottom: 5%;
  right: 5%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 6;
}
#giro-area .ui-button {
  position: static;
  width: 56px;
  height: 38px;
  font-size: 1.4rem;
}
#giro-area #giro-block {
  position: relative;
  min-width: 80px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#play-button {
  position: absolute;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
  width: 28%;
  min-width: 108px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid rgba(255, 213, 106, 0.7);
  background:
    radial-gradient(circle at 35% 30%, #fff2c4, var(--amber) 40%, var(--coral-deep) 100%);
  color: #2a1400;
  font-family: var(--font-display);
  font-size: clamp(0.62rem, 2.8vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  z-index: 7;
  box-shadow:
    0 0 0 6px rgba(255,122,24,0.15),
    0 0 28px rgba(255,122,24,0.55),
    0 8px 0 #8a3a00;
  transition: transform 0.2s;
}
#play-button::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px dashed rgba(42,20,0,0.35);
  animation: hubSpin 12s linear infinite;
  pointer-events: none;
}
@keyframes hubSpin { to { transform: rotate(360deg); } }
#play-button:active { transform: translateX(-50%) scale(0.95); }
#play-button:disabled {
  opacity: 0.7;
  cursor: wait;
  filter: grayscale(0.3);
}
#play-label { position: relative; z-index: 1; }

.win-toast {
  position: absolute;
  top: 70px;
  left: 12px;
  z-index: 20;
  background: linear-gradient(135deg, rgba(20,90,60,0.95), rgba(14,60,42,0.95));
  border: 1px solid rgba(62,207,142,0.4);
  padding: 8px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  animation: slideInLeft 0.4s ease-out;
  max-width: 70%;
}
.win-toast-label {
  display: block;
  font-size: 0.68rem;
  opacity: 0.85;
  text-transform: uppercase;
}
.win-toast em { font-style: normal; color: var(--amber-bright); font-weight: 800; }
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(5px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 50;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.modal-overlay.show {
  display: flex;
  opacity: 1;
}
.modal {
  width: min(100%, 400px);
  max-height: 90vh;
  overflow: auto;
  background: linear-gradient(160deg, #24180e, #120c08);
  border: 2px solid rgba(255,176,32,0.45);
  border-radius: 18px;
  padding: 20px 16px 22px;
  position: relative;
  box-shadow: 0 0 30px rgba(255,122,24,0.25);
  transform: scale(0.96);
  transition: transform 0.3s ease;
}
.modal-overlay.show .modal { transform: scale(1); }
.modal-lg { width: min(100%, 520px); }
.modal-sm { width: min(100%, 300px); }
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.7rem;
  cursor: pointer;
}
.modal h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--amber-bright);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}
.tabs, .help-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tab, .help-tab {
  flex: 1;
  min-width: 100px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,176,32,0.25);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}
.tab.active, .help-tab.active {
  background: rgba(255,176,32,0.18);
  border-color: var(--amber);
  color: var(--amber-bright);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}
label input, label select, #depositAmount, #withdrawAmount, #withdrawPixKey, #withdrawKeyType, #pixEmv, #affLink, #adminRtp {
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,176,32,0.25);
  background: rgba(0,0,0,0.35);
  color: var(--cream);
  outline: none;
}
.btn-primary, .profile-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--amber), var(--coral));
  color: #2a1400;
  font-weight: 800;
  cursor: pointer;
  margin-top: 6px;
}
.profile-btn {
  background: rgba(255,176,32,0.12);
  border: 1px solid rgba(255,176,32,0.35);
  color: var(--cream);
  margin-bottom: 8px;
}
.profile-btn.danger { color: #ff8a8a; border-color: rgba(255,100,100,0.35); }
.hint { font-size: 0.8rem; color: var(--muted); margin: 6px 0 10px; }
.quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.quick-amounts button {
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(255,176,32,0.08);
  color: var(--amber);
  cursor: pointer;
  font-weight: 700;
}
#qrImage {
  display: block;
  width: 200px;
  margin: 10px auto;
  background: #fff;
  padding: 8px;
  border-radius: 10px;
}
.ok { color: var(--mint); font-weight: 700; text-align: center; }
.status-line { text-align: center; margin-top: 8px; color: var(--muted); }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.copy-row button {
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: var(--amber);
  color: #2a1400;
  font-weight: 800;
  cursor: pointer;
}
.aff-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.aff-card {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,176,32,0.2);
  border-radius: 10px;
  padding: 10px;
}
.aff-card span { display: block; font-size: 0.72rem; color: var(--muted); }
.aff-card strong { color: var(--amber-bright); font-size: 1.1rem; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,176,32,0.15);
  font-size: 0.9rem;
}
.list-item .win { color: var(--mint); font-weight: 800; }
.help-content { line-height: 1.5; font-size: 0.92rem; color: #ead7bf; }
.help-content h3 { color: var(--amber-bright); font-family: var(--font-display); font-size: 1rem; margin: 10px 0 6px; }
.help-content h4 { color: var(--amber); margin: 12px 0 4px; }
.help-content ul { padding-left: 18px; }
.prize-modal { text-align: center; }
.prize-amount {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--amber-bright);
  margin: 8px 0;
}
.prize-detail { color: var(--muted); margin-bottom: 14px; }
.admin-fab {
  position: fixed;
  right: max(12px, calc(50% - 198px));
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(18,12,8,0.9);
  color: var(--amber);
  cursor: pointer;
  z-index: 30;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-size: 1.2rem;
}
.admin-fab.hidden { display: none !important; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.balance-hint strong { color: var(--amber-bright); }

@media (max-width: 380px) {
  #deposit-button, #normal-button, #saldo-block, #ganho-block { min-width: 82px; }
  #play-button { min-width: 96px; }
}
