:root {
  --orange: #ff6b00;
  --orange-2: #ff8a00;
  --yellow: #ffd33d;
  --yellow-soft: #fff2ad;
  --blue: #0b4ca8;
  --blue-2: #123777;
  --ink: #16213a;
  --muted: #667085;
  --surface: rgba(255, 255, 255, 0.88);
  --line: rgba(20, 35, 65, 0.10);
  --shadow: 0 24px 70px rgba(26, 40, 74, 0.14);
  --radius: 28px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 211, 61, 0.28), transparent 30%),
    radial-gradient(circle at 100% 30%, rgba(255, 107, 0, 0.16), transparent 30%),
    linear-gradient(145deg, #fffdf4 0%, #fff8e7 48%, #eef5ff 100%);
  overflow-x: hidden;
}

button, input { font: inherit; }
button { cursor: pointer; }

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.background-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(4px);
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
}
.orb-a { width: 260px; height: 260px; background: #ffd33d; top: 80px; left: -110px; }
.orb-b { width: 300px; height: 300px; background: #ff7a00; top: 480px; right: -170px; }
.orb-c { width: 220px; height: 220px; background: #3c85df; bottom: 40px; left: 6%; opacity: 0.18; }

.page-shell { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 22px 0 42px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 0 24px;
}

.brand { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.brand img { width: 106px; height: 72px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(40, 62, 110, 0.12)); }
.brand div { display: grid; gap: 2px; }
.brand strong { font-family: "Baloo 2", sans-serif; font-size: 23px; line-height: 1; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); }
.live-pill { display: inline-flex; align-items: center; gap: 9px; padding: 10px 14px; border: 1px solid rgba(255,107,0,.22); border-radius: 999px; background: rgba(255,255,255,.75); font-size: 12px; font-weight: 800; letter-spacing: .04em; color: #aa4200; box-shadow: 0 10px 30px rgba(60,50,20,.08); }
.live-pill span { width: 9px; height: 9px; border-radius: 50%; background: #ff4b22; box-shadow: 0 0 0 6px rgba(255,75,34,.12); animation: pulse 1.4s infinite; }

.hero { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 50px 44px 38px; margin-bottom: 24px; border-radius: 34px; overflow: hidden; color: white; background: linear-gradient(125deg, #0a438f 0%, #0b56bd 55%, #1473d5 100%); box-shadow: 0 28px 80px rgba(11,76,168,.20); }
.hero::before { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(255,211,61,.92) 0%, rgba(255,122,0,.58) 38%, transparent 70%); top: -250px; right: 50px; }
.hero-copy { position: relative; z-index: 2; max-width: 760px; }
.badge { display: inline-flex; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15); font-size: 12px; font-weight: 800; letter-spacing: .03em; }
.hero h1 { margin: 16px 0 12px; font-family: "Baloo 2", sans-serif; font-size: clamp(40px, 6vw, 70px); line-height: .93; letter-spacing: -.035em; }
.hero h1 em { color: var(--yellow); font-style: normal; }
.hero p { max-width: 680px; margin: 0; color: rgba(255,255,255,.82); font-size: 16px; line-height: 1.65; }
.sun-mark { position: relative; z-index: 2; display: grid; place-items: center; width: 142px; height: 142px; border-radius: 50%; font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 34px; color: var(--blue); background: linear-gradient(145deg, #fff8a8, #ffd33d 58%, #ffb000); box-shadow: 0 0 0 16px rgba(255,211,61,.12), 0 22px 38px rgba(0,0,0,.16); transform: rotate(-8deg); }

.card { padding: 30px; border: 1px solid rgba(255,255,255,.78); border-radius: var(--radius); background: var(--surface); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.loader-card { margin-bottom: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.section-head h2 { margin: 4px 0 0; font-family: "Baloo 2", sans-serif; font-size: 30px; line-height: 1; }
.step { font-size: 11px; letter-spacing: .12em; font-weight: 900; color: var(--orange); }
.step.light { color: #ffe681; }
.session-badge { padding: 8px 11px; border-radius: 999px; background: #f2f4f7; color: #667085; font-size: 11px; font-weight: 800; }
.session-badge.ok { background: #eafaf0; color: #117a40; }
.session-badge.warn { background: #fff4df; color: #a95a00; }

.load-form label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 800; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.input-wrap { position: relative; }
.instagram-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: white; font-weight: 900; background: linear-gradient(135deg,#833ab4,#fd1d1d,#fcb045); }
input[type="url"], input[type="text"] { width: 100%; min-height: 52px; border: 1px solid #d7dce4; border-radius: 15px; background: white; color: var(--ink); outline: 0; transition: .2s; }
input[type="url"] { padding: 0 16px 0 55px; }
input[type="text"] { padding: 0 14px; }
input:focus { border-color: #4d86ce; box-shadow: 0 0 0 4px rgba(31,102,190,.10); }

.primary-btn, .secondary-btn, .ghost-btn { border: 0; border-radius: 14px; font-weight: 800; transition: transform .18s, box-shadow .18s, opacity .18s; }
.primary-btn { padding: 0 20px; min-height: 52px; color: white; background: linear-gradient(135deg, var(--orange), #ff8d16); box-shadow: 0 12px 25px rgba(255,107,0,.22); }
.secondary-btn { min-height: 48px; padding: 0 18px; color: var(--blue); background: #eef5ff; }
.ghost-btn { min-height: 42px; padding: 0 15px; color: var(--blue); background: #eef5ff; }
.primary-btn:hover, .secondary-btn:hover, .ghost-btn:hover, .draw-btn:hover { transform: translateY(-2px); }
button:disabled { cursor: not-allowed; opacity: .55; transform: none !important; }

.loading-box, .message-box { margin-top: 16px; border-radius: 16px; padding: 16px; }
.loading-box { display: flex; align-items: center; gap: 14px; background: #f6f9ff; border: 1px solid #e0e9f7; }
.loading-box strong, .loading-box span { display: block; }
.loading-box span { margin-top: 3px; font-size: 12px; color: var(--muted); }
.spinner { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; border: 4px solid #dbe6f5; border-top-color: var(--blue); animation: spin .8s linear infinite; }
.message-box { font-size: 13px; line-height: 1.55; background: #fff9e7; border: 1px solid #f5df9c; color: #785600; }
.message-box.error { background: #fff0ef; border-color: #ffc8c4; color: #a62d23; }
.hidden { display: none !important; }

.workspace { display: grid; gap: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stat-card { position: relative; overflow: hidden; padding: 22px 24px; border-radius: 22px; color: white; box-shadow: var(--shadow); }
.stat-card::after { content: ""; position: absolute; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.14); right: -35px; top: -35px; }
.stat-card span { display: block; font-size: 12px; font-weight: 700; opacity: .82; }
.stat-card strong { display: block; margin-top: 6px; font-family: "Baloo 2", sans-serif; font-size: 42px; line-height: 1; }
.stat-card.orange { background: linear-gradient(135deg,#ff5d00,#ff8a00); }
.stat-card.blue { background: linear-gradient(135deg,#093a82,#0b5ec9); }
.stat-card.yellow { color: #563d00; background: linear-gradient(135deg,#ffd33d,#ffe887); }

.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.toggle-card, .field-card { display: block; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.72); }
.toggle-card { display: grid; grid-template-columns: auto 1fr; column-gap: 13px; align-items: start; cursor: pointer; }
.toggle-card input { position: absolute; opacity: 0; pointer-events: none; }
.toggle { width: 46px; height: 26px; border-radius: 999px; background: #d7dce5; padding: 3px; transition: .2s; }
.toggle::after { content: ""; display: block; width: 20px; height: 20px; border-radius: 50%; background: white; box-shadow: 0 2px 7px rgba(0,0,0,.18); transition: .2s; }
.toggle-card input:checked + .toggle { background: var(--orange); }
.toggle-card input:checked + .toggle::after { transform: translateX(20px); }
.toggle-card strong, .field-card > span { display: block; font-size: 13px; font-weight: 800; }
.toggle-card small, .field-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.field-card input { margin-top: 10px; min-height: 45px; }
.field-card.full { grid-column: 1 / -1; }

.draw-stage { position: relative; overflow: hidden; padding: 42px 30px 48px; border-radius: 32px; text-align: center; color: white; background: linear-gradient(145deg,#092f6b,#0b4ca8 50%,#0b65d5); box-shadow: 0 30px 80px rgba(11,76,168,.25); }
.draw-stage::before { content: ""; position: absolute; inset: 0; opacity: .10; background-image: radial-gradient(circle at 20% 20%, white 0 2px, transparent 3px), radial-gradient(circle at 75% 30%, white 0 1.5px, transparent 2.5px), radial-gradient(circle at 40% 75%, white 0 2px, transparent 3px); background-size: 120px 120px, 95px 95px, 150px 150px; }
.draw-copy { position: relative; z-index: 2; }
.draw-copy h2 { margin: 5px 0 2px; font-family: "Baloo 2", sans-serif; font-size: 40px; }
.draw-copy p { margin: 0; color: rgba(255,255,255,.72); font-size: 13px; }
.roulette-shell { position: relative; z-index: 2; width: min(650px, 92%); margin: 32px auto 24px; padding: 2px; border-radius: 25px; background: linear-gradient(110deg,#ffd33d,#ff7a00,#ffd33d); box-shadow: 0 20px 45px rgba(0,0,0,.18); }
.roulette-glow { position: absolute; inset: -20px; background: rgba(255,211,61,.14); filter: blur(22px); border-radius: 40px; }
.roulette-window { position: relative; min-height: 148px; display: grid; place-items: center; align-content: center; padding: 24px; border-radius: 23px; background: rgba(7,32,74,.95); overflow: hidden; }
.roulette-window::before, .roulette-window::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: rgba(255,255,255,.08); }
.roulette-window::before { top: 34%; }
.roulette-window::after { bottom: 24%; }
.small-label { font-size: 9px; letter-spacing: .18em; font-weight: 900; color: #ffd965; }
#rouletteName { margin: 7px 0 4px; font-family: "Baloo 2", sans-serif; font-size: clamp(27px, 5vw, 43px); color: white; }
#rouletteComment { max-width: 520px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: rgba(255,255,255,.60); }
.roulette-window.rolling #rouletteName { animation: jitter .09s infinite alternate; filter: blur(.35px); }
.draw-btn { position: relative; z-index: 2; min-height: 62px; padding: 0 32px; border: 0; border-radius: 18px; color: #5a3d00; font-family: "Baloo 2", sans-serif; font-size: 20px; font-weight: 900; letter-spacing: .02em; background: linear-gradient(145deg,#fff29a,#ffd33d 70%,#ffb700); box-shadow: 0 15px 34px rgba(255,199,0,.22); transition: .18s; }
.draw-icon { margin-right: 6px; }

footer { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 28px 0 0; color: #657084; font-size: 12px; }
footer img { width: 72px; height: 46px; object-fit: contain; }

dialog { border: 0; padding: 0; }
dialog::backdrop { background: rgba(5,18,43,.72); backdrop-filter: blur(7px); }
.winner-dialog { width: min(570px, calc(100% - 30px)); border-radius: 32px; color: white; text-align: center; overflow: hidden; background: linear-gradient(145deg,#0a3e8c,#0b5dc7); box-shadow: 0 40px 100px rgba(0,0,0,.34); }
.winner-dialog[open] { animation: pop .36s ease both; }
.winner-dialog > * { position: relative; z-index: 2; }
.winner-dialog { padding: 48px 32px 34px; }
.winner-rays { position: absolute !important; z-index: 0 !important; width: 600px; height: 600px; left: 50%; top: -340px; transform: translateX(-50%); border-radius: 50%; background: repeating-conic-gradient(from 0deg,rgba(255,211,61,.22) 0 8deg,transparent 8deg 18deg); animation: rotate 20s linear infinite; }
.winner-kicker { display: block; font-size: 12px; letter-spacing: .10em; font-weight: 900; color: #ffe465; }
.winner-avatar { width: 92px; height: 92px; margin: 20px auto 10px; display: grid; place-items: center; border-radius: 50%; color: #6c4800; font-family: "Baloo 2",sans-serif; font-size: 42px; font-weight: 900; background: linear-gradient(145deg,#fff6ae,#ffd33d); box-shadow: 0 0 0 10px rgba(255,255,255,.08), 0 14px 32px rgba(0,0,0,.22); }
.winner-dialog h2 { margin: 6px 0; font-family: "Baloo 2",sans-serif; font-size: 40px; }
.winner-dialog blockquote { margin: 12px auto 25px; max-width: 430px; color: rgba(255,255,255,.78); font-size: 14px; line-height: 1.55; }
.winner-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.close-dialog { position: absolute !important; z-index: 5 !important; right: 16px; top: 14px; width: 38px; height: 38px; border: 0; border-radius: 50%; color: white; background: rgba(255,255,255,.12); font-size: 27px; line-height: 1; }
.close-dialog.inline { position: static !important; color: var(--ink); background: #eef1f5; }

.participants-dialog { width: min(720px, calc(100% - 30px)); max-height: min(760px, calc(100vh - 40px)); padding: 28px; border-radius: 28px; background: #fffdf8; box-shadow: 0 40px 100px rgba(0,0,0,.28); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.dialog-head h2 { margin: 4px 0 0; font-family: "Baloo 2",sans-serif; font-size: 28px; }
.participants-list { max-height: 560px; overflow: auto; display: grid; gap: 9px; padding-right: 4px; }
.participant-row { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; padding: 11px 12px; border: 1px solid #ece8df; border-radius: 14px; background: white; }
.participant-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; font-weight: 900; background: linear-gradient(145deg,var(--orange),var(--blue)); }
.participant-row strong { display: block; font-size: 12px; }
.participant-row span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rotate { to { transform: translateX(-50%) rotate(360deg); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255,75,34,0); } }
@keyframes pop { from { transform: translateY(20px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes jitter { from { transform: translateY(-2px); } to { transform: translateY(2px); } }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 22px, 1120px); }
  .topbar { align-items: flex-start; }
  .brand img { width: 88px; height: 60px; }
  .brand div { display: none; }
  .live-pill { font-size: 10px; }
  .hero { grid-template-columns: 1fr; padding: 34px 24px 28px; }
  .sun-mark { display: none; }
  .hero h1 { font-size: 44px; }
  .card { padding: 22px 18px; border-radius: 24px; }
  .section-head { align-items: flex-start; }
  .section-head h2 { font-size: 27px; }
  .input-row { grid-template-columns: 1fr; }
  .primary-btn { min-height: 52px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card:last-child { grid-column: 1 / -1; }
  .rules-grid { grid-template-columns: 1fr; }
  .field-card.full { grid-column: auto; }
  .draw-stage { padding: 34px 15px 36px; }
  .draw-copy h2 { font-size: 34px; }
  .winner-actions { grid-template-columns: 1fr; }
  .winner-dialog { padding: 44px 20px 24px; }
  .participants-dialog { padding: 20px 15px; }
}
