:root {
  --bg: #070a11;
  --bg-2: #0b0f1a;
  --panel: #10151f;
  --panel-2: #151c2a;
  --panel-3: #1a2333;
  --border: #263247;
  --border-soft: #1b2436;
  --text: #eaf0fa;
  --text-dim: #94a3bd;
  --text-faint: #5c6b86;
  --accent: #5ce0c8;     /* cyan  */
  --accent-2: #8b7bff;   /* purple */
  --accent-3: #4c9dff;   /* blue  */
  --good: #34d399;
  --bad: #ff5c72;
  --warn: #ffb454;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --shadow: 0 24px 60px -28px rgba(0,0,0,.8);
  --shadow-glow: 0 10px 40px -12px rgba(124,92,255,.45);
  --grad: linear-gradient(135deg, #8b7bff 0%, #4c9dff 52%, #5ce0c8 100%);
  --grad-soft: linear-gradient(135deg, rgba(139,123,255,.16), rgba(76,157,255,.12) 55%, rgba(92,224,200,.1));
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

.aurora {
  position: fixed; inset: -25% -10% auto -10%; height: 80vh; z-index: 0; pointer-events: none;
  background:
    radial-gradient(42% 55% at 18% 12%, rgba(139,123,255,.24), transparent 62%),
    radial-gradient(40% 52% at 82% 8%, rgba(76,157,255,.20), transparent 62%),
    radial-gradient(34% 46% at 55% 26%, rgba(92,224,200,.14), transparent 60%);
  filter: blur(24px);
}

/* ---------- Top bar ---------- */
.topbar {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 28px clamp(16px, 4vw, 44px) 12px;
  max-width: 1040px; margin: 0 auto; text-align: center;
}
.brand { display: block; text-decoration: none; }
.brand-logo { width: min(520px, 86vw); height: auto; display: block; margin: 0 auto; }
.topbar-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Layout ---------- */
.wrap {
  position: relative; z-index: 1; max-width: 1040px; margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 44px) 60px;
  display: flex; flex-direction: column; gap: 22px;
}
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--shadow);
  position: relative;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 30%);
}
.card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.card-head-text h2 { margin: 0; font-size: 19px; letter-spacing: -.015em; }
.card-sub { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }
.step-pill {
  width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center;
  border-radius: 10px; font-weight: 800; font-size: 14px; margin-top: 1px;
  background: var(--grad-soft); color: #cfe0ff; border: 1px solid rgba(124,92,255,.32);
}

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 9px; margin-bottom: 20px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.muted { color: var(--text-faint); font-weight: 400; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute; left: 14px; font-size: 14px; color: var(--text-faint);
  pointer-events: none; display: grid; place-items: center; z-index: 1;
}
.in-btn {
  position: absolute; right: 7px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text-dim); border-radius: 8px;
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; cursor: pointer;
  transition: all .15s;
}
.in-btn:hover { color: var(--text); border-color: var(--accent-3); }

input[type="text"], input[type="password"], input[type="search"], input[type="email"],
input[type="url"], input[type="number"], input[type="date"], input[type="tel"], textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font: inherit; padding: 13px 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
  color-scheme: dark;
}
input:focus, textarea:focus {
  outline: none; border-color: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(76,157,255,.18); background: #0c1220;
}
/* Keep browser-autofilled fields dark instead of the default light fill. */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset;
  caret-color: var(--text);
  border: 1px solid var(--border);
  transition: background-color 99999s ease-in-out 0s;
}
/* The winner-count field sits inside the stepper pill — keep it transparent. */
.stepper .step-val { background: transparent; border: 0; }
textarea { min-height: 108px; resize: vertical; font-size: 13.5px; }
::placeholder { color: var(--text-faint); }
/* Placed AFTER the base input rule so it wins the padding-left (icon clearance). */
.input-wrap > input { padding-left: 40px; }
.input-wrap:has(.in-btn) > input { padding-right: 78px; }

/* Requirement chips */
.reqs { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 15px;
  border: 1px solid var(--border); border-radius: 12px; cursor: pointer; user-select: none;
  font-size: 13.5px; font-weight: 600; background: var(--bg-2);
  transition: all .16s ease; position: relative;
}
.chip input { display: none; }
.chip .chip-i { font-size: 15px; line-height: 1; filter: grayscale(.4); transition: filter .16s; }
.chip .chip-t { color: var(--text-dim); transition: color .16s; }
.chip:hover { border-color: var(--border); background: var(--panel-2); transform: translateY(-1px); }
.chip:has(input:checked) {
  border-color: transparent; color: var(--text);
  background:
    linear-gradient(var(--panel-2), var(--panel-2)) padding-box,
    var(--grad) border-box;
  box-shadow: 0 6px 20px -10px rgba(124,92,255,.6);
}
.chip:has(input:checked) .chip-i { filter: none; }
.chip:has(input:checked) .chip-t { color: var(--text); }
.chip input:focus-visible + .chip-i { outline: 2px solid var(--accent-3); outline-offset: 3px; border-radius: 4px; }

/* Requirement groups: entry methods vs qualifiers */
.reqs-groups, #reqs { display: flex; flex-direction: column; gap: 16px; }
.reqs-group { display: flex; flex-direction: column; gap: 9px; }
.reqs-group-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.reqs-group-hint { font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-faint); }
/* Qualifier chips read as "applied to" an entry method — dashed until selected */
.chip.qualifier { border-style: dashed; }
.chip.qualifier:has(input:checked) {
  border-style: solid;
  background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent-3)) border-box;
  box-shadow: 0 6px 20px -12px rgba(92,224,200,.5);
}

/* Source cards */
.source-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.source-card {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-2); border-radius: 14px; padding: 15px 16px;
  font: inherit; color: var(--text); transition: all .16s ease; position: relative; overflow: hidden;
}
.source-card:hover { border-color: var(--border); background: var(--panel-2); transform: translateY(-1px); }
.source-card .sc-icon { font-size: 20px; line-height: 1; margin-top: 1px; }
.source-card .sc-body { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.source-card .sc-title { font-weight: 700; font-size: 14.5px; }
.source-card .sc-desc { font-size: 12.5px; color: var(--text-dim); }
.source-card .sc-desc strong { color: var(--accent); }
.source-card .sc-check {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 999px; display: grid; place-items: center;
  border: 1.5px solid var(--border); color: transparent; font-size: 12px; font-weight: 800; transition: all .16s;
}
.source-card .sc-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.source-card.active {
  border-color: transparent;
  background: linear-gradient(var(--panel-3), var(--panel-2)) padding-box, var(--grad) border-box;
  box-shadow: 0 14px 36px -16px rgba(124,92,255,.7);
}
.source-card.active .sc-title { color: #fff; }
.source-card.active .sc-check { background: var(--grad); border-color: transparent; color: #08101c; }
.source-card:focus-visible { outline: 2px solid var(--accent-3); outline-offset: 2px; }

.mode-panel { margin-top: 2px; }
.note { font-size: 12.5px; color: var(--text-dim); margin: 6px 0 14px; }
.note code { background: var(--bg); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.note.info {
  background: var(--grad-soft); border: 1px solid rgba(76,157,255,.22);
  padding: 12px 14px; border-radius: 12px; color: #c8d6ef;
}
.note.info strong { color: #fff; }

.manual-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.manual-box { margin-bottom: 0; }
.manual-count { font-weight: 600; font-size: 11.5px; color: var(--text-faint); margin-left: 4px; }
.manual-count.has { color: var(--accent); }

/* Premium/manual load status line */
.load-status { display: flex; align-items: center; gap: 9px; margin: 4px 0 0; font-size: 13px; color: var(--text-dim); }
.load-status .ls-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent-3); flex: none; animation: lsPulse 1.1s ease-in-out infinite; }
@keyframes lsPulse { 0%,100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }

/* Presets bar */
.presets-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 12px; }
.presets-label { font-size: 12px; font-weight: 700; color: var(--text-dim); letter-spacing: .02em; }
.presets-chips { display: flex; flex-wrap: wrap; gap: 7px; flex: 1; min-width: 0; }
.preset-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.preset-chip .pc-load { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 4px 6px 12px; cursor: pointer; }
.preset-chip .pc-load:hover { color: var(--accent); }
.preset-chip .pc-act { border: 0; background: transparent; color: var(--text-faint); cursor: pointer; font-size: 11px; padding: 6px 6px; line-height: 1; }
.preset-chip .pc-act:hover { color: var(--text); }
.preset-chip .pc-del:hover { color: var(--bad); }
.presets-empty { font-size: 12.5px; color: var(--text-faint); }
.presets-bar #savePresetBtn { flex: none; margin-left: auto; }
@media (max-width: 560px) {
  .presets-bar { align-items: stretch; }
  .presets-label { width: 100%; }
  .presets-chips { flex-basis: 100%; }
  .presets-bar #savePresetBtn { margin-left: 0; width: 100%; }
}

/* Setup summary strip (top of the entrant-review step) */
.setup-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.summary-cell {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; min-width: 120px;
  background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 12px;
}
.summary-cell .sm-label { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.summary-cell .sm-value { font-size: 13.5px; font-weight: 650; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.summary-cell.accent .sm-value { color: var(--accent); }

/* ---------- Buttons ---------- */
.actions, .draw-actions, .modal-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.actions { margin-top: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; font: inherit; font-weight: 650; font-size: 14px;
  padding: 12px 20px; cursor: pointer; transition: transform .08s, filter .15s, background .15s, border-color .15s, box-shadow .15s;
}
.btn .i { font-size: 13px; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); color: #08101c; box-shadow: 0 8px 22px -10px rgba(124,92,255,.55); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 12px 30px -10px rgba(124,92,255,.7); }
.btn.primary.glow { box-shadow: 0 0 0 0 rgba(124,92,255,.4), 0 10px 30px -8px rgba(124,92,255,.6); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn.ghost:hover { color: var(--text); border-color: var(--border); background: var(--panel-2); }
.btn.soft { background: var(--panel-3); border-color: var(--border); color: var(--text); }
.btn.soft:hover { border-color: var(--accent-3); background: var(--panel-2); }
.btn.ghost.danger { color: #ff8a99; border-color: rgba(255,92,114,.35); }
.btn.ghost.danger:hover { color: #fff; background: rgba(255,92,114,.16); border-color: rgba(255,92,114,.5); }
.btn.sm { padding: 9px 14px; font-size: 13px; border-radius: 10px; }
.btn.tiny { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.big { padding: 15px 30px; font-size: 15.5px; border-radius: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.3); }
.btn:focus-visible, .chip:focus-within, .source-card:focus-visible, .seg-btn:focus-visible, .step-btn:focus-visible {
  outline: 2px solid var(--accent-3); outline-offset: 2px;
}

.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(8,16,28,.35); border-top-color: #08101c; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Warnings ---------- */
.warnings { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.warn-item {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(255,180,84,.09); border: 1px solid rgba(255,180,84,.26); color: #ffdca6;
  padding: 11px 14px; border-radius: 11px; font-size: 13px;
}

/* ---------- Stats ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.stat {
  flex: 1 1 120px; background: linear-gradient(180deg, var(--panel-2), var(--bg-2));
  border: 1px solid var(--border-soft); border-radius: 14px; padding: 15px 17px; position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--text-faint); opacity: .5; }
.stat .num { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.stat .lab { font-size: 12px; color: var(--text-dim); }
.stat.eligible::after { background: var(--grad); opacity: 1; }
.stat.eligible .num { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- List ---------- */
.list-tools { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.search-wrap { flex: 1 1 220px; }
.seg-mini { display: inline-flex; gap: 3px; padding: 3px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 11px; }
.seg-mini-btn { border: 0; background: transparent; color: var(--text-dim); font: inherit; font-weight: 600; font-size: 12.5px; padding: 8px 14px; border-radius: 8px; cursor: pointer; transition: all .15s; }
.seg-mini-btn.active { background: var(--panel-3); color: var(--text); }

.people { display: flex; flex-direction: column; gap: 7px; max-height: 470px; overflow-y: auto; padding-right: 4px; }
.people::-webkit-scrollbar { width: 8px; }
.people::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.person {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 13px;
  transition: opacity .15s, border-color .15s, background .15s, transform .1s;
}
.person:hover { border-color: var(--border); background: var(--panel-2); }
.person.excluded { opacity: .5; }
.person.excluded .p-name { text-decoration: line-through; }
.person.ineligible { opacity: .6; }
.p-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px;
  background: linear-gradient(135deg, var(--panel-3), var(--panel-2)); object-fit: cover;
  display: grid; place-items: center; font-weight: 700; color: var(--accent-3); overflow: hidden;
  border: 1px solid var(--border-soft);
}
.p-avatar img { width: 100%; height: 100%; object-fit: cover; }
.p-main { min-width: 0; flex: 1; }
.p-name { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-handle { font-size: 12.5px; color: var(--text-dim); text-decoration: none; }
a.p-handle:hover { color: var(--accent-3); }
.p-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.badge {
  font-size: 14px; line-height: 1; width: 25px; height: 25px; display: grid; place-items: center;
  border-radius: 8px; background: var(--panel-3); opacity: .34; filter: grayscale(1);
  transition: all .15s;
}
.badge.met { opacity: 1; filter: none; background: rgba(52,211,153,.16); box-shadow: inset 0 0 0 1px rgba(52,211,153,.3); }
.badge.pending { opacity: .9; filter: none; background: rgba(76,157,255,.14); box-shadow: inset 0 0 0 1px rgba(76,157,255,.28); }
.p-toggle {
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  border-radius: 9px; padding: 7px 12px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; transition: all .15s;
}
.p-toggle:hover { color: var(--text); border-color: var(--border); background: var(--panel-3); }
.person.excluded .p-toggle { color: var(--good); border-color: rgba(52,211,153,.4); }
.empty { color: var(--text-faint); text-align: center; padding: 30px; font-size: 14px; }

/* ---------- Draw configuration ---------- */
.draw-config {
  display: flex; flex-wrap: wrap; gap: 22px 30px; align-items: flex-start;
  padding: 4px 0 22px; margin-bottom: 4px; border-bottom: 1px solid var(--border-soft);
}
.cfg-block { display: flex; flex-direction: column; gap: 9px; }
.cfg-label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.hint { cursor: help; color: var(--text-faint); font-size: 12px; }

.stepper { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 5px; }
.step-btn {
  width: 38px; height: 38px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 9px; font-size: 20px; font-weight: 600; line-height: 1; cursor: pointer; transition: all .14s;
  display: grid; place-items: center;
}
.step-btn:hover { border-color: var(--accent-3); background: var(--panel-3); color: #fff; }
.step-btn:disabled { opacity: .4; cursor: not-allowed; }
.step-val { width: 56px; text-align: center; font-weight: 800; font-size: 17px; padding: 8px 4px; background: transparent; border: 0; border-radius: 8px; }
.step-val:focus { box-shadow: none; background: var(--panel-2); }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; }
.seg-btn { border: 0; background: transparent; color: var(--text-dim); font: inherit; font-weight: 600; font-size: 13px; padding: 9px 15px; border-radius: 9px; cursor: pointer; transition: all .15s; }
.seg-btn.active { background: var(--panel-3); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.35); }

/* ---------- Reels ---------- */
.reels { display: grid; gap: 16px; margin: 22px 0; grid-template-columns: 1fr; }
.reels.cols-2 { grid-template-columns: repeat(2, 1fr); }
.reels.cols-3 { grid-template-columns: repeat(3, 1fr); }
.reels.cols-many { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.reel-unit {
  background: linear-gradient(180deg, var(--panel-2), var(--bg-2));
  border: 1px solid var(--border-soft); border-radius: 16px; padding: 14px; transition: border-color .25s, box-shadow .25s, opacity .25s;
}
.reel-unit.dim { opacity: .5; }
.reel-unit.active { border-color: rgba(124,92,255,.5); box-shadow: 0 0 0 1px rgba(124,92,255,.25), 0 14px 40px -18px rgba(124,92,255,.5); }
.reel-unit.won { border-color: rgba(92,224,200,.5); box-shadow: 0 0 0 1px rgba(92,224,200,.25), 0 14px 40px -18px rgba(92,224,200,.45); }
.reel-unit.lost { border-color: rgba(255,92,114,.4); }
.reel-unit-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-dim); margin-bottom: 10px; letter-spacing: .01em; }
.ru-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 8px rgba(124,92,255,.7); }
.reel-unit:nth-child(even) .ru-dot { background: linear-gradient(135deg, #5ce0c8, #4c9dff); }
.reel-unit-label .ru-badge { margin-left: auto; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; color: var(--text-faint); background: var(--panel-3); }
.reel-unit.won .ru-badge { color: #08101c; background: linear-gradient(135deg,#5ce0c8,#34d399); }

.reel-wrap { position: relative; }
.reel-mask {
  height: 216px; overflow: hidden; position: relative; border: 1px solid var(--border); border-radius: 14px;
  background: radial-gradient(120% 90% at 50% 50%, var(--panel-3), var(--bg) 82%);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 24%, #000 76%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 24%, #000 76%, transparent);
  contain: paint;
}
/* Promote the reel to its own GPU layer so the long transform stays buttery. */
.reel { will-change: transform; transform: translateZ(0); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.reel-indicator.pulse { animation: reelLock .55s ease-out; }
@keyframes reelLock {
  0% { box-shadow: 0 0 26px -6px rgba(92,224,200,.55), inset 0 0 22px -10px rgba(92,224,200,.5); }
  35% { box-shadow: 0 0 40px 0 rgba(92,224,200,.95), inset 0 0 26px -6px rgba(92,224,200,.8); }
  100% { box-shadow: 0 0 26px -6px rgba(92,224,200,.55), inset 0 0 22px -10px rgba(92,224,200,.5); }
}
.reel-row { height: 72px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 16px; }
.reel-row .p-avatar { width: 44px; height: 44px; flex: 0 0 44px; font-size: 17px; }
.reel-row .r-name { font-size: 18px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.reel-row .r-handle { font-size: 13px; color: var(--text-dim); }
.reel-indicator {
  position: absolute; left: 8px; right: 8px; top: 50%; height: 72px; transform: translateY(-50%);
  border: 2px solid var(--accent); border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 26px -6px rgba(92,224,200,.55), inset 0 0 22px -10px rgba(92,224,200,.5);
}
.reel-unit:nth-child(even) .reel-indicator { border-color: var(--accent-2); box-shadow: 0 0 26px -6px rgba(139,123,255,.55), inset 0 0 22px -10px rgba(139,123,255,.5); }
.reel-unit.won .reel-indicator { border-color: var(--good); box-shadow: 0 0 30px -4px rgba(52,211,153,.7), inset 0 0 22px -10px rgba(52,211,153,.55); }

/* Inline verification under a reel */
.reel-verify { margin-top: 12px; }
.verify-slot { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; }
.verify-slot.pass { border-color: rgba(52,211,153,.45); }
.verify-slot.fail { border-color: rgba(255,92,114,.45); }
.verify-slot-head { display: flex; align-items: center; gap: 10px; }
.verify-slot-head .p-avatar { width: 34px; height: 34px; flex: 0 0 34px; font-size: 14px; }
.verify-slot-head .p-main { flex: 1; min-width: 0; }
.verify-status { font-size: 12px; font-weight: 700; white-space: nowrap; margin-left: auto; }
.verify-status.checking { color: var(--accent-3); }
.verify-status.pass { color: var(--good); }
.verify-status.fail { color: var(--bad); }
.verify-checks { display: flex; flex-direction: column; gap: 6px; margin-top: 9px; }
.vcheck { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.vcheck .vc-icon { width: 16px; text-align: center; flex: 0 0 16px; }
.vcheck.checking { color: var(--text-dim); }
.vcheck.pass { color: var(--text); }
.vcheck.fail { color: #ff8a99; }
.vcheck.manual { color: var(--warn); }
.vcheck .vc-label { flex: 1; }
.vcheck .vc-manual-btns { display: flex; gap: 6px; }
.vc-mini { border: 1px solid var(--border); background: transparent; color: var(--text-dim); border-radius: 7px; padding: 4px 10px; font: inherit; font-size: 11.5px; cursor: pointer; transition: all .14s; }
.vc-mini.ok:hover { color: var(--good); border-color: rgba(52,211,153,.5); }
.vc-mini.no:hover { color: var(--bad); border-color: rgba(255,92,114,.5); }
.vspin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent-3); animation: spin .7s linear infinite; display: inline-block; }
.slot-note { margin: 9px 0 0; font-size: 11.5px; color: var(--warn); }

/* ---------- Draw actions ---------- */
.draw-actions { justify-content: center; margin-top: 4px; }
.pool-count { color: var(--text-dim); font-size: 13px; flex-basis: 100%; text-align: center; }
.draw-status { text-align: center; color: var(--warn); font-size: 13px; margin: 12px 0 0; }

/* ---------- Usage panel ---------- */
.usage-panel { margin-top: 22px; padding: 16px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 14px; text-align: left; }
.usage-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.usage-head span { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.usage-stat { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 11px; padding: 11px 13px; }
.u-num { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.usage-stat:last-child .u-num { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.u-lab { font-size: 11.5px; color: var(--text-dim); }
.usage-note { margin: 12px 0 0; font-size: 11.5px; color: var(--text-faint); }

/* ---------- Winner modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(4,7,12,.74); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 20px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; overflow: hidden; width: min(500px, 100%);
  background: linear-gradient(180deg, var(--panel-2), var(--bg-2)); border: 1px solid var(--border);
  border-radius: 24px; padding: 34px 28px 26px; text-align: center; box-shadow: 0 40px 100px -24px rgba(0,0,0,.85);
  animation: pop .35s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes pop { from { transform: scale(.88); opacity: 0; } }
.winner-eyebrow { color: var(--text-dim); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 16px; font-weight: 700; }
.winner-avatar-ring {
  width: 112px; height: 112px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad); padding: 4px; box-shadow: 0 0 46px -8px rgba(124,92,255,.7);
}
.winner-avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--panel); display: block; }
.winner-name { font-size: 29px; font-weight: 850; margin: 16px 0 2px; letter-spacing: -.02em; }
.winner-handle { display: inline-block; color: var(--accent-3); text-decoration: none; font-weight: 650; margin-bottom: 22px; }
.winner-handle:hover { text-decoration: underline; }
.modal-actions { justify-content: center; }

.winner-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; margin-bottom: 22px; text-align: left; }
.winner-list::-webkit-scrollbar { width: 8px; }
.winner-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.winner-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 13px; }
.winner-row .p-avatar { width: 38px; height: 38px; flex: 0 0 38px; }
.winner-row .rank { color: #08101c; font-weight: 800; font-size: 12px; width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 8px; background: var(--grad); }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; opacity: .9; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(640px) rotate(720deg); opacity: 0; } }

/* ---------- Footer ---------- */
.foot { text-align: center; color: var(--text-faint); font-size: 12.5px; padding: 24px; position: relative; z-index: 1; }

/* ---------- Account chip + Premium ---------- */
.account-chip {
  display: inline-flex; align-items: center; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 8px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  background: var(--panel-2); border: 1px solid var(--border-soft);
}
.premium-card .sc-icon { filter: drop-shadow(0 0 8px rgba(255,180,84,.5)); }
.premium-state { margin-top: 4px; }
.premium-msg { background: var(--grad-soft); border: 1px solid rgba(139,123,255,.24); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.premium-msg p { margin: 0; font-size: 13px; color: #cdd8ef; }
.premium-msg.ok { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.25); }
.premium-msg code { background: var(--bg); padding: 2px 7px; border-radius: 6px; color: var(--accent); font-weight: 700; }

/* ---------- Auth pages ---------- */
.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 30px 18px; }
.auth-logo img { width: min(360px, 78vw); height: auto; display: block; }
.auth-card { width: min(420px, 100%); background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--border-soft); border-radius: 20px; padding: 26px; box-shadow: var(--shadow); }
.auth-tabs { width: 100%; margin-bottom: 20px; }
.auth-tabs .seg-btn { flex: 1; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .btn.big { width: 100%; margin-top: 4px; }
.invite-status { font-size: 12px; font-weight: 600; min-height: 14px; }
.invite-status.ok { color: var(--good); }
.invite-status.bad { color: var(--bad); }
.first-hint { margin: 4px 0 16px; }
.auth-error { color: #ff8a99; font-size: 13px; margin: 12px 0 0; text-align: center; }
.auth-terms { font-size: 12px; color: var(--text-faint); text-align: center; margin: 12px 0 0; }
.auth-terms a { color: var(--text-dim); }
.auth-terms a:hover { color: var(--text); }
.auth-back { color: var(--text-dim); text-decoration: none; font-size: 13px; }
.auth-back:hover { color: var(--text); }

/* ---------- Admin ---------- */
.admin-topbar { flex-direction: row; justify-content: space-between; padding: 18px clamp(16px,4vw,44px); }
.admin-topbar .brand-logo { width: auto; height: 56px; }
.admin-badge { font-size: 12px; font-weight: 700; color: #cdd8ef; background: var(--grad-soft); border: 1px solid rgba(124,92,255,.3); padding: 8px 13px; border-radius: 999px; }
.invite-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.invite-groups { display: flex; flex-direction: column; gap: 20px; margin-bottom: 8px; }
.invite-group { display: flex; flex-direction: column; gap: 10px; }
.invite-group-title { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); }
.invite-group .field { margin-bottom: 0; }
.api-safety-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.api-safety-cell { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 12px; }
.api-safety-cell .as-lab { font-size: 11px; color: var(--text-faint); font-weight: 600; letter-spacing: .02em; }
.api-safety-cell .as-val { font-size: 14.5px; font-weight: 700; color: var(--text); }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.admin-table th { text-align: left; color: var(--text-dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.admin-table tr:hover td { background: rgba(255,255,255,.02); }
.codecell { background: var(--bg); padding: 3px 8px; border-radius: 6px; color: var(--accent); font-weight: 700; letter-spacing: .04em; }
.rowact { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Invite codes: div-grid list that fits without horizontal scroll ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.inv-list { display: flex; flex-direction: column; }
/* Compact columns (Code/Type/Uses/Redeemed/Status/Actions) are fixed to just
   what their content needs; Owner and Benefit share the remaining flexible
   space, so Owner gets far more room while nothing overflows. */
.inv-head, .inv-row { display: grid; grid-template-columns: 92px minmax(0, 2.3fr) 72px minmax(0, 1.85fr) 68px 84px 62px 40px; gap: 8px; align-items: center; }
.inv-head { padding: 8px; border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.inv-row { padding: 12px 8px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.inv-row:hover { background: rgba(255,255,255,.02); }
.inv-cell { min-width: 0; } /* let ellipsis children shrink inside the grid track */
.cell-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-list .codecell { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.cell-sub { display: block; font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.cell-sub.bad { color: var(--bad); }
.inv-act { display: flex; justify-content: flex-end; overflow: visible; }
.inv-act .kebab-wrap { display: inline-block; }

/* Redeemed-by clickable count + popover */
.redeem-toggle {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 4px 9px; cursor: pointer; transition: border-color .15s;
}
.redeem-toggle:hover, .redeem-toggle[aria-expanded="true"] { border-color: var(--accent-3); }
.redeem-caret { font-size: 9px; color: var(--text-dim); }
.redeem-pop {
  position: fixed; z-index: 70; width: min(320px, calc(100vw - 24px));
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; animation: fade .14s ease;
}
.redeem-pop-head { padding: 10px 13px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-dim); border-bottom: 1px solid var(--border-soft); }
.redeem-pop-list { max-height: 244px; overflow-y: auto; padding: 6px; }
.redeem-pop-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.redeem-pop-item:hover { background: var(--panel-3); }
.rp-email { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-copy { flex: none; width: 26px; height: 26px; font-size: 12px; }
.redeem-pop-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 16px; text-align: center; color: var(--text-faint); font-size: 13px; }

@media (max-width: 1024px) {
  /* Eight columns need real room; below laptop width each invite becomes a
     stacked label/value card (divs honor display overrides reliably). */
  .inv-head { display: none; }
  .inv-row { display: block; border: 1px solid var(--border-soft); border-radius: 12px; padding: 6px 14px; margin-bottom: 10px; background: var(--bg-2); }
  .inv-row:hover { background: var(--bg-2); }
  .inv-cell { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 9px 0; }
  .inv-cell + .inv-cell { border-top: 1px solid var(--border-soft); }
  .inv-cell::before { content: attr(data-label); flex: 0 0 100px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); font-weight: 700; }
  .inv-cell.cell-ellipsis { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
  .inv-act { justify-content: flex-start; }
  .cell-sub { display: inline; margin-left: 6px; }
}
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill.ok { color: #08101c; background: linear-gradient(135deg,#5ce0c8,#34d399); }
.pill.off { color: var(--text-dim); background: var(--panel-3); }
.prem-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; font-weight: 800; font-size: 14px; line-height: 1; }
.prem-mark.yes { color: #08101c; background: linear-gradient(135deg, #5ce0c8, #34d399); box-shadow: 0 0 12px -3px rgba(52,211,153,.6); }
.prem-mark.no { color: #fff; background: linear-gradient(135deg, #ff5c72, #ff8a5c); box-shadow: 0 0 12px -3px rgba(255,92,114,.55); }
.linklike { background: none; border: 0; color: var(--accent-3); font: inherit; cursor: pointer; padding: 0; text-align: left; }
.linklike:hover { text-decoration: underline; color: var(--accent); }
.admin-table tr.row-highlight td { animation: rowFlash 1.8s ease-out; }
@keyframes rowFlash { 0%, 15% { background: rgba(124,92,255,.3); } 100% { background: transparent; } }

/* ---------- History modal ---------- */
.history-modal { text-align: left; width: min(600px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.modal-headrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.history-list { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1; padding-right: 2px; }
.history-item { background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 14px; padding: 14px 15px; transition: border-color .15s; }
.history-item:hover { border-color: var(--border); }
.history-top { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.history-headline { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.history-when { font-size: 12px; color: var(--text-dim); }
.history-reqs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.history-meta { font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px; }
.history-meta a, .history-winners a { color: var(--accent-3); text-decoration: none; }
.history-meta a:hover, .history-winners a:hover { text-decoration: underline; }
.history-winners { font-size: 13.5px; font-weight: 600; margin-bottom: 12px; }
.history-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.history-details { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 9px; }
.hist-detrow { display: flex; gap: 10px; font-size: 12.5px; align-items: baseline; }
.hist-detrow-col { flex-direction: column; gap: 6px; }
.hist-detlabel { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); flex: 0 0 120px; }
.hist-detrow-col .hist-detlabel { flex-basis: auto; }
.hist-detrow a { color: var(--accent-3); text-decoration: none; }
.hist-entrants { display: flex; flex-wrap: wrap; gap: 5px 10px; max-height: 130px; overflow-y: auto; }
.hist-ent { font-size: 12px; color: var(--text-dim); text-decoration: none; }
.hist-ent:hover { color: var(--accent-3); }

/* Small icon button (delete etc) */
.icon-btn {
  margin-left: auto; flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--border-soft); background: var(--panel-2); border-radius: 9px;
  color: var(--text-dim); cursor: pointer; font-size: 14px; transition: all .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { color: var(--bad); border-color: rgba(255,92,114,.4); background: rgba(255,92,114,.08); }

/* ---------- Shared empty state ---------- */
.cp-empty { text-align: center; padding: 38px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cp-empty-ico {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; margin-bottom: 4px;
  background: var(--grad-soft); border: 1px solid var(--border-soft);
}
.cp-empty-title { font-size: 16px; font-weight: 700; color: var(--text); }
.cp-empty-sub { font-size: 13px; color: var(--text-dim); max-width: 380px; line-height: 1.55; }
.cp-empty-action { margin-top: 8px; }

/* ---------- Referral modal ---------- */
.referral-modal { width: min(440px, 100%); }
.referral-lead { font-size: 13.5px; color: var(--text-dim); margin: 0 0 16px; line-height: 1.55; }
.referral-code {
  display: block; width: 100%; font: inherit; font-size: 32px; font-weight: 800; letter-spacing: .14em; margin: 6px 0 14px;
  padding: 16px 12px; cursor: pointer; border-radius: 14px; color: #fff;
  background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, var(--grad) border-box;
  border: 1.5px solid transparent; box-shadow: 0 0 28px -14px rgba(124,92,255,.6);
  transition: filter .15s, box-shadow .15s;
}
.referral-code:hover { filter: brightness(1.12); box-shadow: 0 0 34px -12px rgba(124,92,255,.75); }
.referral-metrics { display: flex; gap: 10px; margin-bottom: 14px; }
.ref-metric { flex: 1; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.ref-metric-num { font-size: 22px; font-weight: 800; letter-spacing: -.02em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ref-metric-lab { font-size: 11.5px; color: var(--text-dim); }
.referral-actions { justify-content: stretch; margin-bottom: 8px; }
.referral-actions .btn { flex: 1; }
.auto-source-hint { font-size: 12.5px; line-height: 1.5; color: var(--text-dim); margin: 10px 0 0; padding: 9px 12px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 10px; }
.referral-sub { font-size: 13px; color: var(--text-dim); margin: 0 0 12px; }
.referral-policy { font-size: 12.5px; line-height: 1.5; color: var(--text-dim); margin: 0 0 12px; padding: 9px 12px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 10px; }
.referral-policy strong { color: var(--accent); }
.referral-policy.warn { color: #ffcf8a; border-color: rgba(255,160,80,.32); background: rgba(255,160,80,.08); }
.referral-policy.warn strong { color: #ffcf8a; }
.referral-stat { font-size: 12.5px; color: var(--accent); margin: 0 0 14px; font-weight: 600; }
.referral-users { text-align: left; margin: 0 0 18px; max-height: 200px; overflow-y: auto; }
.ref-head { font-size: 12px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.ref-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 10px; margin-bottom: 6px; }
.ref-email { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.ref-when { font-size: 12px; color: var(--text-faint); }
.ref-empty, .ref-loading { font-size: 13px; color: var(--text-faint); text-align: center; padding: 14px; }
.redeemers { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Suspension (ban) screen ---------- */
.ban-screen {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(80% 80% at 50% 30%, rgba(255,92,114,.12), transparent 60%), var(--bg);
}
.ban-screen { overflow-y: auto; }
.ban-card {
  width: min(520px, 100%); text-align: center; margin: auto;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid rgba(255,92,114,.3); border-radius: 22px; padding: 36px 30px;
  box-shadow: 0 30px 80px -24px rgba(0,0,0,.8);
}
.ban-icon { font-size: 44px; margin-bottom: 8px; }
.ban-card h1 { font-size: 25px; font-weight: 850; margin: 0 0 16px; }
.ban-reason-label { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 6px; }
.ban-reason { font-size: 15px; color: var(--text); margin: 0 0 12px; line-height: 1.5; }
.ban-until { font-size: 13px; color: var(--warn); margin: 0 0 6px; }
.ban-count { font-size: 12.5px; color: var(--text-dim); margin: 0 0 10px; font-weight: 600; }
.ban-disclaimer { font-size: 11.5px; color: var(--text-faint); margin: 0 0 18px; line-height: 1.5; }
/* Appeal on the ban screen */
.ban-appeal { text-align: left; margin: 0 0 18px; }
.appeal-status { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 13px; }
.appeal-status.pending { background: rgba(76,157,255,.1); border: 1px solid rgba(76,157,255,.28); }
.appeal-status.denied { background: rgba(255,92,114,.08); border: 1px solid rgba(255,92,114,.28); }
.appeal-status strong { display: block; margin-bottom: 6px; }
.appeal-msg { margin: 4px 0; color: var(--text-dim); white-space: pre-wrap; }
.appeal-when { font-size: 11.5px; color: var(--text-faint); }
.appeal-form { display: flex; flex-direction: column; gap: 8px; }
.appeal-label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.appeal-form textarea { min-height: 90px; }
.appeal-form .btn { align-self: flex-start; }
.appeal-error { color: #ff8a99; font-size: 12.5px; margin: 0; }
.ban-actions { display: flex; align-items: center; justify-content: center; gap: 16px; }
.ban-link { color: var(--text-dim); font-size: 12.5px; text-decoration: none; }
.ban-link:hover { color: var(--text); text-decoration: underline; }
.foot-sep { color: var(--text-faint); margin: 0 4px; }
.foot-link { color: var(--text-dim); text-decoration: none; }
.foot-link:hover { color: var(--text); text-decoration: underline; }

/* Admin appeals */
.count-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #08101c; background: linear-gradient(135deg,#ff5c72,#ff8a5c); vertical-align: middle; }
.appeals-list { display: flex; flex-direction: column; gap: 12px; }
.appeal-card { background: var(--bg-2); border: 1px solid var(--border-soft); border-left: 3px solid var(--accent-3); border-radius: 12px; padding: 14px 16px; }
.appeal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.appeal-email { font-weight: 700; font-size: 14px; }
.appeal-ban { font-size: 12px; margin-bottom: 8px; }
.appeal-message { font-size: 13.5px; color: var(--text); background: var(--bg); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; white-space: pre-wrap; }
.appeal-response { min-height: 54px; margin-bottom: 10px; }
.appeal-actions { display: flex; gap: 8px; }

/* ---------- Terms of Service page ---------- */
.terms { max-width: 780px; margin: 0 auto; }
.terms h1 { font-size: 30px; font-weight: 850; margin: 0 0 6px; letter-spacing: -.02em; }
.terms-updated { font-size: 12.5px; color: var(--text-faint); margin: 0 0 20px; }
.terms-intro { font-size: 15px; color: var(--text-dim); line-height: 1.65; margin: 0 0 18px; }
.terms-note { background: var(--grad-soft); border: 1px solid rgba(124,92,255,.24); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; color: #cdd8ef; margin: 0 0 26px; line-height: 1.6; }
.terms section { margin-bottom: 22px; }
.terms h2 { font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.terms p { font-size: 14px; color: var(--text-dim); line-height: 1.7; margin: 0 0 8px; }
.terms ul { margin: 6px 0 8px; padding-left: 22px; }
.terms li { font-size: 14px; color: var(--text-dim); line-height: 1.6; margin-bottom: 6px; }
.terms a { color: var(--accent-3); text-decoration: none; }
.terms a:hover { text-decoration: underline; }
.terms strong { color: var(--text); font-weight: 600; }
.terms-legal-note { font-size: 12px; color: var(--text-faint); font-style: italic; margin: 26px 0 22px; }

/* ---------- Ban modal ---------- */
.ban-modal { width: min(640px, 100%); text-align: left; }
.ban-target { font-size: 13px; color: var(--text-dim); margin: 0 0 16px; }
.ban-target::before { content: '⛔ '; }
.ban-grid { display: grid; grid-template-columns: 1fr 200px; gap: 20px; }
.ban-main .field { margin-bottom: 14px; }
.ban-main textarea { min-height: 70px; }
.ban-side { display: flex; flex-direction: column; gap: 8px; }
.ban-presets { display: flex; flex-direction: column; gap: 7px; }
.ban-preset { text-align: left; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-dim); border-radius: 9px; padding: 9px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .14s; }
.ban-preset:hover { color: var(--text); border-color: rgba(255,92,114,.4); background: var(--panel-2); }
.ban-select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); font: inherit; padding: 12px 14px; cursor: pointer;
}
.ban-select:focus { outline: none; border-color: var(--accent-3); box-shadow: 0 0 0 3px rgba(76,157,255,.18); }
.btn.solid-danger { background: var(--bad); color: #fff; }
.btn.solid-danger:hover { filter: brightness(1.08); }
.pill.banned { color: #fff; background: linear-gradient(135deg, #ff5c72, #ff8a5c); cursor: help; }

/* ---------- Ban history log ---------- */
.ban-log-modal { width: min(520px, 100%); text-align: left; }
.ban-log-list { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; margin-top: 8px; }
.ban-log-item { background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 14px; }
.ban-log-item.ban { border-left: 3px solid var(--bad); }
.ban-log-item.unban { border-left: 3px solid var(--good); }
.bl-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bl-action { font-size: 13px; font-weight: 800; }
.bl-action.bad { color: #ff8a99; }
.bl-action.ok { color: var(--good); }
.bl-when { font-size: 12px; color: var(--text-faint); }
.bl-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.bl-line { font-size: 13px; margin-top: 5px; }
.bl-line strong { color: var(--text-dim); font-weight: 600; }
.bl-internal { color: var(--warn); }

/* ---------- Settings row + ban escalation ---------- */
.settings-row { display: flex; flex-wrap: wrap; gap: 24px 44px; align-items: flex-start; }
.invite-limit-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.invite-limit-per { font-size: 13px; color: var(--text-dim); }
.cfg-hint { margin: 4px 0 0; font-size: 12px; color: var(--text-faint); max-width: 260px; }
.cfg-disabled { opacity: .5; }
.cfg-disabled .ban-select, .cfg-disabled .stepper { filter: grayscale(.4); }
.ban-escalation { font-size: 12.5px; color: var(--text-dim); margin: 0 0 14px; padding: 9px 12px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 9px; }
.ban-escalation.perma { color: #ff8a99; border-color: rgba(255,92,114,.35); font-weight: 600; }

/* ---------- Restore (welcome back) modal ---------- */
.restore-modal { width: min(460px, 100%); text-align: center; }
.restore-icon { font-size: 44px; margin-bottom: 6px; }
.restore-modal h2 { font-size: 23px; font-weight: 850; margin: 0 0 12px; letter-spacing: -.02em; }
.restore-sub { font-size: 13.5px; color: var(--text-dim); margin: 0 0 14px; }
.restore-reason { background: var(--bg-2); border: 1px solid var(--border-soft); border-left: 3px solid var(--warn); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--text); text-align: left; margin: 0 0 14px; }
.restore-warning { font-size: 13px; color: var(--warn); margin: 0 0 20px; line-height: 1.5; }
.restore-modal .btn.primary { width: 100%; }

/* ---------- Responsive ---------- */
/* ---------- Admin dashboard shell + nav ---------- */
.admin-shell {
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 44px) 60px;
  display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 22px;
  align-items: start;
}
.admin-nav {
  position: sticky; top: 20px;
  display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border-soft); border-radius: 16px;
  padding: 10px; box-shadow: var(--shadow);
}
.admin-nav-title {
  margin: 4px 8px 6px; font-size: 11px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint);
}
.admin-nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 11px 13px;
  border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--text-dim);
  font: inherit; font-size: 14.5px; font-weight: 600;
  text-align: left; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.admin-nav-item:hover { background: var(--panel-2); color: var(--text); }
.admin-nav-item.active {
  color: var(--text);
  background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, var(--grad) border-box;
  border: 1px solid transparent;
}
.admin-nav-item .nav-ico { font-size: 16px; width: 20px; text-align: center; flex: none; }
.admin-nav-item .nav-label { flex: 1; }
.nav-badge { flex: none; }
.admin-content { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.admin-view { display: flex; flex-direction: column; gap: 22px; }
.card-head.compact { margin-bottom: 14px; }
.card-head.compact h2 { font-size: 15px; }

/* ---- Overview ---- */
.overview-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.ov-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 14px; }
.ov-card.accent { background: var(--grad-soft); border-color: rgba(124,92,255,.25); }
.ov-card.warn { border-color: rgba(255,180,84,.35); background: rgba(255,180,84,.06); }
.ov-ico { font-size: 22px; flex: none; width: 42px; height: 42px; display: grid; place-items: center; background: var(--panel-2); border-radius: 12px; }
.ov-card.accent .ov-ico, .ov-card.warn .ov-ico { background: rgba(0,0,0,.2); }
.ov-num { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.ov-lab { font-size: 12px; color: var(--text-dim); }
.ov-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.overview-span { grid-column: 1 / -1; }
.ov-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.ov-row:last-child { border-bottom: 0; }
.ov-row-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ov-row-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.ov-when { font-size: 11.5px; color: var(--text-faint); }
@media (max-width: 720px) { .overview-grid { grid-template-columns: 1fr; } }

/* ---- Audit log ---- */
.audit-list { display: flex; flex-direction: column; }
.audit-row { display: grid; grid-template-columns: 190px 1fr auto; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.audit-row:last-child { border-bottom: 0; }
.audit-action { font-weight: 700; }
.audit-detail { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
.audit-detail strong { color: var(--text); font-weight: 650; }
.audit-when { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
@media (max-width: 640px) { .audit-row { grid-template-columns: 1fr; gap: 2px; } .audit-when { grid-row: 1; } }

/* ---- User tools + cards ---- */
.user-tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; align-items: center; }
.user-tools .search-wrap { flex: 1; min-width: 180px; }
.user-cards { display: flex; flex-direction: column; gap: 10px; }
.user-card { background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 14px; padding: 14px 16px; transition: border-color .15s; }
.user-card:hover { border-color: var(--border); }
.uc-top { display: flex; align-items: flex-start; gap: 12px; }
.uc-id { flex: 1; min-width: 0; }
.uc-email { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.uc-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.uc-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 12px; color: var(--text-dim); align-items: center; }
.uc-meta .codecell { font-size: 11px; padding: 2px 7px; }
.uc-meta .linklike { background: none; border: 0; color: var(--accent-3); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.uc-meta .linklike:hover { text-decoration: underline; }

/* Kebab action menu */
.kebab-wrap { position: relative; flex: none; }
.kebab-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 180px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
}
.kebab-menu button {
  text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px;
  padding: 9px 11px; border-radius: 8px; cursor: pointer;
}
.kebab-menu button:hover { background: var(--panel-3); }
.kebab-menu button.danger { color: #ff8a99; }
.kebab-menu button.danger:hover { background: rgba(255,92,114,.12); }

.user-card.row-highlight { animation: cardFlash 1.8s ease-out; }
@keyframes cardFlash { 0% { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(92,224,200,.25); } 100% { border-color: var(--border-soft); box-shadow: none; } }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; gap: 16px; }
  .admin-nav {
    position: static; flex-direction: row; overflow-x: auto;
    gap: 6px; padding: 8px; -webkit-overflow-scrolling: touch;
  }
  .admin-nav-title { display: none; }
  .admin-nav-item { width: auto; white-space: nowrap; padding: 10px 14px; }
}
@media (max-width: 460px) {
  .admin-nav-item .nav-label { display: none; }
  .admin-nav-item { padding: 10px 13px; }
  .admin-nav-item .nav-ico { font-size: 18px; }
}

@media (max-width: 760px) {
  .reels.cols-2, .reels.cols-3 { grid-template-columns: 1fr; }
  .source-cards { grid-template-columns: 1fr; }
  .draw-config { gap: 18px; }
}
@media (max-width: 560px) {
  .topbar { padding-top: 22px; gap: 12px; }
  .card-head h2 { font-size: 17px; }
  .card-sub { display: none; }
  .reel-row .r-name { font-size: 16px; }
  .stat .num { font-size: 22px; }
  .winner-name { font-size: 24px; }
  .btn.sm .i { display: none; }
  .modal { padding: 28px 16px 20px; }
  .winner-list { overflow-x: hidden; }
  .winner-row { gap: 8px; padding: 8px 9px; }
  .winner-row .rank { width: 21px; height: 21px; flex-basis: 21px; }
  .winner-row .p-avatar { width: 32px; height: 32px; flex-basis: 32px; }
  .winner-row .p-main { overflow: hidden; }
  .winner-row .wr-copy { padding: 6px 10px; font-size: 11.5px; }
  .draw-config { gap: 16px; }
  .stepper, .seg { width: 100%; }
  .seg-btn { flex: 1; }
  .ban-grid { grid-template-columns: 1fr; }
  .ban-side { flex-direction: row; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Shared UI toolkit (ui.js): toasts + confirm ---------- */
.cp-toasts {
  position: fixed; z-index: 60; right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  max-width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.cp-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 13px; cursor: pointer;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text); font-size: 13.5px; font-weight: 600; max-width: 100%;
  transform: translateY(10px) scale(.98); opacity: 0; transition: transform .22s cubic-bezier(.2,.9,.3,1.2), opacity .22s ease;
}
.cp-toast.in { transform: translateY(0) scale(1); opacity: 1; }
.cp-toast.out { transform: translateY(6px) scale(.98); opacity: 0; }
.cp-toast-ico {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #08101c; background: var(--good);
}
.cp-toast-error .cp-toast-ico { background: var(--bad); color: #fff; }
.cp-toast-warn .cp-toast-ico { background: var(--warn); color: #08101c; }
.cp-toast-info .cp-toast-ico { background: var(--accent-3); color: #08101c; }
.cp-toast-msg { flex: 1; min-width: 0; line-height: 1.35; }
.cp-toast-action {
  flex: none; border: 0; background: transparent; color: var(--accent);
  font: inherit; font-weight: 700; cursor: pointer; padding: 4px 6px; border-radius: 7px;
}
.cp-toast-action:hover { background: var(--panel-3); }
@media (max-width: 560px) { .cp-toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; max-width: none; } }

.cp-confirm { width: min(420px, 100%); text-align: left; padding: 26px 26px 22px; }
.cp-confirm-title { margin: 0 0 8px; font-size: 19px; letter-spacing: -.01em; }
.cp-confirm-body { margin: 0 0 20px; color: var(--text-dim); font-size: 14px; line-height: 1.55; }
.cp-confirm-actions { justify-content: flex-end; }

/* ---------- Shared: soft badge chips ---------- */
.tag-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  background: var(--panel-2); border: 1px solid var(--border-soft); color: var(--text-dim);
}
.tag-badge.good { color: var(--good); border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.08); }
.tag-badge.accent { color: var(--accent); border-color: rgba(92,224,200,.3); background: rgba(92,224,200,.08); }
.tag-badge.warn { color: var(--warn); border-color: rgba(255,180,84,.3); background: rgba(255,180,84,.08); }
.tag-badge.bad { color: var(--bad); border-color: rgba(255,92,114,.3); background: rgba(255,92,114,.08); }

/* ---------- Shared: a warn-flavored note (mirrors .note.info) ---------- */
.note.warn {
  background: rgba(255,180,84,.1); border: 1px solid rgba(255,180,84,.3);
  padding: 12px 14px; border-radius: 12px; color: #ffe3b8;
}
.note.warn code { background: rgba(0,0,0,.25); }
.field-hint { font-size: 11.5px; color: var(--text-faint); line-height: 1.4; }
.seg-multiline { flex-wrap: wrap; }

/* ---------- Admin: "Invite someone" (one-time invite link) card ---------- */
.invite-link-result { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.link-result-title { margin: 0 0 12px; font-weight: 700; color: var(--good); }
.link-share-preview {
  display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 10px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
}
.lsp-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--panel-2); flex: none; }
.lsp-body { min-width: 0; }
.lsp-title { font-weight: 700; font-size: 13.5px; }
.lsp-desc { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.lsp-url { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#linkUrl { padding-right: 88px; }
.input-wrap:has(#shuffleUsernameBtn) > input { padding-right: 100px; }

/* ---------- Invite-link landing page (public/invite.html) ---------- */
.invite-card { width: min(460px, 100%); text-align: left; }
.invite-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.invite-title { margin: 0 0 6px; font-size: 22px; letter-spacing: -.01em; }
.invite-sub { margin: 0 0 18px; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.invite-step .field:last-of-type { margin-bottom: 14px; }
.invite-onetime-note { font-size: 11.5px; color: var(--text-faint); text-align: center; margin: 10px 0 0; }
.invite-card .btn.big { width: 100%; }
.verify-code-input { font-size: 24px; font-weight: 700; letter-spacing: .5em; text-align: center; padding-right: 14px !important; }
.verify-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.verify-actions .btn { flex: 1; }
.invite-step .cp-empty { padding: 10px 0 22px; }
