/* DOUBLE DOUBLE BONUS POKER — Spinoryx (rediseño premium 2026-09-18)
   Espacio de diseño: 1536 × 1024. Todo el layout se posiciona en ese espacio
   y se escala con transform para ajustarse a cualquier viewport. */

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

:root {
  /* Paleta champagne / oro */
  --gold: #e6c56a;
  --gold-hi: #f7e6b0;
  --gold-mid: #d4aa4a;
  --gold-deep: #9a7220;
  --gold-line: rgba(230,197,106,.55);
  --navy: #061638;
  --navy2: #0b234f;
  --panel: linear-gradient(180deg, rgba(5,16,42,.90), rgba(8,26,60,.90));
  --red: #c8232a;
  --ctl-h: 84px;               /* altura única de la familia de controles inferior */
  --ctl-radius: 14px;
}

html, body { width: 100%; height: 100%; overflow: hidden; background: #030b22; overscroll-behavior: none; touch-action: manipulation; }
body { font-family: 'Trebuchet MS', 'Segoe UI', Verdana, sans-serif; }

/* Fondo a sangre: cubre cualquier proporción de pantalla sin bandas ni scroll.
   El stage (1536×1024) se escala en modo "contain" encima. */
#viewport {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #061a45 url('assets/background.webp') center / cover no-repeat;
}
#viewport::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 70% at 50% 55%, rgba(0,0,0,0) 0%, rgba(0,0,0,.35) 100%);
}

#stage { position: relative; width: 1536px; height: 1024px; transform-origin: center center; flex: none; }

#background {
  position: absolute; inset: 0;
  background: url('assets/background.webp') center / 100% 100% no-repeat;
}
/* viñeta suave para que las cartas ganen contraste */
#background::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 60% at 42% 58%, rgba(0,0,0,0) 0%, rgba(0,0,0,.28) 100%);
}

/* Logo (separado del fondo, -18 %, brillo reducido) */
#logo {
  position: absolute; left: 44px; top: 40px; width: 292px;
  filter: brightness(.9) saturate(.92) drop-shadow(0 6px 14px rgba(0,0,0,.45));
  pointer-events: none;
}

.hidden { display: none !important; }

/* ─── Tabla de pagos ─── */
#paytable {
  position: absolute; left: 700px; top: 36px; width: 796px;
  background: var(--panel);
  border: 1.5px solid var(--gold-line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
  padding: 12px 18px 12px;
}
.pt-head { display: flex; align-items: flex-end; padding-bottom: 8px; border-bottom: 1px solid var(--gold-line); }
.pt-title {
  flex: 1; color: var(--gold); font-weight: 800; font-size: 19px; letter-spacing: 1.6px;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.pt-cols { display: flex; }
.pt-cols span, .pt-row .pt-pay {
  width: 86px; text-align: center; color: #9db3e0; font-weight: 700; font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.pt-cols span { font-size: 12px; letter-spacing: 1px; padding-bottom: 2px; }
.pt-cols span.active-col { color: var(--gold); }
#pt-rows { margin-top: 6px; }
.pt-row { display: flex; align-items: center; height: 25.6px; border-radius: 6px; }
.pt-row:nth-child(even) { background: rgba(255,255,255,.028); }
.pt-row .pt-name { flex: 1; color: #e4ecff; font-size: 15.5px; font-weight: 600; letter-spacing: .5px; padding-left: 8px; }
.pt-row .pt-pay { color: #c6d4f2; font-size: 16.5px; }
.pt-row .pt-pay.active-col { color: #fff; font-weight: 800; background: rgba(230,197,106,.09); border-radius: 4px; height: 100%; line-height: 25.6px; }
.pt-cols span.active-col { background: rgba(230,197,106,.09); border-radius: 4px 4px 0 0; }
.pt-row.hl {
  background: linear-gradient(90deg, rgba(230,197,106,.30), rgba(230,197,106,.10));
  box-shadow: inset 0 0 0 1.5px var(--gold);
  animation: rowPulse 0.9s ease-in-out infinite alternate;
}
.pt-row.hl .pt-name, .pt-row.hl .pt-pay { color: #fff; }
@keyframes rowPulse { from { filter: brightness(1); } to { filter: brightness(1.3); } }

/* ─── Hint ─── */
#hint {
  position: absolute; left: 40px; top: 392px; width: 640px; height: 30px;
  color: #efdca4; font-size: 19px; font-weight: 700; letter-spacing: 2.5px;
  text-shadow: 0 2px 6px rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center;
  opacity: .9;
}

/* ─── Banner de premio ─── */
#win-banner {
  position: absolute; left: 386px; top: 170px; width: 700px; height: 190px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(8,26,60,.96), rgba(5,16,42,.9));
  border: 2px solid var(--gold); border-radius: 20px;
  box-shadow: 0 0 40px rgba(230,197,106,.45), 0 16px 40px rgba(0,0,0,.6);
  z-index: 30; animation: bannerIn .45s cubic-bezier(.2,1.6,.4,1);
}
@keyframes bannerIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#win-banner-label { color: var(--gold); font-size: 42px; font-weight: 900; letter-spacing: 3px; text-shadow: 0 3px 8px #000; }
#win-banner-amount { color: #fff; font-size: 52px; font-weight: 900; text-shadow: 0 0 18px rgba(230,197,106,.7); }

/* ─── Cartas (protagonistas) ─── */
#cards { position: absolute; left: 40px; top: 440px; display: flex; gap: 16px; }
.card { width: 196px; height: 274px; perspective: 900px; cursor: pointer; position: relative; transition: transform .2s cubic-bezier(.2,.9,.3,1.2); }
.card-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.3,.9,.3,1); }
.card.flipped .card-inner { transform: rotateY(180deg); }
.card-face, .card-back {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 14px; overflow: hidden;
  /* borde dorado fino + sombra suave debajo */
  box-shadow: 0 0 0 1.5px rgba(230,197,106,.75), 0 14px 26px rgba(0,0,0,.55), 0 4px 8px rgba(0,0,0,.35);
}
.card-face {
  background: linear-gradient(160deg, #ffffff 0%, #f7f6ef 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.card-back { transform: rotateY(180deg); background: url('assets/card_back.webp') center / cover no-repeat; }
.card-face .corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.card-face .corner.tl { top: 8px; left: 10px; }
.card-face .corner.br { bottom: 8px; right: 10px; transform: rotate(180deg); }
.card-face .corner .r { font-size: 34px; font-weight: 900; }
.card-face .corner .s { font-size: 30px; }
.card-face .center-suit { font-size: 110px; line-height: 1; }
.card-face.red { color: var(--red); }
.card-face.black { color: #14161c; }

/* glow azul únicamente durante el reparto */
.card.dealing .card-face, .card.dealing .card-back {
  animation: dealGlow .9s ease-out forwards;
}
@keyframes dealGlow {
  0%   { box-shadow: 0 0 0 1.5px rgba(230,197,106,.75), 0 0 0 rgba(90,160,255,0), 0 14px 26px rgba(0,0,0,.55); }
  35%  { box-shadow: 0 0 0 1.5px rgba(230,197,106,.75), 0 0 28px 6px rgba(90,160,255,.65), 0 14px 26px rgba(0,0,0,.55); }
  100% { box-shadow: 0 0 0 1.5px rgba(230,197,106,.75), 0 0 0 rgba(90,160,255,0), 0 14px 26px rgba(0,0,0,.55); }
}

/* HELD: la carta se levanta y toma borde dorado */
.card.held { transform: translateY(-18px); }
.card.held .card-face { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(230,197,106,.55), 0 22px 30px rgba(0,0,0,.6); }
.card.winning .card-face { box-shadow: 0 0 0 3px #41d97c, 0 0 30px rgba(65,217,124,.8), 0 14px 26px rgba(0,0,0,.55); animation: winGlow .7s ease-in-out infinite alternate; }
@keyframes winGlow { from { filter: brightness(1); } to { filter: brightness(1.18); } }

/* ─── Botones HOLD ─── */
#hold-buttons { position: absolute; left: 40px; top: 730px; display: flex; gap: 16px; }
.hold-btn {
  width: 196px; height: 50px; border-radius: 12px; cursor: pointer;
  font-size: 19px; font-weight: 800; letter-spacing: 3px;
  border: 1.5px solid rgba(230,197,106,.35);
  background: linear-gradient(180deg, rgba(22,44,96,.85), rgba(9,26,62,.85)); color: #a9bce6;
  box-shadow: 0 3px 0 rgba(3,10,30,.9), 0 6px 12px rgba(0,0,0,.4);
  transition: background .15s, color .15s, box-shadow .15s, transform .12s;
}
.hold-btn:not(:disabled):hover { border-color: var(--gold-line); color: #dbe6ff; }
.hold-btn.on {
  border-color: var(--gold-hi);
  background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold-mid) 55%, #b98c2e 100%); color: #3a2a00;
  box-shadow: 0 3px 0 var(--gold-deep), 0 0 18px rgba(230,197,106,.55), 0 8px 14px rgba(0,0,0,.4);
  text-shadow: 0 1px 0 rgba(255,255,255,.45);
}
.hold-btn:disabled { opacity: .35; cursor: default; }
.hold-btn:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(3,10,30,.9); }

/* ─── Paneles (compactados ~22 %) ─── */
.panel {
  position: absolute; left: 1118px; width: 378px;
  background: var(--panel);
  border: 1.5px solid var(--gold-line); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
}
#panel-win { top: 440px; height: 112px; border-color: var(--gold); box-shadow: 0 8px 20px rgba(0,0,0,.45), 0 0 18px rgba(230,197,106,.18); }
#panel-credit { top: 566px; height: 78px; }
#panel-bet { top: 658px; height: 78px; }
.panel-label { color: var(--gold); font-size: 13px; font-weight: 700; letter-spacing: 3px; opacity: .9; }
.panel-value { color: #e8eeff; font-size: 26px; font-weight: 800; text-shadow: 0 2px 6px #000; font-variant-numeric: tabular-nums; }
#panel-win .panel-label { font-size: 15px; letter-spacing: 3.5px; }
#panel-win .panel-value { font-size: 38px; font-weight: 900; color: #fff; }
#panel-win.flash { animation: panelFlash .5s ease 3; }
@keyframes panelFlash { 50% { box-shadow: 0 0 34px rgba(230,197,106,.9); } }

/* ─── Familia única de controles inferiores ─── */
.icon-btn, .step-btn {
  height: var(--ctl-h); border-radius: var(--ctl-radius);
  border: 1.5px solid var(--gold-line); cursor: pointer;
  background: linear-gradient(180deg, #17346f 0%, #0b1f4a 100%);
  color: var(--gold); box-shadow: 0 3px 0 rgba(3,10,30,.95), 0 8px 14px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .1s, box-shadow .1s, filter .15s;
}
.icon-btn:not(:disabled):hover, .step-btn:not(:disabled):hover { filter: brightness(1.12); }
.icon-btn:active, .step-btn:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(3,10,30,.95), 0 4px 8px rgba(0,0,0,.4); }

.icon-btn { position: absolute; top: 878px; width: 70px; font-size: 28px; }
#icon-settings { left: 44px; }
#icon-sound { left: 124px; }

/* ─── Menú ajustes ─── */
#settings-menu {
  position: absolute; left: 36px; top: 690px; width: 270px; z-index: 40;
  background: var(--panel);
  border: 1.5px solid var(--gold-line); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.6);
}

/* Steppers:  VALOR USD [− 1.00 +] | NIVEL APUESTA [− 1 +] */
.stepper {
  position: absolute; top: 878px; height: var(--ctl-h);
  display: flex; align-items: stretch; gap: 0;
  border: 1.5px solid var(--gold-line); border-radius: var(--ctl-radius);
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
  overflow: hidden;
}
#stepper-coin  { left: 222px; width: 380px; }
#stepper-coins { left: 626px; width: 380px; }
.step-btn {
  width: 78px; height: auto; border: none; border-radius: 0; box-shadow: none;
  font-size: 34px; font-weight: 800; flex: none;
  background: linear-gradient(180deg, rgba(23,52,111,.9), rgba(11,31,74,.9));
}
.step-btn:first-child { border-right: 1px solid var(--gold-line); }
.step-btn:last-child  { border-left: 1px solid var(--gold-line); }
.step-btn:disabled { opacity: .35; cursor: default; }
.step-btn:not(:disabled):active { transform: none; filter: brightness(.85); }
.step-display { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.step-label { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: 2.5px; opacity: .9; }
.step-value { color: #fff; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ─── Botones de acción ─── */
.action-btn {
  border: 1px solid rgba(255,240,200,.45); cursor: pointer; font-weight: 900; letter-spacing: 3px;
  border-radius: 16px; color: #3b2a05;
  background: linear-gradient(180deg, #fbefc8 0%, #e9cf86 28%, #d4aa4a 62%, #b9892c 100%);
  box-shadow: 0 5px 0 #7d5c16, 0 12px 24px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.7);
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.action-btn:not(:disabled):hover { filter: brightness(1.05); }
.action-btn:disabled { opacity: .4; cursor: default; }
.action-btn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 2px 0 #7d5c16, 0 6px 12px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.7); }
#btn-deal { position: absolute; left: 1118px; top: 866px; width: 378px; height: 108px; font-size: 40px; }
#btn-double { position: absolute; left: 1118px; top: 866px; width: 182px; height: 108px; font-size: 26px;
  background: linear-gradient(180deg, #ffb08c, #e2542a 60%, #a8351a); color: #fff; border-color: rgba(255,200,180,.45);
  box-shadow: 0 5px 0 #6b2310, 0 12px 24px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.35); text-shadow: 0 2px 3px rgba(0,0,0,.5); }
#btn-collect { position: absolute; left: 1314px; top: 866px; width: 182px; height: 108px; font-size: 26px;
  background: linear-gradient(180deg, #a8f5c4, #2fb95f 60%, #197a3c); color: #fff; border-color: rgba(200,255,220,.45);
  box-shadow: 0 5px 0 #0f5a2a, 0 12px 24px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.35); text-shadow: 0 2px 3px rgba(0,0,0,.5); }
#btn-double:not(:disabled):active { box-shadow: 0 2px 0 #6b2310, 0 6px 12px rgba(0,0,0,.5); }
#btn-collect:not(:disabled):active { box-shadow: 0 2px 0 #0f5a2a, 0 6px 12px rgba(0,0,0,.5); }

/* ─── Double Game ─── */
#double-overlay {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(2,8,26,.94);
  display: flex; flex-direction: column; align-items: center;
}
#double-title {
  margin-top: 90px; color: var(--gold); font-size: 56px; font-weight: 900; letter-spacing: 5px;
  text-shadow: 0 0 26px rgba(230,197,106,.5), 0 4px 8px #000;
}
#double-hint { margin-top: 14px; color: #cfe0ff; font-size: 24px; font-weight: 700; letter-spacing: 2px; }
#double-amount-wrap { margin-top: 18px; color: #fff; font-size: 30px; font-weight: 800; }
#double-amount { color: var(--gold); }
#double-row { margin-top: 46px; display: flex; gap: 34px; }
.d-card-slot { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.d-label { color: var(--gold); font-size: 18px; font-weight: 800; letter-spacing: 2.5px; }
.d-card { width: 168px; height: 235px; border-radius: 12px; position: relative; overflow: hidden;
  box-shadow: 0 0 0 1.5px rgba(230,197,106,.75), 0 14px 26px rgba(0,0,0,.6); }
.d-card.d-back { background: url('assets/card_back.webp') center / cover no-repeat; cursor: pointer; transition: transform .15s ease; }
.d-card.d-back:hover { transform: translateY(-10px) scale(1.04); box-shadow: 0 0 0 2px var(--gold), 0 0 26px rgba(230,197,106,.6); }
.d-card.d-front { background: linear-gradient(160deg, #fff, #f7f6ef); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.d-card .corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.d-card .corner.tl { top: 6px; left: 8px; }
.d-card .corner.br { bottom: 6px; right: 8px; transform: rotate(180deg); }
.d-card .corner .r { font-size: 28px; font-weight: 900; }
.d-card .corner .s { font-size: 24px; }
.d-card .center-suit { font-size: 84px; line-height: 1; }
.d-card.red { color: var(--red); }
.d-card.black { color: #14161c; }
.d-card.picked { box-shadow: 0 0 0 3px var(--gold), 0 0 30px rgba(230,197,106,.8); }
#double-result { margin-top: 30px; min-height: 56px; color: #fff; font-size: 40px; font-weight: 900; letter-spacing: 2px; text-shadow: 0 3px 8px #000; }
#double-result.win { color: #41d97c; }
#double-result.lose { color: #ff5f5f; }
#double-result.push { color: var(--gold-hi); }
#double-actions { margin-top: 12px; display: flex; gap: 40px; }
#double-actions .action-btn { width: 250px; height: 88px; font-size: 30px; position: static; }
