:root {
  --bg: #2a1408;
  --bg2: #3b1d0b;
  --card: #fff7ec;
  --ink: #2b1a10;
  --muted: #8a6a55;
  --orange: #e8742c;
  --orange2: #f39a3d;
  --gold: #f4c04e;
  --red: #c8432b;
  --green: #3f9a4a;
  --blue: #2f6fb3;
  --purple: #7b4fa8;
  --radius: 18px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 700px at 50% -10%, #6b3214 0%, var(--bg2) 45%, var(--bg) 100%) fixed;
  color: var(--card);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: 0; }
input { font-family: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.hidden { display: none !important; }

/* generic pieces */
.card { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 18px; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 18px; border-radius: 14px; font-size: 18px; font-weight: 800; background: var(--orange); color: #fff; box-shadow: 0 4px 0 #a54c17; transition: transform .05s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #a54c17; }
.btn.block { width: 100%; }
.btn.ghost { background: rgba(255,255,255,.12); color: var(--card); box-shadow: none; }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn.green { background: var(--green); box-shadow: 0 4px 0 #2a6b32; }
.btn.red { background: var(--red); box-shadow: 0 4px 0 #8b2c1b; }
.btn.gold { background: var(--gold); color: var(--ink); box-shadow: 0 4px 0 #b8872a; }
.btn:disabled { opacity: .5; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.14); font-size: 13px; font-weight: 700; }
.muted { color: var(--muted); }
.light-muted { color: rgba(255,247,236,.65); }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.big-emoji { font-size: 64px; line-height: 1; }
.timer { height: 8px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; }
.timer > i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); transform-origin: left; }
.card .timer { background: #f0dcc4; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: rgba(255,255,255,.14); padding: 6px 12px; border-radius: 99px; font-weight: 700; }
.chip.off { opacity: .45; }
.crown::before { content: "👑 "; }

/* scoreboard */
.score-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.score-list li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid rgba(0,0,0,.08); font-weight: 700; }
.score-list li .pos { width: 28px; text-align: center; font-size: 18px; }
.score-list li .nm { flex: 1; }
.score-list li .pts { font-variant-numeric: tabular-nums; }

/* answer buttons */
.opts { display: grid; gap: 10px; }
.opt { text-align: left; padding: 16px; border-radius: 14px; font-size: 18px; font-weight: 800; color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.opt.c0 { background: #d1493a; } .opt.c1 { background: #2f6fb3; } .opt.c2 { background: #d79a1c; } .opt.c3 { background: #3f9a4a; }
.opt .tag { display: inline-block; width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 8px; background: rgba(255,255,255,.25); margin-right: 8px; }
.opt.dim { opacity: .35; }
.opt.right { outline: 4px solid #fff; }
.opt.chosen { outline: 4px solid var(--gold); }

/* feud board */
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot { background: linear-gradient(#2f5aa8, #1f3f7d); color: #fff; border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; font-weight: 800; min-height: 48px; border: 2px solid #9fc0ff55; }
.slot.hidden-ans { background: linear-gradient(#22396a, #172a52); color: #9fb8e8; justify-content: center; }
.slot .p { background: rgba(0,0,0,.25); padding: 2px 8px; border-radius: 6px; }
.slot .by { display: block; font-size: 11px; opacity: .8; font-weight: 600; }

/* loteria */
.tabla { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; background: #8b2c1b; padding: 6px; border-radius: 12px; }
.lcard { position: relative; background: #fffaf2; border-radius: 6px; aspect-ratio: 3/4; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink); border: 2px solid #c8432b; padding: 2px; overflow: hidden; }
.lcard .e { font-size: clamp(22px, 8vw, 54px); line-height: 1.1; }
.lcard .n { font-size: clamp(8px, 2.5vw, 13px); font-weight: 800; text-align: center; line-height: 1.05; }
.lcard .num { position: absolute; top: 2px; left: 4px; font-size: 10px; font-weight: 800; color: var(--red); }
.lcard.marked::after { content: ""; position: absolute; width: 40%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #a0603a, #5a2c12 70%); box-shadow: 0 2px 4px rgba(0,0,0,.4); top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: .92; }
.lcard.win { box-shadow: 0 0 0 3px var(--gold) inset; }
.bigcard { background: #fffaf2; color: var(--ink); border: 6px solid var(--red); border-radius: 18px; aspect-ratio: 3/4; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.bigcard .num { position: absolute; top: 10px; left: 14px; font-weight: 900; color: var(--red); }

/* canvas */
.canvas-wrap { position: relative; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 0 rgba(0,0,0,.25); touch-action: none; }
.canvas-wrap canvas { display: block; width: 100%; height: auto; aspect-ratio: 4/3; touch-action: none; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--orange); }
.slots { font-size: 28px; letter-spacing: 6px; font-weight: 900; text-align: center; font-family: ui-monospace, Menlo, monospace; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(140%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; transition: transform .25s; z-index: 50; max-width: 92vw; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
#toast.show { transform: translateX(-50%) translateY(0); }

.letters { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.letters span { width: 40px; height: 48px; display: inline-flex; align-items: center; justify-content: center; background: var(--gold); color: var(--ink); border-radius: 8px; font-size: 26px; font-weight: 900; box-shadow: 0 4px 0 #b8872a; }

@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.pop { animation: pop .4s ease-out; }
@keyframes wiggle { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.wiggle { animation: wiggle 1s ease-in-out infinite; display: inline-block; }
