:root {
  --panel: rgba(16, 9, 28, .9); --gold: #ffde59; --red: #ff2e4d; --blue: #2f7bff;
  --text: #f4efe6; --muted: #b9adc9; --line: rgba(255, 255, 255, .14);
  --heavy: Impact, "Arial Black", "Franklin Gothic Heavy", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--text); overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
#app { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
#game { display: block; }

/* ===== Menús ===== */
#ui { position: fixed; inset: 0; z-index: 4; overflow-y: auto; touch-action: pan-y;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 18px max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; align-items: center; gap: 10px; }
#ui > * { width: 100%; max-width: 980px; }
h2 { font: 400 clamp(22px, 4vw, 34px) var(--heavy); letter-spacing: 1px; margin: 4px 0; text-align: center; text-shadow: 0 3px 0 #000; }
h3 { font: 400 18px var(--heavy); letter-spacing: .5px; color: var(--gold); margin: 14px 0 8px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { font: 400 18px var(--heavy); letter-spacing: 1px; }
.brand i { color: var(--gold); font-style: normal; }
.chips { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.6); border: 1px solid var(--gold); border-radius: 99px; padding: 5px 14px; font: 400 18px var(--heavy); color: var(--gold); }
.coin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6b0, #f5c518 45%, #b8860b); box-shadow: 0 0 0 2px #7a5a00 inset; vertical-align: -2px; }
.coin.big { width: 26px; height: 26px; }
.adbtn { background: #1d8a3a; border: 0; border-radius: 99px; padding: 7px 14px; font-weight: 700; font-size: 14px; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; }
.sm { font-size: 14px; }

.main { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; align-items: center; flex: 1; }
.logo { display: flex; flex-direction: column; align-items: center; font-family: var(--heavy); line-height: .95; text-shadow: 0 5px 0 #000, 0 0 30px rgba(0,0,0,.7); }
.logo .l1 { font-size: clamp(40px, 8vw, 84px); color: #4f8dff; -webkit-text-stroke: 2px #001b55; }
.logo .vs { font-size: clamp(26px, 4vw, 44px); color: var(--gold); margin: 4px 0; }
.logo .l2 { font-size: clamp(46px, 9vw, 96px); color: var(--red); -webkit-text-stroke: 2px #4a0010; }
.logo .sub { font-size: 18px; color: #fff; letter-spacing: 3px; margin-top: 10px; }
.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { background: linear-gradient(#2b1d45, #1a102c); border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 12px 14px;
  font: 400 19px var(--heavy); letter-spacing: .5px; text-align: left; box-shadow: 0 4px 0 #000; transition: transform .08s; }
.btn small { display: block; font: 500 12px system-ui, sans-serif; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
.btn.hot { background: linear-gradient(#ff3d5a, #b3102b); border-color: #ff8a9b; }
.btn.hot small { color: #ffe0e5; }
.btn.ghost { background: rgba(0,0,0,.4); }
.btn.wide { grid-column: 1 / -1; width: 100%; text-align: center; margin-top: 10px; }
.btn:disabled, button:disabled { opacity: .35; cursor: not-allowed; }

.cards { display: flex; gap: 16px; justify-content: center; }
.card { flex: 1; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px; border-radius: 16px;
  background: var(--panel); border: 2px solid var(--line); text-align: center; }
.card.poli { border-color: rgba(79,141,255,.6); }
.card.caco { border-color: rgba(255,46,77,.6); }
.card:active { transform: scale(.98); }
.pv { height: min(34vh, 220px); width: auto; }
.cn { font: 400 22px var(--heavy); letter-spacing: 1px; }
.cr { color: var(--gold); font-weight: 700; font-size: 13px; text-transform: uppercase; }
.bio { color: var(--muted); font-size: 13px; }
.stats { font-size: 12px; color: #ddd; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.panel.narrow { max-width: 620px; }
.lbl { font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; margin: 6px 0; }
.seg { display: flex; gap: 8px; margin-bottom: 10px; }
.seg.wrap { flex-wrap: wrap; }
.seg button { flex: 1; min-width: 80px; background: #24183a; border: 1px solid var(--line); border-radius: 10px; padding: 9px 6px; font: 400 17px var(--heavy); }
.seg button small { display: block; font: 600 11px system-ui; color: var(--muted); }
.seg button.on { background: var(--gold); color: #1a1000; border-color: var(--gold); }
.seg button.on small { color: #4a3800; }
.payout { text-align: center; margin: 8px 0; }
.good { color: #5df07a; } .bad { color: #ff6b7f; }
.note { color: var(--muted); font-size: 13px; text-align: center; }
.feat { line-height: 1.7; }
.soon { text-align: center; font: 400 22px var(--heavy); color: var(--gold); border: 2px dashed var(--gold); border-radius: 12px; padding: 10px; margin-top: 10px; }

.tabs { display: flex; gap: 6px; justify-content: center; }
.tabs button { background: #24183a; border: 1px solid var(--line); border-radius: 99px; padding: 7px 18px; font: 400 16px var(--heavy); }
.tabs button.on { background: var(--gold); color: #1a1000; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-radius: 12px; background: #1d1330; border: 1px solid var(--line); text-align: center; }
.item.own { opacity: .75; }
.sw { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-size: 22px; border: 2px solid rgba(255,255,255,.3); }
.in { font-size: 13px; font-weight: 600; }
.buy { display: flex; align-items: center; gap: 5px; background: #ffde59; color: #1a1000; border: 0; border-radius: 99px; padding: 5px 12px; font: 400 15px var(--heavy); }
.owned { color: #5df07a; font-weight: 700; font-size: 13px; }
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pack { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 10px; border-radius: 14px; background: #1d1330; border: 1px solid var(--gold); }
.pack .pc { display: flex; align-items: center; gap: 6px; font: 400 26px var(--heavy); color: var(--gold); }
.pack .tag { position: absolute; top: -9px; right: 10px; background: var(--red); border-radius: 99px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.pack.free { border-color: #1d8a3a; }

.custom { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
.pvbox { display: flex; flex-direction: column; align-items: center; background: var(--panel); border-radius: 16px; padding: 10px; border: 1px solid var(--line); align-self: start; position: sticky; top: 0; }
.pvbox .pv { height: min(55vh, 300px); }
.slots { background: var(--panel); border-radius: 16px; padding: 6px 14px 14px; border: 1px solid var(--line); }
.slot .sl { font: 400 16px var(--heavy); color: var(--gold); margin: 10px 0 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { display: flex; align-items: center; gap: 6px; background: #24183a; border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 13px; }
.opt i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); }
.opt.on { background: var(--gold); color: #1a1000; font-weight: 700; }

.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.moves table { width: 100%; border-collapse: collapse; font-size: 13px; }
.moves td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.moves td:first-child { color: var(--muted); white-space: nowrap; }
.moves td small, .moves li small { display: block; color: var(--muted); }
.moves tr.super td { color: var(--gold); }
.moves ol { padding-left: 20px; font-size: 14px; line-height: 1.5; }
.k { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; margin: 0 2px; }
.k.a, .k.b { background: #c62838; } .k.c, .k.d { background: #2456c9; }

.results { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--panel); border-radius: 20px; padding: 24px 30px; border: 2px solid var(--line); max-width: 520px; }
.results h1 { font: 400 clamp(40px, 8vw, 70px) var(--heavy); margin: 0; text-shadow: 0 4px 0 #000; }
.results.win h1 { color: var(--gold); } .results.lose h1 { color: var(--red); }
.results .delta { font: 400 28px var(--heavy); }
.results.win .delta { color: #5df07a; } .results.lose .delta { color: #ff6b7f; }
.results .bal { color: var(--muted); display: flex; gap: 6px; align-items: center; }
.row { display: flex; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.col .btn { text-align: center; }
#ui:has(.results) { justify-content: center; background: rgba(0,0,0,.45); }

/* ===== Anuncio y avisos ===== */
#modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(0,0,0,.85); }
.ad { background: #fff; color: #222; border-radius: 16px; padding: 22px 30px; text-align: center; max-width: 360px; }
.adtag { font-weight: 800; font-size: 12px; color: #888; letter-spacing: 1px; }
.count { font: 400 64px var(--heavy); color: #1d8a3a; }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 30; background: #111; border: 1px solid var(--gold); color: var(--gold);
  padding: 10px 20px; border-radius: 99px; font-weight: 700; animation: pop .25s ease-out; }
@keyframes pop { from { transform: translate(-50%, 20px); opacity: 0; } }

/* ===== Controles táctiles ===== */
#pauseBtn { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translate(-50%, 70px); z-index: 6;
  width: 40px; height: 32px; border-radius: 8px; border: 1px solid rgba(255,255,255,.4); background: rgba(0,0,0,.5); font-weight: 900; }
#touch { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#stick { position: absolute; left: max(22px, env(safe-area-inset-left)); bottom: 22px; width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.25); pointer-events: auto; touch-action: none; }
#knob { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: rgba(255,255,255,.35); pointer-events: none; }
#btns { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: 16px; width: 280px; height: 200px; }
#btns button { position: absolute; width: 62px; height: 62px; border-radius: 50%; pointer-events: auto; touch-action: none;
  border: 2px solid rgba(255,255,255,.55); background: rgba(0,0,0,.35); font: 400 22px var(--heavy); color: #fff; }
#btns button.on { transform: scale(.92); filter: brightness(1.6); }
#btns .p { background: rgba(198,40,56,.45); } #btns .k { background: rgba(36,86,201,.45); }
.b-a { right: 150px; bottom: 74px; } .b-b { right: 80px; bottom: 104px; }
.b-c { right: 160px; bottom: 4px; } .b-d { right: 90px; bottom: 34px; }
#btns .b-sp { right: 6px; bottom: 132px; width: 66px; height: 50px; border-radius: 14px; font-size: 17px; background: rgba(255,190,40,.45); }
#btns .b-su { right: 6px; bottom: 60px; width: 66px; height: 56px; border-radius: 14px; font-size: 15px; background: rgba(170,60,220,.5); }

#rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotate { display: grid; place-items: center; position: fixed; inset: 0; z-index: 50; background: #0d0716; font: 400 24px var(--heavy); color: var(--gold); text-align: center; padding: 30px; }
}
@media (max-height: 460px) {
  .main { grid-template-columns: 1fr 1.4fr; }
  .logo .sub { font-size: 14px; }
  .btn { padding: 8px 12px; font-size: 16px; }
  .custom { grid-template-columns: 200px 1fr; }
}
@media (max-width: 640px) {
  .main, .moves, .custom { grid-template-columns: 1fr; }
}
