
:root{
  --bg-1: #0a0f1f;
  --bg-2: #101b3a;
  --accent-1: #7c4dff;
  --accent-2: #00d4ff;
  --good: #19c37d;
  --warn: #ffb300;
  --bad: #ff4b4b;
  --text: #e8ecff;
  --muted: #9aa3c2;
  --card-white: #ffffff;
  --card-black: #111224;
  --red: #e53935;
}

*{box-sizing:border-box}

html,body{
  height:100%;
  margin:0;
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, Noto Sans, sans-serif;
  background: radial-gradient(circle at 20% 20%, #112 0%, #06080f 60%, #02040a 100%);
  overflow-x:hidden;
}

/* slow pulsing glow behind table */
.backdrop-glow{
  position:fixed; inset:0;
  background:
    radial-gradient(60vmax 60vmax at 20% 30%, rgba(124,77,255,0.14), transparent 60%),
    radial-gradient(50vmax 50vmax at 80% 70%, rgba(0,212,255,0.12), transparent 60%);
  filter: blur(12px);
  pointer-events:none;
  animation: floatGlow 18s ease-in-out infinite alternate;
}
@keyframes floatGlow{
  0%{ transform: translateY(0px) scale(1); opacity:0.9 }
  100%{ transform: translateY(-10px) scale(1.02); opacity:1 }
}

.table-wrap{
  width:min(1200px, 96vw);
  margin: 32px auto;
  background: linear-gradient(160deg, rgba(16,27,58,0.85), rgba(10,15,31,0.85));
  border-radius: 28px;
  border:1px solid rgba(124,77,255,0.25);
  box-shadow:
    0 0 0 1px rgba(124,77,255,0.15) inset,
    0 30px 80px rgba(124,77,255,0.18),
    0 20px 50px rgba(0,212,255,0.12);
  backdrop-filter: blur(6px);
}

.header{
  display:flex;
  flex-direction:column;
  gap:16px;
  padding: 20px 24px;
  border-bottom:1px solid rgba(124,77,255,0.25);
}
.header h1{
  margin:0;
  font-size: clamp(22px, 3vw, 36px);
  letter-spacing:0.5px;
  text-shadow: 0 0 18px rgba(124,77,255,0.35);
}

.controls-row{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:18px;
}
.controls-row label, .balance, .sound{
  display:flex; align-items:center; gap:10px;
  color:var(--muted);
  font-size:14px;
}
.controls-row select{
  background:#0d1226; color:var(--text);
  border:1px solid rgba(124,77,255,0.35);
  border-radius:12px; padding:8px 12px;
  outline:none;
}

.balance strong{ color: var(--text); font-weight:700; }

.felt{
  padding: 18px 18px 24px;
  position:relative;
}
.divider-glow{
  height:2px; margin:18px 0;
  background: linear-gradient(90deg, transparent, rgba(124,77,255,0.65), rgba(0,212,255,0.65), transparent);
  filter: blur(0.3px);
}

.hand-row{
  display:flex; flex-direction:column; gap:12px;
  padding: 8px;
}
.hand-header{
  display:flex; align-items:center; justify-content:space-between;
  padding: 0 6px;
}
.hand-header h2{
  margin:0; font-size:18px; color:var(--muted);
}
.total{
  background: linear-gradient(120deg, rgba(124,77,255,0.35), rgba(0,212,255,0.35));
  border:1px solid rgba(124,77,255,0.45);
  padding: 6px 10px; border-radius:12px;
  font-weight:700; color:var(--text);
  text-shadow: 0 0 12px rgba(124,77,255,0.45);
}

.cards{
  display:flex; align-items:flex-start; gap:14px;
  min-height: 170px;
  padding:10px;
  flex-wrap:wrap;
}

.card{
  width: 100px;
  height: 150px;
  perspective: 800px;
  position:relative;
}
.card .inner{
  position:absolute; inset:0;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;

  transform: rotateY(180deg);
}
.card.flipped .inner{ transform: rotateY(0deg); }
.card .face, .card .back{
  position:absolute; inset:0;
  border-radius:14px;
  backface-visibility: hidden;
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow:
    0 8px 18px rgba(0,0,0,0.35),
    0 0 16px rgba(124,77,255,0.3);
}

/* front */
.card .face{
  background: var(--card-white);
  color: var(--card-black);
  display:flex; align-items:center; justify-content:center;
}
.pip{
  font-size:48px; line-height:1;
}
.corner{
  position:absolute; font-weight:700; font-size:18px;
}
.corner.tl{ top:8px; left:8px; }
.corner.br{ bottom:8px; right:8px; transform: rotate(180deg); }

.red{ color: var(--red); }

/* back */
.card .back{
  background:
    radial-gradient(160px 80px at 30% 30%, rgba(124,77,255,0.85), rgba(124,77,255,0.25) 60%, transparent 70%),
    radial-gradient(160px 80px at 70% 70%, rgba(0,212,255,0.85), rgba(0,212,255,0.25) 60%, transparent 70%),
    linear-gradient(135deg, #1a1f3d, #0a0f1f);
  transform: rotateY(180deg);
  border:1px solid rgba(124,77,255,0.7);
  box-shadow:
    0 0 0 2px rgba(124,77,255,0.35) inset,
    0 10px 30px rgba(0,212,255,0.25),
    0 0 26px rgba(124,77,255,0.55);
}

/* buttons */
.btn{
  border:none; cursor:pointer;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight:700; letter-spacing:0.3px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(124,77,255,0.6), rgba(0,212,255,0.6));
  box-shadow:
    0 6px 20px rgba(124,77,255,0.35),
    0 0 12px rgba(0,212,255,0.35);
  transition: transform 0.1s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:hover{ transform: translateY(-1px); filter: brightness(1.08); }
.btn:active{ transform: translateY(0px) scale(0.99); }
.btn:disabled{ opacity:0.5; cursor:not-allowed; }

.btn.primary{ background: linear-gradient(135deg, rgba(124,77,255,0.85), rgba(0,212,255,0.85)); }
.btn.warn{ background: linear-gradient(135deg, rgba(255,179,0,0.85), rgba(124,77,255,0.85)); }
.btn.action{ background: linear-gradient(135deg, rgba(0,212,255,0.85), rgba(124,77,255,0.85)); }

.btn.small{ padding:8px 12px; font-size:13px; border-radius:10px; }
.btn.circle{ width:44px; height:44px; border-radius:50%; padding:0; display:grid; place-items:center; font-size:22px; }

.actions{
  display:flex; gap:20px; align-items:center; flex-wrap:wrap;
  margin-top: 8px;
}
.bet-box{ display:flex; flex-direction:column; gap:6px; }
.bet-controls{ display:flex; gap:10px; align-items:center; }
.bet-controls input{
  width:110px; padding:10px 12px; border-radius:12px;
  border:1px solid rgba(124,77,255,0.45);
  background:#0d1226; color:var(--text); font-weight:700;
  outline:none; text-align:center;
}

.primary-actions{ display:flex; gap:10px; flex-wrap:wrap; }

.message{
  margin-top: 10px; min-height: 24px;
  color: var(--muted);
  text-shadow: 0 0 14px rgba(124,77,255,0.35);
  font-size: 14px;
}

.footer{
  padding: 16px 24px; color:var(--muted); font-size:13px;
  border-top:1px solid rgba(124,77,255,0.25);
}

/* toggle switch */
.switch{ position:relative; display:inline-block; width:52px; height:28px; }
.switch input{ display:none; }
.slider{
  position:absolute; cursor:pointer; inset:0; background:#3a3f64; border-radius:28px;
  box-shadow: inset 0 0 0 2px rgba(124,77,255,0.4);
  transition: all 0.2s ease;
}
.slider:before{
  content:""; position:absolute; height:22px; width:22px; left:4px; top:3px;
  background: linear-gradient(135deg, rgba(124,77,255,0.9), rgba(0,212,255,0.9));
  border-radius:50%;
  box-shadow: 0 0 12px rgba(124,77,255,0.7);
  transition: transform 0.2s ease;
}
input:checked + .slider{ background:#20264a; }
input:checked + .slider:before{ transform: translateX(24px); }
.switch-label{ font-size:13px; color:var(--muted); }
@media (max-width:680px){
  .cards{ justify-content:center; }
  .primary-actions{ width:100%; justify-content:center; }
}


/* Performance hint */
.card .inner{ will-change: transform; }


/* Result overlay */
.result-overlay{
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(4,6,14,0.65);
  backdrop-filter: blur(6px);
  z-index: 999;
  animation: overlayIn 240ms ease-out;
}
.result-overlay.hidden{ display: none; }

@keyframes overlayIn{
  from{ opacity: 0; } to{ opacity: 1; }
}

.result-card{
  width: min(560px, 92vw);
  background: linear-gradient(160deg, rgba(16,27,58,0.95), rgba(10,15,31,0.95));
  border: 1px solid rgba(124,77,255,0.45);
  border-radius: 24px;
  padding: 28px;
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(124,77,255,0.25) inset,
    0 30px 80px rgba(124,77,255,0.25),
    0 20px 50px rgba(0,212,255,0.18);
  position: relative;
  overflow: hidden;
}

.result-card::after{
  content:"";
  position:absolute; inset:-1px;
  background:
    radial-gradient(200px 120px at 20% 20%, rgba(124,77,255,0.35), transparent 70%),
    radial-gradient(200px 120px at 80% 80%, rgba(0,212,255,0.35), transparent 70%);
  filter: blur(12px);
  pointer-events:none;
}

.result-title{
  font-size: clamp(28px, 6vw, 46px);
  font-weight: 900;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  text-shadow: 0 0 24px rgba(124,77,255,0.55);
}
.result-sub{
  color: var(--muted);
  margin-bottom: 18px;
  font-size: clamp(14px, 2.6vw, 18px);
}

/* celebratory pulse */
.pulse{
  animation: pulseGlow 1200ms ease-in-out 3;
}
@keyframes pulseGlow{
  0%{ text-shadow: 0 0 12px rgba(25,195,125,0.2); transform: scale(1); }
  50%{ text-shadow: 0 0 26px rgba(25,195,125,0.6); transform: scale(1.03); }
  100%{ text-shadow: 0 0 12px rgba(25,195,125,0.2); transform: scale(1); }
}

/* simple chip confetti */
.chip-confetti{
  position: absolute;
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(124,77,255,0.95), rgba(0,212,255,0.95));
  box-shadow: 0 0 12px rgba(124,77,255,0.8);
  animation: confettiFall 900ms ease-out forwards;
}
@keyframes confettiFall{
  0%{ transform: translate(var(--x,0), -20px) scale(1); opacity: 1; }
  100%{ transform: translate(calc(var(--x,0) + 0px), 220px) scale(0.8); opacity: 0; }
}

/* bigger inline message for table area */
.message.big{
  font-size: 18px;
  color: var(--text);
  text-shadow: 0 0 18px rgba(124,77,255,0.55);
  font-weight: 700;
}
