:root {
  --bg1: #141737;
  --bg2: #2b1055;
  --card: rgba(255, 255, 255, .08);
  --gold: #ffd166;
  --text: #f4f4fb;
  --muted: #a9acd0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at top, var(--bg2), var(--bg1) 70%) fixed;
}
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }

/* ---------- Stage ---------- */
.stage {
  position: relative;
  height: 100%;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  padding: 14px 20px 10px;
}
.stage-head { text-align: center; }
.stage-head h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.6vw, 3.2rem);
  letter-spacing: .04em;
  color: var(--gold);
  text-shadow: 0 3px 18px rgba(255, 209, 102, .35);
}
.prize-banner {
  margin-top: 6px;
  font-size: clamp(1.1rem, 2.4vw, 2rem);
  font-weight: 600;
  min-height: 1.4em;
}
.prize-banner small { color: var(--muted); font-weight: 500; margin-left: .4em; }
.stage-main {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 20px;
  align-items: stretch;
}
.wheel-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
}
.wheel-wrap canvas { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: block; }
.winners {
  width: 280px;
  flex: none;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  overflow-y: auto;
  align-self: stretch;
  margin: 8px 0;
}
.winners h2 { margin: 0 0 8px; font-size: 1.1rem; color: var(--gold); }
.wg { margin-bottom: 12px; }
.wg-title { font-weight: 700; font-size: .95rem; border-bottom: 1px solid rgba(255, 255, 255, .15); padding-bottom: 3px; margin-bottom: 4px; }
.wg ol { margin: 0; padding-left: 1.4em; font-size: .95rem; }
.hide-winners .winners { display: none; }
.stage-foot { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .9rem; padding-top: 4px; }
.spacer { flex: 1; }
.chip {
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .85rem;
}
.chip:hover { background: rgba(255, 255, 255, .16); }

.reveal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 30, .78);
  backdrop-filter: blur(4px);
  cursor: pointer;
  animation: fadeIn .4s ease;
}
.reveal[hidden] { display: none; }
.reveal-card {
  text-align: center;
  padding: 3vh 5vw;
  max-width: 92%;
  animation: pop .6s cubic-bezier(.2, 1.4, .4, 1);
}
.reveal-prize { font-size: clamp(1.2rem, 3vw, 2.4rem); color: var(--gold); font-weight: 700; }
.reveal-label { font-size: clamp(1rem, 2vw, 1.6rem); color: var(--muted); margin: 1vh 0; text-transform: uppercase; letter-spacing: .3em; }
.reveal-name {
  font-size: clamp(2.2rem, 8vw, 7rem);
  font-weight: 800;
  line-height: 1.1;
  word-break: break-word;
  text-shadow: 0 6px 30px rgba(255, 209, 102, .5);
}
.reveal-hint { margin-top: 3vh; font-size: .8rem; color: var(--muted); opacity: .7; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: minmax(360px, 1fr) 460px; height: 100%; }
.admin-layout .stage-pane { min-width: 0; height: 100%; }
.panel {
  background: #f5f6fb;
  color: #1c1f3a;
  height: 100%;
  overflow-y: auto;
  padding: 0 0 30px;
}
.panel * { color: inherit; }
.panel .muted { color: #6b6f91; }
.panel a { color: #3b4cca; }
.tabs { display: flex; position: sticky; top: 0; background: #1b1f3b; z-index: 5; }
.tabs button {
  flex: 1; border: 0; background: none; color: #c9cbe8 !important; padding: 12px 4px; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.tabs button.active { color: #fff !important; border-bottom-color: var(--gold); }
.tab { display: none; padding: 16px; }
.tab.active { display: block; }
.panel h3 { margin: 18px 0 8px; font-size: 1rem; }
.panel h3:first-child { margin-top: 0; }
.panel label { display: block; font-size: .85rem; margin: 8px 0 3px; font-weight: 600; }
.panel input[type=text], .panel input[type=password], .panel input[type=number], .panel select, .panel textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c9cce3; border-radius: 8px; font: inherit; background: #fff; color: #1c1f3a;
}
.panel textarea { min-height: 90px; resize: vertical; }
.btn {
  border: 0; border-radius: 8px; padding: 8px 14px; background: #3b4cca; color: #fff !important; font-weight: 600;
}
.btn:hover { background: #2f3fb5; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #e3e5f5; color: #1c1f3a !important; }
.btn.danger { background: #d1344b; }
.btn.small { padding: 4px 9px; font-size: .8rem; }
.btn.big {
  width: 100%; font-size: 1.6rem; padding: 18px; background: linear-gradient(135deg, #f77f00, #e63946); letter-spacing: .08em;
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.card { background: #fff; border: 1px solid #dfe1f0; border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.stat { display: flex; gap: 10px; margin-bottom: 12px; }
.stat div { flex: 1; background: #fff; border: 1px solid #dfe1f0; border-radius: 10px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; }
.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid #e6e8f4; }
.list li .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: .72rem; padding: 2px 7px; border-radius: 999px; background: #e3e5f5; }
.tag.won { background: #d7f5e0; }
.tag.absent { background: #fde0d4; }
table.preview { width: 100%; border-collapse: collapse; font-size: .82rem; background: #fff; }
table.preview td, table.preview th { border: 1px solid #dfe1f0; padding: 3px 6px; text-align: left; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.preview th.sel, table.preview td.sel { background: #fff4c9; }
.msg { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #e3e5f5; font-size: .9rem; }
.msg.err { background: #fde0d4; }
.msg.ok { background: #d7f5e0; }
.login-box { max-width: 340px; margin: 14vh auto; background: #fff; color: #1c1f3a; padding: 24px; border-radius: 14px; }
.login-box h2 { margin-top: 0; }
.login-box input { width: 100%; padding: 10px; border: 1px solid #c9cce3; border-radius: 8px; margin: 8px 0 12px; font: inherit; }
.prize-pick { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.prize-opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 2px solid #dfe1f0; border-radius: 10px; background: #fff; cursor: pointer; }
.prize-opt.cur { border-color: #3b4cca; background: #eef0ff; }
.prize-opt.done { opacity: .55; }
.prize-opt .grow { flex: 1; font-weight: 600; }

@media (max-width: 1000px) {
  .admin-layout { display: block; height: auto; }
  .admin-layout .stage-pane { height: 75vh; min-height: 440px; }
  .panel { height: auto; overflow: visible; }
  .winners { width: 200px; }
}
