:root {
  --red: #e63946;
  --red-dark: #c1121f;
  --red-light: #fff0f1;
  --gold: #f4a261;
  --gold-dark: #e76f51;
  --green: #2a9d8f;
  --bg: #f8f7f4;
  --bg2: #f0ede8;
  --white: #ffffff;
  --card: #ffffff;
  --border: #e8e3dc;
  --border-dark: #d4cec6;
  --text: #1a1a1a;
  --text-2: #4a4540;
  --text-3: #8a8480;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow: 0 2px 12px rgba(0,0,0,0.08), 0 4px 24px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

/* ===== Auth ===== */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}

.auth-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-head {
  text-align: center;
  margin-bottom: 32px;
}

.auth-head h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.auth-head p {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 4px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field label .hint {
  font-weight: 400;
  color: var(--text-3);
  font-size: 12px;
}

.input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.input:focus {
  border-color: var(--red);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(230,57,70,0.08);
}

.input::placeholder { color: var(--text-3); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-red {
  background: var(--red);
  color: white;
  width: 100%;
  box-shadow: 0 2px 8px rgba(230,57,70,0.25);
}
.btn-red:hover { background: var(--red-dark); box-shadow: 0 4px 12px rgba(230,57,70,0.35); }
.btn-red:active { transform: scale(0.99); }

.btn-gold {
  background: var(--gold);
  color: white;
  box-shadow: 0 2px 8px rgba(244,162,97,0.3);
}
.btn-gold:hover { background: var(--gold-dark); }

.btn-outline {
  background: white;
  border: 1.5px solid var(--border-dark);
  color: var(--text-2);
}
.btn-outline:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-3);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg2); color: var(--text-2); }

.btn-danger-soft {
  background: var(--red-light);
  color: var(--red);
  border: 1.5px solid #ffc8cc;
}
.btn-danger-soft:hover { background: #ffe0e2; }

.btn-green {
  background: var(--green);
  color: white;
  box-shadow: 0 2px 8px rgba(42,157,143,0.3);
}
.btn-green:hover { background: #218a7d; }

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-icon { padding: 8px; border-radius: 8px; line-height: 1; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.auth-foot {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-3);
}
.auth-foot a { color: var(--red); text-decoration: none; font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }

.notice {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.notice.show { display: block; }
.notice-error { background: #fff0f1; border: 1px solid #ffc8cc; color: #c1121f; }
.notice-success { background: #f0faf8; border: 1px solid #b7e4de; color: #1e7a6e; }

/* ===== App Shell ===== */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: 58px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 1;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--red);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 12px 5px 6px;
}

.user-av {
  width: 24px;
  height: 24px;
  background: var(--red);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-chip span { font-size: 13px; font-weight: 500; color: var(--text-2); }

.content {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  padding: 28px 20px;
}

/* ===== Tabs ===== */
.tab-row {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 28px;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tab-row::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 18px;
  white-space: nowrap;
  flex-shrink: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  font-family: inherit;
}

.tab-btn.on {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 600;
}

.tab-pane { display: none; }
.tab-pane.on { display: block; }

/* ===== Round Card ===== */
.r-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.r-card-top {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.r-title { font-size: 17px; font-weight: 700; color: var(--text); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-drawing { background: #fff0f1; color: var(--red); }
.badge-done { background: #f0faf8; color: #1e7a6e; }

.r-body { padding: 22px; }

/* ===== Prize Info ===== */
.prize-row {
  display: flex;
  gap: 20px;
  margin-bottom: 22px;
}

.prize-thumb {
  width: 140px;
  height: 110px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
}

.prize-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prize-meta { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }

.prize-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prize-price {
  font-size: 26px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: -0.5px;
}
.prize-price span { font-size: 15px; font-weight: 500; color: var(--text-3); margin-left: 2px; }

.prize-time { font-size: 13px; color: var(--text-3); }

/* ===== Countdown ===== */
.cd-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cd-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  text-align: center;
  min-width: 58px;
}

.cd-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  font-family: 'SF Mono', 'Courier New', monospace;
}

.cd-unit { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ===== Wheel Section ===== */
.wheel-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 22px;
}

.wheel-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.wheel-arrow {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 22px solid var(--red);
  filter: drop-shadow(0 2px 4px rgba(230,57,70,0.4));
}

#wheelCanvas {
  border-radius: 50%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 0 3px var(--border);
  display: block;
}

.wheel-hub {
  position: absolute;
  width: 36px;
  height: 36px;
  background: white;
  border: 3px solid var(--border-dark);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 10;
}

.wheel-result-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.wheel-result-box.is-winner {
  border-color: var(--gold);
  background: #fffbf5;
}

.winner-label { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.winner-nm {
  font-size: 28px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}
.winner-prize { font-size: 13px; color: var(--text-3); }

/* ===== Participants ===== */
.part-section { margin-bottom: 20px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.count-chip {
  background: var(--bg2);
  color: var(--text-3);
  border-radius: 100px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.part-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Participant entry card */
.part-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  line-height: 1.3;
}

.part-name { font-weight: 600; }
.part-sep  { color: var(--border-dark); font-size: 11px; }

.part-prob {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
}

.part-prob.high { color: var(--red); }
.part-prob.med  { color: var(--gold-dark); }

.part-pity {
  font-size: 10px;
  color: var(--gold-dark);
  background: #fef3c7;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

.part-tag.me {
  border-color: var(--red);
  background: var(--red-light);
}
.part-tag.me .part-name { color: var(--red); }

.part-tag.won {
  border-color: var(--gold-dark);
  background: #fffbf5;
}
.part-tag.won .part-name { color: var(--gold-dark); }

/* Banned / sanctioned */
.part-tag.banned {
  border-color: #d1d5db;
  background: #f9fafb;
  opacity: 0.85;
}
.part-tag.banned .part-name {
  color: #9ca3af;
  text-decoration: line-through;
}
.part-ban-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.part-ban-normal {
  font-size: 11px;
  color: #9ca3af;
}
.part-ban-zero {
  font-size: 11px;
  color: var(--red);
  font-weight: 600;
}


/* Grape sanction banner */
.sanctioned-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.sanctioned-banner.is-banned {
  background: #fdf2f8;
  border-color: #f5d0fe;
}
.sanctioned-banner .sb-icon { font-size: 28px; flex-shrink: 0; }
.sanctioned-banner .sb-text h4 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.sanctioned-banner .sb-text p  { font-size: 12px; color: var(--text-3); }

/* Pity info */
.pity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fffbf5;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}
.pity-row .pity-icon { font-size: 16px; }
.pity-row .pity-main { flex: 1; }
.pity-row .pity-cnt { font-weight: 700; color: var(--gold-dark); }
.pity-row .pity-mult { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ===== History ===== */
.hist-list { display: flex; flex-direction: column; gap: 10px; }

.hist-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.hist-num {
  width: 36px;
  height: 36px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.hist-info { flex: 1; min-width: 0; }
.hist-title { font-size: 14px; font-weight: 600; color: var(--text); }
.hist-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.hist-win { text-align: right; flex-shrink: 0; }
.hist-win-label { font-size: 11px; color: var(--text-3); }
.hist-win-name { font-size: 15px; font-weight: 700; color: var(--red); margin-top: 1px; }

/* ===== Empty State ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty .e-icon { font-size: 52px; display: block; margin-bottom: 14px; opacity: 0.5; }
.empty h3 { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty p { font-size: 13px; }

/* ===== Admin ===== */
.admin-shell { min-height: 100vh; display: flex; flex-direction: column; }

.admin-bar {
  height: 58px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-title .dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

.admin-content {
  flex: 1;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  padding: 28px 20px;
}

.a-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 28px;
}

.a-tab {
  padding: 10px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.a-tab.on { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }

.a-pane { display: none; }
.a-pane.on { display: block; }

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.stat-val { font-size: 32px; font-weight: 800; color: var(--text); letter-spacing: -1px; line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* Section card */
.s-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.s-card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.s-card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.s-card-body { padding: 20px; }

/* Form */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f-group { margin-bottom: 14px; }
.f-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
}
.f-hint { font-size: 11px; font-weight: 400; color: var(--text-3); }

.quick-time-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.quick-time-btns button {
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--red);
  background: var(--red-light);
  border: 1px solid #ffc8cc;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.6;
  transition: background 0.12s;
}
.quick-time-btns button:hover {
  background: #ffd6d9;
}

/* ===== Honor Wall ===== */
.honor-wall { display: flex; flex-direction: column; gap: 20px; }

.hw-stats {
  display: flex;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.hw-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 12px;
  border-right: 1px solid var(--border);
}
.hw-stat:last-child { border-right: none; }
.hw-stat-val { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; line-height: 1; }
.hw-stat-lbl { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.hw-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.hw-section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.5px;
  margin-bottom: 18px;
}

/* Podium */
.podium-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding-top: 8px;
}
.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 170px;
  position: relative;
}
.podium-crown { font-size: 22px; margin-bottom: 6px; }
.podium-info { display: flex; flex-direction: column; align-items: center; margin-bottom: 10px; }
.podium-av {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  color: white;
  margin-bottom: 7px;
  flex-shrink: 0;
}
.p1-av { background: var(--red); box-shadow: 0 3px 10px rgba(230,57,70,0.4); }
.p2-av { background: #64748b; box-shadow: 0 3px 8px rgba(100,116,139,0.35); }
.p3-av { background: #d97706; box-shadow: 0 3px 8px rgba(217,119,6,0.35); }
.podium-av-empty {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--bg2); border: 2px dashed var(--border-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-3); margin-bottom: 7px;
}
.podium-name { font-size: 14px; font-weight: 700; color: var(--text); }
.podium-prize-nm { font-size: 11px; color: var(--text-3); margin-top: 2px; text-align: center; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-val { font-size: 15px; font-weight: 800; color: var(--red); margin-top: 3px; }
.podium-tbd { font-size: 12px; color: var(--text-3); }
.podium-stand {
  width: 100%;
  border-radius: 8px 8px 0 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; padding: 10px 6px;
  color: white; font-weight: 700;
}
.p1 .podium-stand { min-height: 80px; background: linear-gradient(160deg, #f59e0b, #b45309); box-shadow: 0 -3px 16px rgba(245,158,11,0.25); }
.p2 .podium-stand { min-height: 58px; background: linear-gradient(160deg, #94a3b8, #475569); }
.p3 .podium-stand { min-height: 42px; background: linear-gradient(160deg, #fcd34d, #b45309); }
.podium-empty .podium-stand { background: var(--bg2); color: var(--text-3); }
.podium-motto {
  font-size: 10px;
  color: var(--text-3);
  text-align: center;
  margin-top: 8px;
  padding: 0 4px;
  line-height: 1.4;
  min-height: 28px;
}

/* List */
.hw-list { display: flex; flex-direction: column; }
.hw-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--bg2);
}
.hw-row:last-child { border-bottom: none; }
.hw-row-num {
  width: 20px; text-align: center; flex-shrink: 0;
  font-size: 11px; font-weight: 700; color: var(--text-3);
}
.hw-row-av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--red); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.hw-row-info { flex: 1; min-width: 0; }
.hw-row-top { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.hw-row-name { font-size: 14px; font-weight: 600; color: var(--text); }
.hw-row-prize { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-row-price { color: var(--red); font-weight: 700; }
.hw-row-tag {
  font-size: 11px; color: var(--text-3);
  background: var(--bg2); border-radius: 6px;
  padding: 3px 8px; white-space: nowrap; flex-shrink: 0;
}
.hw-row-date { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.hw-multi {
  font-size: 10px; color: #7c3aed;
  background: #ede9fe; border-radius: 4px;
  padding: 1px 5px; font-weight: 600;
}

/* ===== Game leaderboard ===== */
.game-rank-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.gr-desc {
  font-size: 12px;
  color: var(--text-3);
  margin-left: 8px;
}
.gr-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.gr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg2);
  transition: background 0.12s;
}
.gr-row.gr-me {
  background: #fff1f2;
  border: 1px solid #fecdd3;
}
.gr-rank {
  width: 28px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-2);
  flex-shrink: 0;
}
.gr-mid {
  flex: 1;
  min-width: 0;
}
.gr-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.gr-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gr-comment {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}
.gr-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.gr-bar {
  height: 100%;
  background: var(--red);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.gr-score {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}
.gr-unit {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  margin-left: 1px;
}
.gr-mult {
  font-size: 12px;
  font-weight: 600;
  color: #d97706;
  background: #fef3c7;
  border-radius: 5px;
  padding: 2px 7px;
  flex-shrink: 0;
}
.gr-unplayed {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
  padding: 6px 10px;
  background: var(--bg2);
  border-radius: 6px;
}
.gr-game-scores {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.gr-game-chip {
  font-size: 11px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
  border-radius: 4px;
  padding: 1px 6px;
}
.gr-game-chip.gr-game-missing {
  background: var(--bg2);
  border-color: var(--border);
  color: var(--text-3);
}
.gr-partial {
  font-size: 10px;
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #854d0e;
  border-radius: 4px;
  padding: 1px 5px;
}

/* Rounds admin list */
.round-rows { display: flex; flex-direction: column; gap: 10px; }

.round-row {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.round-row-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg2);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.round-row-thumb img { width: 100%; height: 100%; object-fit: cover; }

.round-row-info { flex: 1; min-width: 160px; }
.round-row-title { font-size: 14px; font-weight: 600; color: var(--text); }
.round-row-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.round-row-winner { font-size: 12px; color: var(--green); font-weight: 600; margin-top: 2px; }

.round-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* User table */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }

.copy-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
  margin-left: 4px;
}
.copy-btn:hover { background: var(--red-light); border-color: #ffc8cc; color: var(--red); }
.copy-btn.ok { background: #f0faf8; border-color: #b7e4de; color: var(--green); }

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform 0.18s;
}
.overlay.open .modal { transform: translateY(0); }

.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-x { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 22px; line-height: 1; padding: 0; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* Image paste area */
.img-drop {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg);
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.img-drop:hover, .img-drop.over { border-color: var(--red); background: var(--red-light); }
.img-drop .drop-text { font-size: 13px; color: var(--text-3); }
.img-drop img { max-width: 180px; max-height: 110px; border-radius: var(--radius-sm); }

/* Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.tg-track {
  width: 40px;
  height: 22px;
  background: var(--border-dark);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.tg-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-row input:checked + .tg-track { background: var(--red); }
.toggle-row input:checked + .tg-track::after { left: 21px; }
.toggle-row .tg-label { font-size: 14px; color: var(--text-2); font-weight: 500; }

/* Toast */
.toast-pile {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9997;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.toast {
  background: rgba(18, 18, 26, 0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid var(--red);
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: #d4c9b0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  animation: toastIn 0.22s cubic-bezier(.17,.67,.3,1.3);
  max-width: min(340px, 88vw);
  text-align: center;
  pointer-events: auto;
}
.toast.ok        { border-left-color: #2a9d8f; color: #a8e6df; }
.toast.err       { border-left-color: var(--red); color: #ffb3b3; }
.toast.rare      { border-left-color: #4fc3f7; color: #b3e5fc; }
.toast.epic      { border-left-color: #ce93d8; color: #e1bee7; }
.toast.legendary { border-left-color: #f6c90e; background: rgba(22,18,4,0.96); color: #f0d080; }
.toast.mythic    { border-left-color: #ef5350; background: rgba(22,4,4,0.96); color: #ffcdd2; font-weight: 700; letter-spacing: 0.3px; }
@keyframes toastIn { from { transform: translateY(-14px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }

/* Confetti */
.cf {
  position: fixed;
  width: 8px;
  height: 8px;
  animation: cffall 3s linear forwards;
  z-index: 9999;
  pointer-events: none;
}
@keyframes cffall { 0% { transform: translateY(-20px) rotate(0); opacity: 1; } 100% { transform: translateY(100vh) rotate(540deg); opacity: 0; } }

/* Spinner */
.spin {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: rotateSpin 0.6s linear infinite;
}
.spin-dark {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--text-2);
}
@keyframes rotateSpin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 640px) {
  .auth-box { padding: 32px 22px; }
  .content, .admin-content { padding: 18px 14px; }
  .prize-row { flex-direction: column; }
  .prize-thumb { width: 100%; height: 180px; }
  .form-row { grid-template-columns: 1fr; }
  .topbar, .admin-bar { padding: 0 14px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  #wheelCanvas { width: 280px !important; height: 280px !important; }
  .tab-btn, .a-tab { padding: 10px 12px; font-size: 13px; }
  .r-card-top, .r-body { padding: 14px 16px; }
}

@media (max-width: 380px) {
  #wheelCanvas { width: 240px !important; height: 240px !important; }
  .stats-row { grid-template-columns: 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }

/* Util */
.w-full { width: 100%; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.justify-between { justify-content: space-between; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-3); }
.font-bold { font-weight: 700; }

/* ===== Game Modal ===== */
#gOverlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(4px);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; transition: opacity 0.2s;
}
#gOverlay.open { opacity: 1; }

.gm-modal {
  background: var(--white);
  border-radius: 20px;
  padding: 20px;
  max-width: 420px; width: 100%;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  max-height: 92vh; overflow-y: auto;
}
.gm-head { display: flex; align-items: center; gap: 10px; }
.gm-title { font-size: 17px; font-weight: 700; }
.gm-preview-badge {
  background: #ede9fe; color: #6d28d9;
  border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600;
}
.gm-close {
  margin-left: auto; width: 28px; height: 28px;
  border: none; background: var(--bg2); border-radius: 50%;
  cursor: pointer; font-size: 13px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
}
.gm-close:hover { background: var(--border-dark); }

.gm-intro { text-align: center; padding: 16px 0; }
.gm-desc  { color: var(--text-2); font-size: 14px; margin-bottom: 10px; line-height: 1.55; }
.gm-note  { color: #c2410c; font-size: 12px; margin-bottom: 16px; background: #fff7ed; border-radius: 6px; padding: 6px 10px; }

.gm-result {
  flex-direction: column; align-items: center; gap: 12px; padding: 10px 0;
}
.gm-score-wrap { text-align: center; }
.gm-score-num  { font-size: 60px; font-weight: 900; color: var(--red); line-height: 1; }
.gm-score-lbl  { font-size: 13px; color: var(--text-3); margin-top: 2px; }

.gm-mult-badge {
  background: #fff7ed; border: 1px solid #fed7aa;
  color: #c2410c; border-radius: 20px;
  padding: 6px 18px; font-size: 14px; font-weight: 600;
}

/* Game chip in section header */
.game-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  color: #15803d; border-radius: 6px;
  padding: 3px 9px; font-size: 12px; font-weight: 600;
}

/* Game mult badge in participant tag */
.part-game {
  font-size: 10px; color: #c2410c;
  background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: 4px; padding: 1px 5px; font-weight: 600;
}

/* Admin game picker */
.game-picker {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px;
}
.game-opt {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
  font-size: 13px; transition: border-color .12s;
}
.game-opt:has(input:checked) {
  border-color: var(--red); background: var(--red-light);
}
