:root{
  --bg:#0b1020;
  --card:#121a33;
  --card2:#0f1730;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --border:rgba(255,255,255,.08);
  --shadow:rgba(0,0,0,.4);
  --primary:#60a5fa;
  --danger:#fb7185;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 600px at 20% 0%, #1b2a5a 0%, var(--bg) 55%) fixed;
  color:var(--text);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  background:rgba(0,0,0,.25);
  backdrop-filter: blur(10px);
  position:sticky;
  top:0;
  z-index:10;
}

.brand{display:flex;align-items:center;gap:12px}
.logo{font-size:26px}
.title{font-weight:800;font-size:18px;line-height:1}
.subtitle{color:var(--muted);font-size:12px;margin-top:2px}

.promo{
  display:flex;align-items:center;gap:10px;
  text-decoration:none;
  color:var(--text);
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  background:rgba(255,255,255,.04);
}
.promo:hover{background:rgba(255,255,255,.06)}
.handle{font-weight:700}
.pill{
  font-size:12px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.2);
}
.pill.live{background:rgba(239,68,68,.2); border-color:rgba(239,68,68,.55); color:#fecaca; font-weight:800}
.pill.offline{opacity:.8}

.wrap{
  display:grid;
  grid-template-columns: minmax(360px, 1fr) 360px;
  gap:18px;
  padding:18px;
  max-width: 1320px;
  margin:0 auto;
}

@media (max-width: 1050px){
  .wrap{grid-template-columns: 1fr; }
  .side{order:-1}
}

.wheel-card{
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border-radius:18px;
  box-shadow:0 20px 60px var(--shadow);
  padding:16px;
}

.wheel-stage{
  position:relative;
  width:min(720px, 100%);
  margin:0 auto;
}
#wheel{
  width:100%;
  height:auto;
  display:block;
  border-radius:50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.06), rgba(0,0,0,.18));
  border:1px solid var(--border);
}

.pointer{
  position:absolute;
  top:10px;
  left:50%;
  transform: translateX(-50%);
  width:0;height:0;
  border-left:16px solid transparent;
  border-right:16px solid transparent;
  border-top:28px solid #fff;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.6));
}

.controls{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:14px;
  align-items:center;
  justify-content:space-between;
}

.btn{
  appearance:none;
  border:1px solid var(--border);
  background:rgba(255,255,255,.04);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
}
.btn:hover{background:rgba(255,255,255,.06)}
.btn:disabled{opacity:.45; cursor:not-allowed}

.btn.primary{
  background:rgba(96,165,250,.18);
  border-color:rgba(96,165,250,.6);
}
.btn.danger{
  background:rgba(251,113,133,.16);
  border-color:rgba(251,113,133,.65);
}

.meta{display:flex;gap:16px;flex-wrap:wrap;color:var(--muted);font-size:13px}
.label{color:var(--text);font-weight:800;margin-right:6px}

.help{
  margin-top:14px;
  border-top:1px solid var(--border);
  padding-top:14px;
}
.help-title{font-weight:900; margin-bottom:8px}
.help ul{margin:8px 0 0 18px; color:var(--muted)}
.help code{
  background:rgba(0,0,0,.25);
  border:1px solid var(--border);
  padding:2px 6px;
  border-radius:8px;
  color:var(--text);
  font-weight:800;
}
.note{color:var(--muted); margin-top:10px}

.side{display:flex;flex-direction:column;gap:14px}
.panel{
  border:1px solid var(--border);
  background: rgba(18,26,51,.75);
  border-radius:18px;
  padding:14px;
  box-shadow:0 16px 40px var(--shadow);
}
.panel-title{font-weight:900; margin-bottom:10px}
.muted{color:var(--muted)}
.tiny{font-size:12px}
.row{display:flex;gap:10px;align-items:center;margin:10px 0}
.input{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.25);
  color:var(--text);
}
.textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.25);
  color:var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  resize: vertical;
}

/*
  Utility: hide any element.
  NOTE: Some components (like .winner-overlay) are declared later with their own
  display rules. Without !important, those later rules can override .hidden when an
  element has both classes (e.g. "winner-overlay hidden"), causing overlays to show
  on initial load.
*/
.hidden{display:none !important}

/* Landing overlay (shown on / when no channel is selected) */
.landing{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.65);
  display:grid;
  place-items:center;
  z-index:50;
  padding:20px;
}

.landing-card{
  width:min(520px,100%);
  background:rgba(15,23,42,.92);
  border:1px solid rgba(255,255,255,.10);
  border-radius:18px;
  padding:18px;
  box-shadow:0 20px 60px rgba(0,0,0,.55);
}

.landing-title{
  font-weight:800;
  font-size:18px;
  margin-bottom:6px;
}

.kv{
  display:flex;
  justify-content:space-between;
  padding:8px 0;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.kv:last-child{border-bottom:none}
.k{color:var(--muted)}
.v{font-weight:800}

.footer{
  padding:14px 18px;
  color:var(--muted);
  font-size:12px;
  text-align:center;
  border-top:1px solid var(--border);
  background:rgba(0,0,0,.18);
}


/* Winner popup */
.winner-overlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
  z-index: 50;
}
.winner-card{
  width: min(520px, 92vw);
  border-radius: 18px;
  padding: 22px 22px 18px;
  background: rgba(8,12,24,.85);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 18px 70px rgba(0,0,0,.55);
  text-align: center;
}
.winner-title{
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .85;
  font-size: 12px;
  margin-bottom: 10px;
}
.winner-name{
  font-size: 40px;
  font-weight: 900;
  line-height: 1.05;
  margin: 0 0 14px;
}
.winner-img{
  width: 120px;
  height: 120px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  display: block;
  margin: 0 auto;
}

.winner-actions{
  display:flex;
  gap:12px;
  justify-content:center;
  align-items:center;
  flex-wrap:wrap;
  margin-top:18px;
}
.winner-actions .btn{
  min-width:120px;
}

.error{
  color: #fca5a5;
  margin-top: 6px;
  line-height: 1.2;
}

.confetti{
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.confetti-piece{
  position: absolute;
  top: -12px;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  background: rgba(255,255,255,.8);
  animation: confettiFall 1.9s ease-in forwards;
}
@keyframes confettiFall{
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* === StreamWheel header: slimmer + centered brand + By GopGang left === */
.topbar.topbar-slim{
  padding: 8px 14px;
  min-height: 56px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.topbar.topbar-slim .top-left{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  min-width: 0;
}

.topbar.topbar-slim .brand-center{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  min-width: 0;
}

.topbar.topbar-slim .brand-row{
  display:flex;
  align-items:center;
  gap:8px;
}

.topbar.topbar-slim .logo{
  font-size: 18px;
  line-height: 1;
}

.topbar.topbar-slim .title{
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .2px;
  line-height: 1;
}

.topbar.topbar-slim .subtitle{
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.1;
  opacity: .85;
  white-space: nowrap;
}

/* Byline (bigger, replaces old left brand) */
.byline{
  display:flex;
  align-items:center;
  gap:10px;
  color: rgba(229,231,235,.92);
  font-weight: 900;
}

.byline-icon{
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.04);
}

.byline-big .byline-icon-big{
  width:34px;
  height:34px;
  border-radius:12px;
}

.byline-big .byline-text{
  display:flex;
  flex-direction:column;
  line-height:1.05;
}

.byline-big .byline-label{
  font-size: 11px;
  opacity:.8;
  font-weight:800;
}

.byline-big .byline-name{
  font-size: 15px;
  font-weight: 1000;
  letter-spacing: .2px;
}

/* Right side links */
.top-links{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  min-width: 0;
}

.topbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px 10px;
  border-radius:999px;
  text-decoration:none;
  font-weight:900;
  border:1px solid var(--border);
  background:rgba(255,255,255,.04);
  color:var(--text);
  white-space:nowrap;
  font-size: 12px;
}
.topbtn:hover{background:rgba(255,255,255,.06)}

/* Purple Discord button */
.topbtn.discord-btn{
  background: rgba(88, 101, 242, .22);
  border-color: rgba(88, 101, 242, .40);
}
.topbtn.discord-btn:hover{
  background: rgba(88, 101, 242, .30);
}

/* Keep promo compact so header stays slim */
.topbar.topbar-slim .promo{
  padding: 6px 10px;
}

/* Mobile: stack header */
@media (max-width: 760px){
  .topbar.topbar-slim{
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 12px;
  }
  .topbar.topbar-slim .top-left{ justify-content:center; }
  .topbar.topbar-slim .top-links{ justify-content:center; }
  .topbar.topbar-slim .subtitle{ white-space: normal; }
}
