* { box-sizing: border-box; }
:root {
  --bg: #080b12;
  --panel: rgba(18, 23, 34, .82);
  --line: rgba(255,255,255,.09);
  --text: #f8fafc;
  --muted: #8790a2;
  --accent: #8b5cf6;
  --accent2: #22d3ee;
}
html { min-height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); }
body { min-height: 100dvh; overflow-x: hidden; background: radial-gradient(circle at 15% 10%, rgba(139,92,246,.18), transparent 34%), radial-gradient(circle at 85% 80%, rgba(34,211,238,.12), transparent 30%), #080b12; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, #000, transparent 80%); }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.page-shell { width: min(1280px, calc(100% - 42px)); margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 0 max(44px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { color: #9ca3af; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 6px 0 0; font-size: clamp(26px, 4vw, 42px); letter-spacing: -.04em; }
.status { flex: 0 0 auto; border: 1px solid var(--line); background: rgba(255,255,255,.04); padding: 10px 14px; border-radius: 999px; color: #cbd5e1; font-size: 13px; }
.status span { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 16px #22c55e; }
.stage-card { border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025)); box-shadow: 0 30px 100px rgba(0,0,0,.35); padding: 26px; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.stage-header { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 22px; }
.stage-header h2 { margin: 2px 0 0; font-size: clamp(22px, 3vw, 31px); }
.muted { margin: 0; color: var(--muted); font-size: 13px; }
.counter { flex: 0 0 auto; color: #aeb7c7; font-size: 13px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; }
.participant-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.participant-card { position: relative; min-width: 0; min-height: 112px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid rgba(255,255,255,.075); border-radius: 18px; background: rgba(255,255,255,.035); transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.participant-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(255,255,255,.02), rgba(139,92,246,.04)); }
.participant-card .number { position: absolute; top: 10px; left: 12px; z-index: 2; color: #566071; font-size: 10px; font-weight: 800; }
.participant-card .dot { position: absolute; right: 12px; bottom: 11px; width: 5px; height: 5px; border-radius: 50%; background: #343b49; }
.blur-name { z-index: 2; max-width: calc(100% - 18px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 700; letter-spacing: .02em; color: #d3d8e3; filter: blur(5px); user-select: none; transform: scale(1.06); opacity: .7; }
.participant-card.active { transform: scale(1.035); border-color: rgba(139,92,246,.75); background: rgba(139,92,246,.14); box-shadow: 0 0 0 4px rgba(139,92,246,.08), 0 10px 35px rgba(139,92,246,.18); }
.participant-card.active .blur-name { filter: blur(3px); opacity: 1; }
.controls { display: flex; flex-direction: column; align-items: center; margin-top: 28px; }
.start-btn, .secondary-btn { border: 0; font: inherit; cursor: pointer; }
.start-btn { min-width: 230px; min-height: 52px; padding: 16px 24px; border-radius: 16px; color: white; font-weight: 800; font-size: 15px; background: linear-gradient(135deg, #7c3aed, #6d28d9 50%, #2563eb); box-shadow: 0 14px 38px rgba(124,58,237,.28); transition: transform .2s ease, box-shadow .2s ease; }
.start-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 45px rgba(124,58,237,.38); }
.start-btn:active { transform: scale(.985); }
.start-btn:disabled { cursor: default; opacity: .85; }
.play-icon { margin-right: 7px; }
.spinner { display: inline-block; width: 14px; height: 14px; margin-right: 8px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: white; vertical-align: -2px; animation: spin .65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { max-width: 520px; text-align: center; color: #6f7787; font-size: 12px; line-height: 1.6; margin: 12px 0 0; }
.winner-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); background: rgba(3,5,10,.88); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); opacity: 0; visibility: hidden; transition: .35s ease; overflow-y: auto; }
.winner-modal.show { opacity: 1; visibility: visible; }
.winner-content { position: relative; z-index: 4; width: min(780px, 100%); text-align: center; padding: 56px 42px 42px; border: 1px solid rgba(255,255,255,.13); border-radius: 34px; background: radial-gradient(circle at 50% 0, rgba(139,92,246,.27), transparent 44%), rgba(12,15,23,.86); box-shadow: 0 40px 140px rgba(0,0,0,.58); transform: scale(.9) translateY(14px); transition: .4s cubic-bezier(.2,.8,.2,1); }
.winner-modal.show .winner-content { transform: scale(1) translateY(0); }
.winner-badge { display: inline-flex; padding: 8px 13px; border-radius: 999px; background: rgba(139,92,246,.16); border: 1px solid rgba(139,92,246,.35); color: #c4b5fd; font-size: 11px; font-weight: 900; letter-spacing: .18em; }
.winner-kicker { margin: 24px 0 4px; color: #94a3b8; font-size: 15px; }
.winner-content h2 { margin: 0; overflow-wrap: anywhere; font-size: clamp(46px, 8vw, 92px); letter-spacing: -.06em; line-height: 1; background: linear-gradient(180deg, #fff, #b8c1d3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.winner-details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: min(520px, 100%); margin: 34px auto 0; }
.winner-details div { min-width: 0; padding: 16px; border-radius: 16px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.07); }
.winner-details span { display: block; color: #778195; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 5px; }
.winner-details strong { display: block; overflow-wrap: anywhere; font-size: 19px; }
.secondary-btn { min-height: 46px; margin-top: 28px; padding: 12px 20px; border-radius: 12px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: #d5dbe7; }
.confetti-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-layer i { position: absolute; top: -20px; width: 9px; height: 18px; border-radius: 2px; background: linear-gradient(180deg, #fbbf24, #f97316); animation: fall linear infinite; }
.confetti-layer i:nth-child(3n) { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.confetti-layer i:nth-child(3n+1) { background: linear-gradient(180deg, #67e8f9, #2563eb); }
@keyframes fall { to { transform: translateY(110dvh) rotate(700deg); } }
.modal-open { overflow: hidden; }

@media (max-width: 980px) {
  .participant-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .page-shell { width: calc(100% - 20px); padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: max(22px, env(safe-area-inset-bottom)); }
  .topbar { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 14px; }
  .eyebrow { font-size: 9px; letter-spacing: .14em; }
  h1 { margin-top: 4px; font-size: clamp(25px, 8vw, 34px); line-height: 1.05; }
  .status { padding: 8px 11px; font-size: 11px; }
  .stage-card { padding: 14px; border-radius: 20px; }
  .stage-header { align-items: flex-start; flex-direction: column; gap: 9px; margin-bottom: 14px; }
  .stage-header h2 { font-size: clamp(21px, 6vw, 27px); line-height: 1.08; }
  .counter { padding: 7px 10px; font-size: 11px; }
  .participant-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .participant-card { min-height: 74px; border-radius: 13px; }
  .participant-card .number { top: 7px; left: 8px; font-size: 8px; }
  .participant-card .dot { right: 8px; bottom: 8px; width: 4px; height: 4px; }
  .blur-name { max-width: calc(100% - 12px); font-size: 11px; filter: blur(4px); }
  .controls { margin-top: 18px; }
  .start-btn { width: 100%; min-width: 0; min-height: 54px; padding: 15px 18px; border-radius: 14px; font-size: 15px; }
  .start-btn:hover { transform: none; }
  .hint { margin-top: 10px; padding: 0 4px; font-size: 10px; line-height: 1.45; }
  .winner-modal { place-items: stretch; padding: 0; }
  .winner-content { align-self: stretch; width: 100%; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; border: 0; border-radius: 0; padding: max(44px, calc(env(safe-area-inset-top) + 26px)) 20px max(28px, calc(env(safe-area-inset-bottom) + 18px)); }
  .winner-badge { align-self: center; font-size: 9px; padding: 7px 11px; }
  .winner-kicker { margin: 20px 0 7px; font-size: 13px; }
  .winner-content h2 { font-size: clamp(44px, 15vw, 70px); line-height: .96; }
  .winner-details { grid-template-columns: 1fr; gap: 9px; margin-top: 28px; }
  .winner-details div { padding: 14px; border-radius: 14px; }
  .winner-details strong { font-size: 18px; }
  .secondary-btn { width: 100%; min-height: 50px; margin-top: 22px; }
}

@media (max-width: 380px) {
  .page-shell { width: calc(100% - 14px); }
  .stage-card { padding: 11px; }
  .participant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .participant-card { min-height: 68px; }
  .blur-name { font-size: 11px; }
}

@media (max-height: 700px) and (max-width: 640px) {
  .winner-content { justify-content: flex-start; overflow-y: auto; }
}

.participant-card.winner-card {
    position: relative;
    z-index: 10;

    transform: scale(1.12);

    border-color: #ffd95a;

    background:
        linear-gradient(
            135deg,
            rgba(255, 215, 70, 0.25),
            rgba(255, 170, 0, 0.10)
        );

    box-shadow:
        0 0 15px rgba(255, 215, 70, 0.9),
        0 0 35px rgba(255, 190, 40, 0.7),
        0 0 70px rgba(255, 170, 0, 0.4);

    animation: winnerGlow 0.75s ease-in-out infinite alternate;
}

/* Имя остаётся размытым */
.participant-card.winner-card .blur-name {
    filter: blur(7px) !important;
    opacity: 0.8;
}

/* Можно сделать номер чуть ярче */
.participant-card.winner-card .number {
    color: #ffe16b;
}

@keyframes winnerGlow {
    from {
        transform: scale(1.07);

        box-shadow:
            0 0 12px rgba(255, 215, 70, 0.65),
            0 0 28px rgba(255, 190, 40, 0.45);
    }

    to {
        transform: scale(1.13);

        box-shadow:
            0 0 22px rgba(255, 225, 100, 1),
            0 0 50px rgba(255, 190, 40, 0.8),
            0 0 85px rgba(255, 160, 0, 0.45);
    }
}
