:root{
  --bg:#14111c;
  --bg-alt:#1a1626;
  --surface:#211c30;
  --surface-2:#2a2440;
  --line:#382f4d;
  --text:#f5f2fa;
  --text-muted:#a89bc4;
  --brand:#ff4d5e;
  --brand-2:#ffc857;
  --danger:#ff6b6b;
  --ok:#58e0b0;
  --radius:16px;
  --font-display:'Space Grotesk','Arial Narrow',sans-serif;
  --font-body:'Inter',system-ui,sans-serif;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
  min-height:100vh;
}
a{color:inherit;}
:focus-visible{outline:2px solid var(--brand-2); outline-offset:2px;}
button{font-family:inherit;}

.hero-stripe{
  height:6px;
  background:repeating-linear-gradient(45deg, var(--brand) 0 16px, var(--brand-2) 16px 32px);
}

/* ---------- Nav ---------- */
.topnav{
  display:flex; align-items:center; justify-content:space-between;
  max-width:1080px; margin:0 auto; padding:20px 24px 0;
}
.wordmark{
  font-family:var(--font-display); font-weight:700; font-size:1.5rem;
  letter-spacing:-0.02em; text-decoration:none;
}
.topnav-links{display:flex; gap:20px; font-size:0.92rem;}
.topnav-links a{text-decoration:none; color:var(--text-muted);}
.topnav-links a:hover{color:var(--text);}

.page{max-width:1080px; margin:0 auto; padding:24px 24px 64px;}

/* ---------- Flash ---------- */
.flash{
  border-radius:10px; padding:12px 16px; margin-bottom:20px; font-size:0.92rem;
}
.flash-success{background:color-mix(in srgb, var(--ok) 18%, var(--surface)); border:1px solid var(--ok);}
.flash-error{background:color-mix(in srgb, var(--danger) 18%, var(--surface)); border:1px solid var(--danger);}

/* ---------- Typography ---------- */
h1{font-family:var(--font-display); font-weight:700; font-size:clamp(1.6rem,4vw,2.1rem); margin:0 0 6px;}
h2{font-family:var(--font-display); font-weight:600; font-size:1.25rem; margin:0 0 4px;}
p.lead{color:var(--text-muted); margin:0 0 28px; max-width:60ch; line-height:1.5;}

/* ---------- Cards / tables ---------- */
.card{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:22px;
}
.list-header{display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; flex-wrap:wrap; gap:12px;}
.btn{
  display:inline-flex; align-items:center; gap:6px;
  border-radius:999px; padding:11px 22px; font-size:0.92rem; font-weight:600;
  cursor:pointer; border:1px solid transparent; text-decoration:none;
}
.btn-primary{background:linear-gradient(120deg, var(--brand), var(--brand-2)); color:#14111c;}
.btn-primary:disabled{opacity:0.45; cursor:not-allowed;}
.btn-ghost{background:transparent; border-color:var(--line); color:var(--text);}
.btn-ghost:hover{border-color:var(--brand-2);}
.btn-danger{background:transparent; border-color:var(--danger); color:var(--danger);}
.btn-danger:hover{background:color-mix(in srgb, var(--danger) 14%, transparent);}
.btn-sm{padding:7px 14px; font-size:0.82rem;}

table.giveaways{width:100%; border-collapse:collapse; font-size:0.92rem;}
table.giveaways th{text-align:left; color:var(--text-muted); font-weight:600; font-size:0.8rem; padding:0 10px 10px; border-bottom:1px solid var(--line);}
table.giveaways td{padding:14px 10px; border-bottom:1px solid var(--line); vertical-align:middle;}
table.giveaways tr:last-child td{border-bottom:none;}
table.giveaways a.title-link{font-weight:600; text-decoration:none;}
table.giveaways a.title-link:hover{text-decoration:underline;}
.row-actions{display:flex; gap:8px; flex-wrap:wrap;}

.badge{display:inline-block; padding:3px 10px; border-radius:999px; font-size:0.76rem; font-weight:600;}
.badge-draft{background:var(--surface-2); color:var(--text-muted);}
.badge-completed{background:color-mix(in srgb, var(--ok) 22%, transparent); color:var(--ok);}

.empty-state{color:var(--text-muted); padding:30px 0; text-align:center;}

/* ---------- Forms ---------- */
form.stack{display:flex; flex-direction:column; gap:20px;}
.field-group{display:flex; flex-direction:column; gap:8px;}
.field-group label{font-size:0.92rem; font-weight:600;}
.field-hint{margin:0; font-size:0.82rem; color:var(--text-muted); line-height:1.4;}
textarea, input[type="text"], input[type="number"], input[type="password"]{
  background:var(--bg-alt); border:1px solid var(--line); color:var(--text);
  border-radius:10px; padding:10px 12px; font-family:var(--font-body); font-size:0.94rem;
  width:100%;
}
textarea{min-height:150px; line-height:1.5; resize:vertical;}
.field-row{display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;}
.checkbox,.radio{display:flex; align-items:center; gap:7px; font-size:0.88rem; color:var(--text-muted); cursor:pointer;}
.checkbox input,.radio input{accent-color:var(--brand);}
.count{font-size:0.82rem; color:var(--text-muted); white-space:nowrap;}
.anim-choice{display:flex; gap:18px; flex-wrap:wrap;}
.color-row{display:flex; gap:22px; flex-wrap:wrap;}
.color-field{display:flex; flex-direction:column; gap:6px; font-size:0.84rem; color:var(--text-muted);}
input[type="color"]{width:46px; height:32px; border:1px solid var(--line); border-radius:8px; background:none; padding:2px; cursor:pointer;}
input[type="file"]{font-size:0.84rem; color:var(--text-muted);}
input[type="number"]{width:100px;}
.form-actions{display:flex; gap:10px;}
.error-list{background:color-mix(in srgb, var(--danger) 16%, var(--surface)); border:1px solid var(--danger); border-radius:10px; padding:14px 18px; margin-bottom:20px; font-size:0.88rem;}
.error-list ul{margin:6px 0 0; padding-left:18px;}

.login-shell{max-width:380px; margin:60px auto; padding:0 20px;}

/* ---------- Stage (Auslosungs-Bühne) ---------- */
.stage-ticket{
  position:relative; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  overflow:hidden; display:flex; flex-direction:column; align-items:center; text-align:center;
  padding:0 22px 26px; margin-bottom:24px;
}
.ticket-strip{width:100%; height:8px; background:repeating-linear-gradient(45deg, var(--stage-primary,#ff4d5e) 0 12px, var(--stage-secondary,#ffc857) 12px 24px);}
.ticket-head{width:100%; display:flex; align-items:center; justify-content:space-between; padding:16px 2px 4px;}
.brand-slot{display:flex; align-items:center; gap:8px;}
.logo-img{height:28px; max-width:120px; object-fit:contain; border-radius:6px;}
.logo-fallback{font-family:var(--font-display); font-weight:600; font-size:0.95rem; color:var(--text-muted);}
.serial{font-family:var(--font-display); font-size:0.78rem; color:var(--text-muted);}
.draw-title{font-family:var(--font-display); font-weight:600; font-size:1.35rem; margin:10px 0 4px; min-height:1.4em;}
.anim-wrap{width:100%; display:flex; justify-content:center; margin:18px 0 6px; position:relative;}
.wheel-wrap{position:relative; width:min(320px,78vw); aspect-ratio:1/1;}
.wheel-pointer{
  position:absolute; top:-4px; left:50%; transform:translateX(-50%); width:0; height:0; z-index:2;
  border-left:12px solid transparent; border-right:12px solid transparent;
  border-top:20px solid var(--stage-secondary,#ffc857);
  filter:drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}
#wheelCanvas{width:100%; height:100%; border-radius:50%; box-shadow:0 0 0 6px var(--bg-alt),0 10px 30px rgba(0,0,0,0.45); transform:rotate(0deg);}
.reel-wrap{width:100%; max-width:340px;}
.reel-window{background:var(--bg-alt); border:1px solid var(--line); border-radius:12px; padding:22px 16px; overflow:hidden;}
#reelText{display:block; font-family:var(--font-display); font-weight:600; font-size:1.4rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
#reelText.settle{animation:settlePop .42s cubic-bezier(.2,1.4,.4,1);}
@keyframes settlePop{0%{transform:scale(.9);opacity:.6;}55%{transform:scale(1.08);}100%{transform:scale(1);opacity:1;}}
.result{margin-top:6px; display:flex; flex-direction:column; gap:2px;}
.result-label{font-size:.78rem; color:var(--text-muted);}
.result-name{font-family:var(--font-display); font-weight:700; font-size:1.6rem; color:var(--stage-secondary,#ffc857);}
.winners-list{width:100%; display:flex; flex-direction:column; gap:6px; margin-top:14px; max-height:220px; overflow-y:auto;}
.winner-row{display:flex; align-items:center; gap:10px; background:var(--surface-2); border-radius:9px; padding:8px 12px; font-size:.9rem; text-align:left;}
.winner-rank{font-family:var(--font-display); font-weight:700; color:var(--stage-primary,#ff4d5e); min-width:1.6em;}
.avatar-thumb{width:28px; height:28px; border-radius:50%; object-fit:cover; flex-shrink:0; background:var(--surface-2);}
.avatar-placeholder{width:28px; height:28px; border-radius:50%; background:var(--surface-2); display:flex; align-items:center; justify-content:center; font-size:.75rem; color:var(--text-muted); flex-shrink:0;}
.avatar-thumb-lg{width:64px; height:64px; border-radius:50%; object-fit:cover; margin:4px 0; box-shadow:0 0 0 3px var(--stage-secondary,#ffc857);}
.stage-actions{display:flex; gap:10px; margin-top:20px; width:100%; justify-content:center; flex-wrap:wrap;}
.hint{font-size:.82rem; color:var(--text-muted); min-height:1.3em; margin:10px 0 0;}

.draw-log{margin-top:6px;}
.draw-log summary{cursor:pointer; font-size:.85rem; color:var(--text-muted); margin-bottom:8px;}
.draw-log-entry{font-size:.82rem; color:var(--text-muted); padding:6px 0; border-top:1px solid var(--line);}

#confettiCanvas{position:fixed; inset:0; pointer-events:none; z-index:50;}

@media (max-width:640px){
  .topnav{flex-direction:column; align-items:flex-start; gap:10px;}
}
@media (prefers-reduced-motion: reduce){
  #wheelCanvas{transition-duration:.25s !important;}
}
