:root {
  --bg: #e6d9bb; --panel: #f0e6cc; --line: #1d1813; --text: #1d1813; --muted: #6a5d49;
  --accent: #a3171e; --accent-ink: #f3e9cf; --warn: #8a5a12; --bad: #a3171e; --dem: #2c5b55;
  --display: Impact, Haettenschweiler, "Arial Narrow Bold", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  --type: "American Typewriter", "Courier New", Courier, monospace;
  --serif: Georgia, "Times New Roman", serif;
  --shadow: 3px 3px 0 var(--line);
}
[data-phase="night"] {
  --bg: #100c0b; --panel: #1b1412; --line: #7d2a2c; --text: #eadcbf; --muted: #a99b82;
  --accent: #b3262d; --accent-ink: #f3e9cf; --warn: #d9a64a; --dem: #6fb0a4; --shadow: 3px 3px 0 #000;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; color: var(--text); font-family: var(--serif); }
body {
  min-height: 100dvh; display: flex; flex-direction: column; background-color: var(--bg);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .25  0 0 0 0 .18  0 0 0 0 .1  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(ellipse at 50% 0%, rgba(255,250,235,.45), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(60,35,10,.22), transparent 60%);
  transition: background-color .6s;
}
[data-phase="night"] body, body[data-phase="night"] { background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .6  0 0 0 0 .5  0 0 0 0 .4  0 0 0 .08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
#app { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px 28px; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .5rem; }
h1 { font-size: 2.2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.05rem; color: var(--accent); }
p { line-height: 1.5; margin: .4rem 0; }
.muted { color: var(--muted); font-family: var(--type); font-size: .92rem; } .center { text-align: center; }
.ic { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.22em; background: currentColor;
  -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.ic.big { width: 3.2rem; height: 3.2rem; }
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 2px; padding: 14px; margin: 14px 0; box-shadow: var(--shadow); position: relative; }
.card.event { border-color: var(--accent); border-style: double; border-width: 4px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--type); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 0 8px; border-bottom: 3px double var(--line); margin-bottom: 10px; }
.bar b { color: var(--text); font-family: var(--display); font-weight: 400; font-size: 1.1rem; letter-spacing: .06em; }
.timer { font-family: var(--type); font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
button, .btn { font-family: var(--display); font-size: 1.08rem; letter-spacing: .08em; text-transform: uppercase; border: 2px solid var(--line); background: var(--panel); color: var(--text); padding: 12px 14px; border-radius: 2px; cursor: pointer; width: 100%; min-height: 48px; box-shadow: var(--shadow); transition: transform .06s, box-shadow .06s; }
button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--line); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--line); }
button.selected { background: var(--text); color: var(--bg); }
button.danger { color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0; }
.row { display: flex; gap: 8px; margin: 10px 0; align-items: center; }
.row > * { flex: 1; }
input, select { font-family: var(--type); font-size: 1rem; width: 100%; padding: 12px; border-radius: 2px; border: 2px solid var(--line); background: rgba(255,252,240,.55); color: var(--text); min-height: 48px; }
input::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
[data-phase="night"] input, [data-phase="night"] select { background: #0a0807; }
label.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--muted); font-family: var(--type); font-size: .95rem; }
label.toggle input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
.code { font-family: var(--display); font-size: 4rem; letter-spacing: .25em; text-align: center; color: var(--accent); margin: 8px 0; padding: 4px 0 4px .25em; border: 3px double var(--line); background: var(--panel); }
.qr { display: block; margin: 8px auto; width: 168px; height: 168px; background: #f7f0dc; border: 2px solid var(--line); padding: 6px; }
.players { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { padding: 4px 9px; border: 1.5px solid var(--line); border-radius: 2px; font-family: var(--type); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; background: rgba(255,252,240,.5); }
[data-phase="night"] .chip { background: #0a0807; }
.chip.dead { opacity: .5; text-decoration: line-through; }
.chip.off::after { content: " ·"; color: var(--accent); }
.chip small { color: var(--muted); text-decoration: none; display: inline-block; margin-left: 4px; }
.reveal-card { text-align: center; user-select: none; -webkit-user-select: none; touch-action: none; padding: 26px 14px; min-height: 230px; }
.reveal-card.hidden .secret { display: none; }
.reveal-card.hidden .hint { display: block; }
.reveal-card .hint { display: none; color: var(--muted); font-family: var(--type); }
.narr { font-family: var(--type); font-size: 1.08rem; line-height: 1.5; border-left: 5px solid var(--accent); padding: 4px 0 4px 12px; margin: 14px 0; }
.feed { font-family: var(--type); font-size: .82rem; color: var(--muted); max-height: 150px; overflow: auto; }
.feed div { padding: 3px 0; border-bottom: 1px dashed var(--muted); }
.rumor { background: rgba(255,252,240,.55); border: 1px dashed var(--line); padding: 8px 10px; margin: 6px 0; font-family: var(--type); font-size: .95rem; }
[data-phase="night"] .rumor { background: #0a0807; }
.news { background: #f4ecd4; color: #1d1813; border: 4px double #1d1813; padding: 18px 14px; text-align: center; font-family: var(--serif); box-shadow: var(--shadow); }
.news .kicker { letter-spacing: .3em; font-size: .7rem; text-transform: uppercase; font-family: var(--type); }
.news h2 { font-family: var(--display); font-size: 1.9rem; margin: .4rem 0; line-height: 1.05; }
.overlay { position: fixed; inset: 0; background: rgba(8,5,5,.96); color: #eadcbf; display: flex; align-items: center; justify-content: center; text-align: center; font-family: var(--type); font-size: 1.4rem; z-index: 5; padding: 24px; }
.team-dem { color: var(--dem); } .team-fal { color: var(--accent); }
.tally div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--muted); font-family: var(--type); }
.err { position: fixed; left: 12px; right: 12px; bottom: 14px; background: var(--accent); color: var(--accent-ink); border: 2px solid #1d1813; padding: 10px 12px; z-index: 9; font-family: var(--type); box-shadow: var(--shadow); }

/* Portada: cartel */
.flagband { height: 22px; margin: 0 -16px; background: linear-gradient(#a3171e 0 30%, #1d1813 30% 70%, #a3171e 70%); border-bottom: 2px solid #1d1813; }
.masthead { display: flex; justify-content: space-between; font-family: var(--type); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; padding: 8px 0 6px; border-bottom: 3px double var(--line); color: var(--muted); }
.poster { margin: 18px 0 8px; background: var(--accent); color: var(--accent-ink); border: 3px solid var(--line); box-shadow: 6px 6px 0 var(--line); text-align: center; padding: 20px 12px 0; position: relative; overflow: hidden; }
.poster::before { content: ""; position: absolute; inset: 6px; border: 1.5px solid rgba(243,233,207,.55); pointer-events: none; }
.poster .crownwrap { position: relative; display: inline-block; }
.poster .crownwrap .ic.big { width: 3.6rem; height: 3.6rem; }
.poster .zz { position: absolute; right: -1.7rem; top: -.2rem; font-family: var(--display); color: var(--accent-ink); animation: zz 2.6s ease-in-out infinite; }
.poster .zz.b { right: -2.8rem; top: -1.1rem; font-size: 1.25rem; animation-delay: .9s; }
@keyframes zz { 0%,100% { opacity: .2; transform: translateY(4px); } 50% { opacity: 1; transform: translateY(-4px); } }
.poster h1 { font-size: clamp(3rem, 16vw, 4.4rem); line-height: .95; letter-spacing: .03em; white-space: nowrap; margin: 4px 0 0; text-shadow: 3px 3px 0 #1d1813; }
.poster .plate { background: #1d1813; color: #f3e9cf; font-family: var(--display); font-size: clamp(1.4rem, 8vw, 2rem); letter-spacing: .26em; padding: 8px 0 8px .3em; margin: 12px -12px 0; border-top: 3px solid #1d1813; }
.tag { font-family: var(--type); font-size: 1.02rem; line-height: 1.45; margin: 16px 4px 4px; text-align: center; }
.tag b { color: var(--accent); }
.vs { display: flex; justify-content: center; gap: 10px; align-items: center; margin: 12px 0 2px; font-family: var(--display); font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase; }
.vs .f { color: var(--accent); } .vs .d { color: var(--dem); } .vs .x { color: var(--muted); font-family: var(--type); font-size: .75rem; }
.stamp { position: absolute; left: 12px; top: 14px; transform: rotate(-8deg); border: 2px solid var(--accent-ink); padding: 1px 7px; font-family: var(--display); font-size: .8rem; letter-spacing: .16em; opacity: .85; }
.joinrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.joinrow button { width: auto; padding: 12px 22px; }
button.big { min-height: 64px; font-size: 1.5rem; }
