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

:root {
  --purple: #833AB4;
  --pink: #C13584;
  --red: #E1306C;
  --orange: #FD1D1D;
  --yellow: #FCB045;
  --bg: #070710;
  --card: rgba(255,255,255,0.035);
  --border: rgba(255,255,255,0.08);
  --input-bg: rgba(255,255,255,0.05);
  --input-border: rgba(255,255,255,0.1);
  --text: #f0f0f8;
  --muted: rgba(255,255,255,0.45);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  padding: 20px 16px 60px;
  line-height: 1.5;
}

/* Background orbs */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
}
.orb-1 { width: 500px; height: 500px; background: var(--purple); top: -150px; left: -100px; }
.orb-2 { width: 400px; height: 400px; background: var(--red); bottom: -100px; right: -100px; }
.orb-3 { width: 300px; height: 300px; background: var(--yellow); top: 40%; left: 50%; transform: translate(-50%,-50%); opacity: 0.12; }

/* Layout */
.container { max-width: 660px; margin: 0 auto; position: relative; }

/* Header */
.header { text-align: center; padding: 36px 0 28px; }
.logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; }
.logo-icon {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: rgba(131,58,180,0.15);
  border: 1px solid rgba(131,58,180,0.3);
  display: flex; align-items: center; justify-content: center;
}
.logo h1 {
  font-size: 30px; font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(135deg, #a855f7, #ec4899, #f97316);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.subtitle { color: var(--muted); font-size: 14px; }

/* Coin balance bar */
.coin-bar {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 10px;
  padding: 8px 16px;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 12px;
}
.coin-balance {
  font-size: 13px; font-weight: 600; color: #fbbf24;
}
.coin-hint { color: rgba(251,191,36,0.5); font-weight: 400; font-size: 11px; }
.btn-topup {
  padding: 4px 12px; border-radius: 8px; border: none;
  background: rgba(251,191,36,0.2);
  border: 1px solid rgba(251,191,36,0.4);
  color: #fbbf24; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.btn-topup:hover { background: rgba(251,191,36,0.35); }
.pkg-label { font-size: 11px; color: var(--muted); }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  margin-bottom: 14px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeUp 0.35s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 15px; font-weight: 600; flex: 1; }

.step-num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--purple), var(--red));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* Status pill */
.status-pill {
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  white-space: nowrap;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--muted);
}
.status-ok { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.3); color: #4ade80; }
.status-err { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #f87171; }

.count-badge {
  background: rgba(131,58,180,0.25);
  border: 1px solid rgba(131,58,180,0.4);
  color: #c084fc;
  padding: 2px 10px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
}

.card-body { padding: 18px 20px; }

/* Loading card */
.card-loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; padding: 40px;
  min-height: 110px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--purple); border-right-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { color: var(--muted); font-size: 13px; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 7px;
}

input[type=text], input[type=password], input[type=number], textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px; font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus {
  border-color: rgba(131,58,180,0.6);
  box-shadow: 0 0 0 3px rgba(131,58,180,0.12);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }

.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-right: 42px; }
.icon-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px; display: flex;
  transition: color 0.2s;
}
.icon-btn:hover { color: var(--text); }

.input-btn-row { display: flex; gap: 8px; }
.input-btn-row input { flex: 1; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.hint a { color: #a78bfa; text-decoration: none; }
.hint a:hover { text-decoration: underline; }
code {
  background: rgba(131,58,180,0.18); border-radius: 4px;
  padding: 1px 5px; font-size: 11px; color: #c4b5fd;
}

/* Divider */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12px;
  margin: 18px 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border);
}

/* Buttons */
.btn {
  padding: 10px 18px; border-radius: 10px; border: none;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.18s; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--red));
  color: #fff;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(225,48,108,0.35); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255,255,255,0.09); }

.btn-block {
  width: 100%; justify-content: center;
  padding: 13px; font-size: 14px;
  border-radius: 12px; margin-top: 14px;
}
.btn-giveaway {
  width: 100%; justify-content: center;
  padding: 16px; font-size: 16px; font-weight: 700;
  border-radius: 12px; margin-top: 14px;
  border: none; cursor: pointer;
  background: linear-gradient(135deg, #833AB4, #C13584, #E1306C, #FD1D1D, #FCB045);
  background-size: 300% 300%;
  color: #fff;
  animation: igGrad 4s ease infinite;
  transition: transform 0.18s, box-shadow 0.18s;
}
.btn-giveaway:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(225,48,108,0.4); }
@keyframes igGrad {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 18px; }
.stat-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
  text-align: center;
}
.stat-box-accent { border-color: rgba(131,58,180,0.35); background: rgba(131,58,180,0.08); }
.stat-val {
  display: block; font-size: 26px; font-weight: 800;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.stat-lbl { font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }

/* Filters */
.filter-list { display: flex; flex-direction: column; gap: 8px; }

.filter-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.filter-row:hover { background: rgba(255,255,255,0.05); }
.filter-row input[type=checkbox] { display: none; }
.filter-row-disabled { cursor: default; opacity: 0.7; }
.filter-row-disabled:hover { background: rgba(255,255,255,0.025); }
.filter-row-info { cursor: default; }
.filter-row-info:hover { background: rgba(255,255,255,0.025); }

.checked-always, .custom-checkbox {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
}
.checked-always { background: linear-gradient(135deg, var(--purple), var(--red)); }
.custom-checkbox {
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  transition: all 0.18s;
}
.custom-checkbox.is-checked {
  background: linear-gradient(135deg, var(--purple), var(--red));
  border-color: transparent;
}

.filter-name { font-size: 13px; font-weight: 500; }
.filter-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.warning-text { color: rgba(251,191,36,0.75); }
.tag {
  background: rgba(131,58,180,0.2); border-radius: 4px;
  padding: 1px 6px; font-size: 11px; color: #c084fc;
  font-weight: 400; margin-left: 4px;
}

.info-icon {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: rgba(251,191,36,0.15);
  border: 1px solid rgba(251,191,36,0.3);
  color: rgba(251,191,36,0.8);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; margin-top: 1px;
}

/* Radio buttons (selection mode) */
.filter-row input[type=radio] { display: none; }

.custom-radio {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.custom-radio.is-checked {
  background: linear-gradient(135deg, var(--purple), var(--red));
  border-color: transparent;
}
.radio-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #fff;
  opacity: 0;
  transform: scale(0);
  transition: all 0.15s;
}
.custom-radio.is-checked .radio-dot { opacity: 1; transform: scale(1); }

/* Divider label inside filter list */
.filter-divider-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted);
  padding: 6px 2px 2px;
}

/* Count badge on participant tags */
.ptag-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(131,58,180,0.4);
  border-radius: 20px;
  font-size: 10px; font-weight: 700;
  padding: 0 6px; margin-left: 4px; min-width: 18px; height: 16px;
  color: #e9d5ff;
}

/* Participants */
.participants-wrap {
  display: flex; flex-wrap: wrap; gap: 7px;
  max-height: 280px; overflow-y: auto;
  padding: 2px;
}
.participants-wrap::-webkit-scrollbar { width: 3px; }
.participants-wrap::-webkit-scrollbar-track { background: transparent; }
.participants-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.ptag {
  background: rgba(131,58,180,0.15);
  border: 1px solid rgba(131,58,180,0.3);
  color: #c4b5fd; padding: 5px 11px;
  border-radius: 20px; font-size: 13px; font-weight: 500;
  animation: popIn 0.2s ease;
}
@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Slot avatars */
.slot-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.slot-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(131,58,180,0.3);
  flex-shrink: 0;
}
.slot-avatar-placeholder {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--red));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* Slot machine */
.slot-machine {
  position: relative; height: 200px;
  background: rgba(0,0,0,0.4);
  overflow: hidden;
}
.slot-viewport { height: 100%; overflow: hidden; position: relative; }
.slot-reel {
  position: absolute; top: 0; left: 0; right: 0;
  will-change: transform;
}
.slot-item {
  height: 64px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: rgba(196,181,253,0.8);
}
.slot-item.active {
  font-size: 26px; font-weight: 800;
  background: linear-gradient(135deg, #a855f7, #ec4899, #f97316);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.slot-fade {
  position: absolute; left: 0; right: 0; height: 70px; z-index: 2; pointer-events: none;
}
.slot-fade-top { top: 0; background: linear-gradient(to bottom, var(--bg), transparent); }
.slot-fade-bottom { bottom: 0; background: linear-gradient(to top, var(--bg), transparent); }
.slot-line {
  position: absolute; left: 12px; right: 12px; top: 50%; z-index: 3;
  height: 2px; margin-top: -1px;
  background: linear-gradient(90deg, transparent, var(--purple), var(--red), var(--yellow), transparent);
}

/* Draw counter */
.draw-num { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Winners */
.winners-title {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 20px 0 14px;
  font-size: 22px; font-weight: 800;
}
.winners-title h2 { font-size: 22px; font-weight: 800; }

.winner-card {
  position: relative;
  background: rgba(131,58,180,0.08);
  border: 1px solid rgba(131,58,180,0.25);
  border-radius: 16px; padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 10px;
  animation: winnerPop 0.5s cubic-bezier(0.175,0.885,0.32,1.275) both;
}
@keyframes winnerPop {
  from { opacity: 0; transform: scale(0.85) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.winner-place {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--yellow));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.winner-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(131,58,180,0.5);
  flex-shrink: 0;
}
.winner-avatar-placeholder {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--red));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.winner-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.winner-fullname {
  font-size: 13px; font-weight: 600; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.winner-name {
  font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, #a855f7, #f97316);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.winner-comment {
  font-size: 12px; color: rgba(255,255,255,0.5);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 320px;
  margin-top: 2px;
}

/* Redraw winner button */
.btn-redraw-winner {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s;
  color: inherit;
}
.btn-redraw-winner:hover { background: rgba(255,255,255,0.15); transform: rotate(30deg); }

/* No-coins section */
.no-coins-section {
  margin-top: 14px;
  padding: 16px;
  background: rgba(251,191,36,0.06);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 14px;
}
.no-coins-msg {
  font-size: 13px; color: rgba(251,191,36,0.85);
  margin-bottom: 12px; text-align: center;
}
.coin-packages {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.coin-pkg {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 12px;
  cursor: pointer; font-family: inherit;
  transition: all 0.18s;
}
.coin-pkg:hover { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.5); transform: translateY(-1px); }
.pkg-coins { font-size: 16px; font-weight: 800; color: #fbbf24; }
.pkg-price { font-size: 12px; color: var(--muted); font-weight: 600; }

/* Action row */
.action-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.action-row .btn { flex: 1; justify-content: center; }

/* Error */
.error-msg {
  background: rgba(225,48,108,0.1);
  border: 1px solid rgba(225,48,108,0.3);
  border-radius: 10px; padding: 11px 14px;
  font-size: 13px; color: #fca5a5;
  margin-top: 12px;
}

/* Responsive */
@media (max-width: 480px) {
  body { padding: 12px 12px 50px; }
  .stats-grid { grid-template-columns: repeat(3,1fr); }
  .stat-val { font-size: 20px; }
  .input-btn-row { flex-direction: column; }
  .action-row { flex-direction: column; }
  .logo h1 { font-size: 24px; }
}
