:root {
  --char: #141210;
  --char-2: #221c18;
  --red: #e10600;
  --red-deep: #6d090c;
  --cream: #f3e6c4;
  --yellow: #ffd23a;
  --ink: #1a1203;
  --white: #fff8ea;
  --muted: #cbbfa3;
  --gold: #ffd23a;
  --silver: #d7d7d7;
  --bronze: #d08a4c;
  --board-scale: 1;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100dvh;
  background-color: #121212;
  background-image: url("/assets/texture.png");
  background-size: 420px auto;
  color: var(--white);
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 18px;
}
#noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
#app { position: relative; z-index: 1; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--yellow); }
img { max-width: 100%; }

.shell {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 1.15rem 1.05rem 7.2rem;
}
.shell.tight { padding-bottom: 2rem; }
.brand { text-align: center; margin: 0.2rem 0 1rem; }
.brand-link { text-decoration: none; color: inherit; display: block; }
.logo-lockup { width: min(100%, 340px); height: auto; display: block; margin: 0 auto; }
.brand.compact .logo-lockup { width: 230px; }
.bmc {
  font-family: "Bungee", "Arial Black", Impact, sans-serif;
  color: var(--red);
  font-size: clamp(4rem, 18vw, 5.4rem);
  line-height: 0.82;
  letter-spacing: 0.02em;
  margin: 0;
  text-shadow: 0 3px 0 #4a0508, 0 12px 28px rgba(225, 6, 0, 0.28);
}
.smash {
  margin: 0.35rem 0 0;
  color: var(--cream);
  font-weight: 700;
  letter-spacing: 0.28em;
  font-size: 1.25rem;
  text-transform: uppercase;
}
.where {
  margin: 0.25rem 0 0;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.95rem;
}
.brand.compact .bmc { font-size: 2.4rem; }
.brand.compact .smash { font-size: 0.95rem; letter-spacing: 0.22em; }
.brand.compact .where { display: none; }

.stroke { text-align: center; margin: 0.4rem 0 0.8rem; }
.stroke span {
  font-family: "Bangers", "Arial Black", cursive;
  font-size: 2.15rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: var(--yellow);
  display: inline-block;
  padding: 0.12rem 0.95rem 0.22rem;
  border-radius: 46% 54% 42% 58% / 70% 50% 78% 46%;
  transform: rotate(-1.5deg);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.28);
  padding: 0.28rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--cream);
  border-radius: 999px;
  padding: 0.55rem 0.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tabs button.on { background: var(--yellow); color: var(--ink); }

.mayor {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border-radius: 1.15rem;
  background:
    radial-gradient(circle at 0 0, rgba(255, 210, 58, 0.28), transparent 55%),
    #231910;
  border: 2px solid var(--yellow);
  margin-bottom: 1rem;
}
.mayor .crown, .name .crown {
  width: 36px;
  height: 36px;
  color: var(--yellow);
  flex: none;
}
.name .crown { width: 16px; height: 16px; margin-left: 0.25rem; vertical-align: -2px; }
.kicker {
  margin: 0;
  color: var(--yellow);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.85rem;
}
.mayor-name { margin: 0; font-family: "Bungee", Impact, sans-serif; font-size: 1.25rem; }
.sub { margin: 0.1rem 0 0; color: var(--cream); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.row {
  display: grid;
  grid-template-columns: 2.3rem 3rem 1fr auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.65rem 0.7rem;
  border-radius: 1rem;
  background: rgba(255, 248, 234, 0.04);
  border: 1px solid rgba(243, 230, 196, 0.08);
}
.row.gold {
  background: linear-gradient(90deg, rgba(255, 210, 58, 0.24), rgba(255, 248, 234, 0.04));
  border-color: rgba(255, 210, 58, 0.75);
}
.row.silver {
  background: linear-gradient(90deg, rgba(215, 215, 215, 0.16), rgba(255, 248, 234, 0.03));
  border-color: rgba(215, 215, 215, 0.7);
}
.row.bronze {
  background: linear-gradient(90deg, rgba(208, 138, 76, 0.22), rgba(255, 248, 234, 0.03));
  border-color: rgba(208, 138, 76, 0.8);
}
.rank {
  font-family: "Bungee", Impact, sans-serif;
  font-size: 1.25rem;
  text-align: center;
  color: var(--cream);
}
.row.gold .rank { color: var(--gold); }
.row.silver .rank { color: var(--silver); }
.row.bronze .rank { color: var(--bronze); }
.name { font-weight: 700; font-size: 1.35rem; letter-spacing: 0.02em; display: flex; align-items: center; }
.count { text-align: right; }
.count strong {
  display: block;
  font-family: "Bungee", Impact, sans-serif;
  font-size: 1.35rem;
  color: var(--yellow);
  font-weight: 400;
}
.count span { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--red);
  color: var(--cream);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  font-family: "Bungee", Impact, sans-serif;
  box-shadow: inset 0 0 0 2px rgba(255, 248, 234, 0.2);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.row.gold .avatar { width: 3.25rem; height: 3.25rem; }

.dock {
  position: fixed;
  z-index: 5;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  padding: 0.8rem 1.05rem calc(0.85rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(14, 12, 11, 0.94) 28%);
}
.fine {
  text-align: center;
  margin: 0.7rem 0 0;
  color: var(--cream);
}
.fine a { font-weight: 700; }
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  margin-top: 1.2rem;
}
.loading { text-align: center; color: var(--cream); }

.btn, .btn-secondary, .btn-ghost {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  border-radius: 999px;
  text-decoration: none;
  border: 0;
  padding: 0.95rem 1rem 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.btn {
  font-family: "Bungee", Impact, sans-serif;
  background: var(--red);
  color: white;
  box-shadow: 0 6px 0 var(--red-deep);
}
.btn:active { transform: translateY(2px); box-shadow: 0 4px 0 var(--red-deep); }
.btn:disabled { opacity: 0.65; transform: none; }
.btn-secondary {
  font-weight: 700;
  background: transparent;
  color: var(--yellow);
  border: 2px solid var(--yellow);
}
.btn-ghost {
  font-weight: 700;
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(243, 230, 196, 0.25);
}
.stack { display: grid; gap: 0.7rem; }
.actions { display: grid; gap: 0.45rem; }

form.stack label, .field {
  display: grid;
  gap: 0.3rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream);
  font-size: 0.92rem;
}
input, select {
  width: 100%;
  background: var(--char-2);
  border: 1px solid rgba(243, 230, 196, 0.28);
  border-radius: 0.8rem;
  padding: 0.8rem 0.85rem;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
  font-weight: 600;
}
input:focus, select:focus { outline: 2px solid var(--yellow); border-color: transparent; }
.hint { margin: 0; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 1rem; }
.banner {
  margin: 0 0 0.8rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.9rem;
  background: rgba(255, 210, 58, 0.12);
  color: var(--cream);
}
.banner.bad { background: rgba(225, 6, 0, 0.18); color: #ffd0cc; }
.banner.good { background: rgba(255, 210, 58, 0.16); color: var(--yellow); }
.photo-row { display: flex; gap: 0.8rem; align-items: center; }
.preview {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 0.8rem;
  object-fit: cover;
  background: #2a2420;
}
h1.page-title {
  font-family: "Bangers", cursive;
  font-weight: 400;
  font-size: 2.4rem;
  margin: 0.2rem 0 0.3rem;
  letter-spacing: 0.02em;
}
.lede { margin: 0 0 1rem; color: var(--cream); font-size: 1.15rem; }

.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.55rem; }
.badge {
  background: rgba(255, 248, 234, 0.04);
  border: 1px solid rgba(243, 230, 196, 0.12);
  border-radius: 0.9rem;
  padding: 0.55rem 0.35rem 0.45rem;
  text-align: center;
  color: var(--muted);
}
.badge.earned { color: var(--ink); background: var(--yellow); border-color: var(--yellow); }
.badge svg { width: 28px; height: 28px; display: block; margin: 0 auto 0.15rem; }
.badge strong { display: block; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.badge em { display: block; font-style: normal; font-size: 0.75rem; letter-spacing: 0; text-transform: none; font-weight: 500; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.history li {
  display: flex;
  justify-content: space-between;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid rgba(243, 230, 196, 0.12);
}

.panel {
  background: rgba(255, 248, 234, 0.04);
  border: 1px solid rgba(243, 230, 196, 0.12);
  border-radius: 1rem;
  padding: 0.9rem;
  margin-bottom: 0.8rem;
}
.panel h2 { margin: 0 0 0.6rem; font-size: 1.2rem; letter-spacing: 0.08em; text-transform: uppercase; }
.toggle { display: flex; justify-content: space-between; gap: 0.8rem; align-items: center; text-transform: none; letter-spacing: 0; font-size: 1.05rem; font-weight: 600; }
.member { margin-bottom: 0.55rem; }
.member summary { cursor: pointer; list-style: none; }
.member summary::-webkit-details-marker { display: none; }
.chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 2px;
}
.inline { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.inline .btn, .inline .btn-ghost, .inline .btn-secondary { width: auto; padding-inline: 0.85rem; }

.qr-wrap {
  background: white;
  border-radius: 1.2rem;
  padding: 0.8rem;
  display: grid;
  place-items: center;
}
.qr-wrap svg { width: min(100%, 320px); height: auto; }
.qr-page { text-align: center; }
.mode {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
}
.url { word-break: break-all; color: var(--muted); font-size: 0.95rem; }

.celebrate {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(8, 6, 5, 0.94);
  display: grid;
  place-items: center;
  padding: 1.4rem;
  text-align: center;
}
.celebrate .card { width: min(420px, 100%); }
.celebrate h2 {
  font-family: "Bangers", cursive;
  font-weight: 400;
  color: var(--yellow);
  font-size: 3.3rem;
  line-height: 0.92;
  margin: 0.2rem 0 0.6rem;
}
.celebrate .crown { width: 84px; height: 84px; color: var(--yellow); }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  background: var(--yellow);
  animation: fall 1.5s ease-in forwards;
}
.confetti i:nth-child(odd) { background: var(--red); }
.confetti i:nth-child(1) { left: 8%; animation-delay: 0s; }
.confetti i:nth-child(2) { left: 18%; animation-delay: 0.1s; }
.confetti i:nth-child(3) { left: 30%; animation-delay: 0.05s; }
.confetti i:nth-child(4) { left: 42%; animation-delay: 0.2s; }
.confetti i:nth-child(5) { left: 55%; animation-delay: 0.08s; }
.confetti i:nth-child(6) { left: 66%; animation-delay: 0.16s; }
.confetti i:nth-child(7) { left: 76%; animation-delay: 0.02s; }
.confetti i:nth-child(8) { left: 88%; animation-delay: 0.12s; }
@keyframes fall { to { transform: translateY(80vh) rotate(160deg); opacity: 0.3; } }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body.view-board { overflow: hidden; background: #0c0b0a; }
body.view-board #noise { opacity: 0.12; }
.board-fit {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
}
.board {
  width: 1920px;
  height: 1080px;
  transform: scale(var(--board-scale));
  transform-origin: center center;
  padding: 42px 56px 28px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
  background: #121212 url("/assets/texture.png");
  background-size: 420px auto;
  box-shadow: 0 0 0 8px #0c0b0a;
}
.board-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.board .logo-lockup { width: 480px; margin: 0; }
.board .bmc { font-size: 108px; text-align: left; }
.board .smash { font-size: 36px; letter-spacing: 0.24em; text-align: left; }
.board .where { text-align: left; font-size: 22px; }
.board-side { text-align: right; color: var(--cream); font-size: 28px; letter-spacing: 0.08em; text-transform: uppercase; }
.board-mayor {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 3px solid var(--yellow);
  border-radius: 22px;
  padding: 12px 22px;
  background: rgba(255, 210, 58, 0.08);
}
.board-mayor .crown { width: 54px; height: 54px; color: var(--yellow); }
.board-mayor .mayor-name { font-size: 40px; }
.board-mayor .kicker { font-size: 18px; }
.board-mayor .sub { font-size: 26px; }
.board-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.board .stroke { text-align: left; margin: 0; }
.board .stroke span { font-size: 54px; }
.board-list { display: grid; grid-template-rows: repeat(10, minmax(0, 1fr)); gap: 6px; min-height: 0; overflow: hidden; }
.board-row {
  display: grid;
  grid-template-columns: 72px 64px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 0 18px;
  border-radius: 14px;
  background: rgba(255, 248, 234, 0.04);
}
.board-row .rank { font-size: 32px; }
.board-row .avatar { width: 46px; height: 46px; font-size: 18px; }
.board-row .name { font-size: 32px; }
.board-row .count strong { font-size: 34px; }
.board-row.gold { background: linear-gradient(90deg, rgba(255, 210, 58, 0.28), rgba(255, 248, 234, 0.04)); }
.board-row.silver { background: linear-gradient(90deg, rgba(215, 215, 215, 0.16), rgba(255, 248, 234, 0.03)); }
.board-row.bronze { background: linear-gradient(90deg, rgba(208, 138, 76, 0.24), rgba(255, 248, 234, 0.03)); }
.board-row.empty { color: rgba(243, 230, 196, 0.35); }
.board-foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 22px; letter-spacing: 0.08em; text-transform: uppercase; background: #121212; }

@media (prefers-reduced-motion: reduce) {
  .confetti i { animation: none; display: none; }
  .btn:active { transform: none; }
}

@media print {
  body, body.view-print { background: white !important; color: #1a1203; }
  #noise, .no-print { display: none !important; }
  .shell { padding: 0; width: 100%; }
  .qr-sheet { box-shadow: none; }
  .bmc { text-shadow: none; }
  .smash, .where, .lede, .url { color: #1a1203; }
}
