:root {
  --bg: #FBF3E4;
  --card: #FFFFFF;
  --ink: #2A1A0E;
  --muted: #6B5640;
  --line: #E8D5B5;
  --amber: #F2A91E;
  --pumpkin: #E4691C;
  --pumpkin-ink: #9A410A;
  --blue: #1F5FA6;
  --navy: #123A6B;
  --win: #1E5A22;
  --win-line: #2E7D32;
  --win-bg: #E4F2DF;
  --sel-bg: #FFE9C2;
  --danger: #A32018;
  --display: 'Alfa Slab One', Georgia, serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 17px/1.4 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1 { font: 400 30px/1.1 var(--display); color: var(--navy); margin: 0 0 4px; }
h2 { font: 400 19px/1.2 var(--display); color: var(--navy); margin: 22px 0 8px; }
p { margin: 6px 0; }
.wrap { max-width: 520px; margin: 0 auto; padding: 16px 20px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.err { color: var(--danger); font-size: 15px; min-height: 1.2em; }

/* Bavarian lozenge strip */
.loz {
  height: 14px; background-color: #fff;
  background-image:
    linear-gradient(45deg, var(--blue) 25%, transparent 25%, transparent 75%, var(--blue) 75%),
    linear-gradient(45deg, var(--blue) 25%, transparent 25%, transparent 75%, var(--blue) 75%);
  background-size: 14px 14px; background-position: 0 0, 7px 7px;
}

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--navy); font: 400 20px/1 var(--display); }
.chip { font-size: 13px; font-weight: 700; color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 99px; padding: 5px 12px; }
.chip.live { background: var(--win-bg); color: var(--win); border-color: var(--win-bg); }
.chip.setup { background: var(--sel-bg); color: #7A3306; border-color: var(--sel-bg); }
.kicker { display: flex; align-items: center; gap: 8px; color: var(--pumpkin-ink); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }

.card { background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 14px; margin: 10px 0; }

button, input, select { font: inherit; color: inherit; }
input[type=text], input[type=password], input:not([type]), select {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card); margin: 5px 0; font-size: 18px;
}
input:focus-visible, button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
label { font-weight: 700; font-size: 15px; }
.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 58px;
  border: 0; border-radius: 18px; padding: 0 16px; margin: 12px 0 4px;
  background: var(--amber); color: var(--ink); font-weight: 700; font-size: 19px; cursor: pointer;
}
.cta:active { transform: scale(.98); }
.cta.quiet { background: var(--card); border: 2px solid var(--line); font-weight: 700; font-size: 18px; }
.cta.locked { background: var(--win-bg); border: 2px solid var(--win-line); color: var(--win); cursor: default; }
.cta.danger { background: var(--danger); color: #fff; }
.btn {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px;
  padding: 9px 12px; font-weight: 700; cursor: pointer;
}
.btn.sm { padding: 6px 12px; font-size: 14px; min-height: 36px; }
.btn.danger { color: var(--danger); }

/* join */
.join { padding-top: 48px; }
.logo { width: 72px; height: 72px; border-radius: 22px; background: var(--navy); color: var(--amber); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.hero { font-size: 44px; line-height: 1.02; margin: 0 0 12px; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 28px; }

/* voting cards */
.beer {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%;
  min-height: 172px; margin: 8px 0; padding: 18px 20px; text-align: center; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-radius: 24px; color: var(--ink);
}
.beer .tag { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--pumpkin-ink); }
.beer .name { font: 400 28px/1.1 var(--display); }
.beer .sub { color: var(--muted); font-size: 15px; }
.beer.sel { border: 3px solid var(--amber); background: var(--sel-bg); }
.beer.won { border: 3px solid var(--win-line); background: var(--win-bg); cursor: default; }
.beer .count { font: 400 64px/1 var(--display); color: var(--win); }
.beer.won .name { font-size: 24px; }
.beer.won .sub { color: #3F5A3F; }
.badge {
  position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px 0 8px; border-radius: 99px; background: var(--ink); color: #FBF3E4; font-size: 13px; font-weight: 700;
}
.badge svg { stroke: var(--amber); }
.badge.round { width: 30px; padding: 0; justify-content: center; }
.badge.win { left: 12px; right: auto; background: var(--win); color: #fff; }
.badge.win svg { stroke: #fff; }
.vs { display: flex; align-items: center; gap: 12px; margin: 4px 0; }
.vs i { flex: 1; height: 2px; background: var(--line); }
.vs span { font: 400 14px/1 var(--display); letter-spacing: .12em; color: var(--navy); }
.runner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 96px; padding: 0 22px; border: 2px solid var(--line); border-radius: 20px; background: var(--card); color: var(--muted); margin: 8px 0; }
.runner .rname { display: block; font: 400 20px/1.1 var(--display); }
.runner .rcount { font: 400 36px/1 var(--display); }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--pumpkin); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* waiting */
.waiting { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding-top: 28px; }
.waiting .ring { width: 96px; height: 96px; border-radius: 50%; background: var(--sel-bg); color: #B8500E; display: flex; align-items: center; justify-content: center; }
.waiting p { color: var(--muted); font-size: 17px; max-width: 280px; }
.upnext { width: 100%; text-align: left; margin-top: 18px; padding: 18px; }
.upnext .vsline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.upnext .b { font: 400 22px/1.15 var(--display); }
.upnext .v { font-size: 13px; font-weight: 700; letter-spacing: .1em; color: var(--blue); }

/* bracket */
.round-title { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.bm { background: var(--card); border: 2px solid var(--line); border-radius: 14px; margin: 8px 0; overflow: hidden; }
.bm.live { border: 3px solid var(--amber); }
.bm.pending { border: 2px dashed #CDB48B; }
.bm .side { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 700; }
.bm .side + .side { border-top: 1.5px solid var(--line); }
.bm.pending .side + .side { border-top: 1.5px dashed #CDB48B; }
.bm .side.w { background: var(--win-bg); color: var(--win); }
.bm .side.l { color: var(--muted); font-weight: 400; }
.bm .side.tbd { color: var(--muted); font-style: italic; font-weight: 400; }
.bm.bye { opacity: .6; }
.livepill { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pumpkin-ink); }

/* tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card);
  border-top: 1.5px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; border: 0; background: none; height: 64px; font-weight: 700; color: var(--muted); cursor: pointer; font-size: 16px;
}
.tabs button.on { color: #B8500E; box-shadow: inset 0 3px 0 var(--amber); }

.banner { text-align: center; background: var(--sel-bg); border-radius: 10px; padding: 6px; font-size: 14px; margin-bottom: 10px; }
canvas#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

/* champion */
body.champ { background: var(--navy); color: #FBF3E4; }
body.champ .brand { color: #FBF3E4; }
body.champ .chip { background: var(--blue); color: #fff; border-color: var(--blue); }
body.champ .tabs { background: #0D2C54; border-color: var(--blue); }
body.champ .tabs button { color: #CFE0F5; }
body.champ .tabs button.on { color: var(--amber); }
.champion { min-height: calc(100dvh - 190px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.champion .medal { width: 132px; height: 132px; border-radius: 50%; background: var(--amber); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.champion .ck { font-size: 14px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.champion h1 { color: #FBF3E4; font-size: 46px; line-height: 1.05; margin: 0; }
.champion .by { color: #CFE0F5; font-size: 18px; margin: 0; }
.champion .score { margin-top: 8px; padding: 10px 18px; border-radius: 99px; background: var(--blue); color: #fff; font-weight: 700; }

/* admin */
.row { display: flex; gap: 8px; align-items: center; }
.row > * { min-width: 0; }
.row .grow { flex: 1; }
.list { padding: 0 14px; }
.list .item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; border-top: 1.5px solid var(--line); }
.list .item:first-child { border-top: 0; }
.bar { height: 14px; border-radius: 99px; background: #F1E4CB; overflow: hidden; margin: 4px 0 10px; }
.bar > i { display: block; height: 100%; background: var(--amber); }
.bar.b > i { background: var(--blue); }
.qr { background: #fff; padding: 10px; border-radius: 12px; display: inline-block; }
.card.liveCard { border: 3px solid var(--amber); border-radius: 22px; padding: 16px; }
