:root {
  --red: #e31e24;
  --red-soft: #fff1f1;
  --navy: #241e8a;
  --navy-2: #16145c;
  --ink: #16161d;
  --muted: #5c6270;
  --line: #e7e9f0;
  --bg: #f3f5fa;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(22, 20, 92, 0.08);
  --radius: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: "Be Vietnam Pro", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(1200px 500px at 50% -120px, rgba(36,30,138,.16), transparent 60%),
    linear-gradient(180deg, #eef0f8 0%, var(--bg) 40%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input { font-family: inherit; }
.wrap { width: min(720px, calc(100% - 28px)); margin: 0 auto; padding: 20px 0 120px; }
.brand {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 12px 0 18px;
}
.brand img { width: min(220px, 58vw); height: auto; }
.kicker {
  letter-spacing: .18em; text-transform: uppercase; font-size: 11px; font-weight: 700;
  color: var(--navy); margin-top: 6px;
}
h1 {
  font-size: clamp(22px, 5.4vw, 32px); line-height: 1.2; color: var(--navy-2); font-weight: 800;
}
h1 span { color: var(--red); display: block; }
.intro { color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 520px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.search {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px 13px 42px;
  font-size: 15px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%235c6270' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3-3'/%3E%3C/svg%3E") 14px 50% no-repeat;
  outline: none;
}
.search:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(36,30,138,.12); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 12px 0 4px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.player {
  display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center;
  border: 1.5px solid var(--line); background: #fff; border-radius: 16px; padding: 10px 12px;
  cursor: pointer; text-align: left; width: 100%; transition: .15s ease;
}
.player:hover { border-color: #c9cde0; transform: translateY(-1px); }
.player.selected {
  border-color: var(--red); background: var(--red-soft);
  box-shadow: 0 0 0 3px rgba(227,30,36,.12);
}
.num {
  width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.02em;
}
.nick { font-weight: 800; font-size: 15px; }
.meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.team {
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 5px 8px; color: #fff;
}
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cfd3e0; display: grid; place-items: center;
  color: transparent; font-size: 12px;
}
.player.selected .check { background: var(--red); border-color: var(--red); color: #fff; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 15px; outline: none;
}
.field input:focus { border-color: var(--navy); }
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 14px 18px;
  background: linear-gradient(180deg, transparent, #f3f5fa 28%);
}
.btn {
  width: min(720px, calc(100% - 0px)); margin: 0 auto; display: flex; align-items: center; justify-content: center;
  gap: 8px; border: 0; border-radius: 16px; padding: 16px 18px; font-size: 16px; font-weight: 800;
  color: #fff; background: linear-gradient(180deg, #f03a3f, var(--red)); cursor: pointer;
  box-shadow: 0 10px 20px rgba(227,30,36,.28);
}
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.navy { background: linear-gradient(180deg, #3a34a8, var(--navy)); box-shadow: 0 10px 20px rgba(36,30,138,.28); }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); box-shadow: none; }
.done {
  min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 10px; padding: 40px 18px;
}
.done .mark {
  width: 74px; height: 74px; border-radius: 50%; background: #e9f8ee; color: #14804a;
  display: grid; place-items: center; font-size: 34px; margin-bottom: 8px;
}
.hidden { display: none !important; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--navy-2); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 13px;
  max-width: 86vw; z-index: 20;
}
.req { color: var(--red); }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type {
  border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 10px;
  cursor: pointer; text-align: center; font-weight: 700; font-size: 13px;
}
.type.on { border-color: var(--navy); background: #eef0fb; color: var(--navy-2); }
.who { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.who b { color: var(--ink); }
.table-wrap { overflow: auto; max-height: 520px; }
table.voters { width: 100%; border-collapse: collapse; font-size: 13px; }
table.voters th { text-align: left; font-size: 11px; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
table.voters td { padding: 9px 6px; border-bottom: 1px solid #f0f1f6; vertical-align: middle; }
table.voters tr.warn td { background: #fff8e6; }
table.voters tr.invalid td { color: #999; text-decoration: line-through; }
table.voters button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 8px; cursor: pointer; font-size: 12px; font-weight: 700; }
.tabs { display: flex; gap: 8px; margin: 8px 0 12px; }
.tab { border: 0; background: transparent; font-weight: 700; color: var(--muted); padding: 8px 2px; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.on { color: var(--navy); border-bottom-color: var(--navy); }

/* admin */
.topbar {
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(10px);
  background: rgba(243,245,250,.9); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(980px, calc(100% - 28px)); margin: 0 auto; padding: 12px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat { padding: 16px; }
.stat b { display: block; font-size: 28px; color: var(--navy-2); }
.stat span { color: var(--muted); font-size: 12px; font-weight: 600; }
.rank { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid; grid-template-columns: 36px 1fr 64px; gap: 10px; align-items: center;
  padding: 10px 12px;
}
.bar { height: 8px; background: #eceef5; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), var(--red)); border-radius: 99px; }
.lock {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.lock .card { width: min(380px, 100%); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #14804a; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.18); }
.btn.danger { background: linear-gradient(180deg, #f03a3f, var(--red)); color: #fff; box-shadow: 0 8px 16px rgba(227,30,36,.22); }
.danger-card { border: 1.5px solid #f3c4c6; background: #fff8f8; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(22,20,92,.45); z-index: 30;
  display: grid; place-items: center; padding: 20px;
}
.modal { width: min(420px, 100%); }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.admin-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  background: var(--navy-2); color: #fff; padding: 12px 14px; border-radius: 12px; font-size: 13px; font-weight: 700;
}

/* poster */
.poster-page { background: #d9dce8; }
.sheet {
  width: min(794px, calc(100% - 24px)); margin: 24px auto; background: #fff; border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0,0,0,.15); overflow: hidden;
}
.sheet img.full { width: 100%; display: block; }
.toolbar {
  width: min(794px, calc(100% - 24px)); margin: 16px auto 0; display: flex; gap: 8px; justify-content: center;
}
@media print {
  .toolbar, .no-print { display: none !important; }
  body, .poster-page { background: #fff; }
  .sheet { width: 100%; margin: 0; box-shadow: none; border-radius: 0; }
  @page { size: A4; margin: 0; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .num { width: 48px; height: 48px; font-size: 16px; }
}
