    :root {
      --bg: #070a16;
      --bg-2: #12182c;
      --card: rgba(22, 28, 52, 0.72);
      --stroke: rgba(255, 255, 255, 0.12);
      --text: #f4f7ff;
      --muted: #9aa3c2;
      --pink: #ff4d8d;
      --lime: #b6ff4d;
      --gold: #ffd24d;
      --cyan: #5ce1ff;
      --violet: #9b7dff;
      --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    }

    * { box-sizing: border-box; }
    html, body { margin: 0; min-height: 100%; }
    body {
      font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
      color: var(--text);
      background:
        radial-gradient(1200px 700px at 12% -10%, rgba(255, 77, 141, 0.28), transparent 55%),
        radial-gradient(900px 600px at 110% 10%, rgba(92, 225, 255, 0.2), transparent 50%),
        radial-gradient(800px 500px at 50% 110%, rgba(182, 255, 77, 0.12), transparent 50%),
        var(--bg);
      overflow-x: hidden;
    }

    body::before {
      content: "";
      position: fixed;
      inset: 0;
      pointer-events: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
      opacity: 0.35;
      z-index: 0;
    }

    .wrap {
      position: relative;
      z-index: 1;
      max-width: 1100px;
      margin: 0 auto;
      padding: 32px 20px 80px;
    }

    header {
      text-align: center;
      margin-bottom: 28px;
    }

    .kicker {
      display: inline-block;
      letter-spacing: 0.28em;
      text-transform: uppercase;
      font-size: 12px;
      color: var(--gold);
      margin-bottom: 8px;
    }

    h1 {
      margin: 0;
      font-size: clamp(42px, 8vw, 76px);
      line-height: 0.9;
      letter-spacing: -0.04em;
      text-transform: uppercase;
      background: linear-gradient(180deg, #fff 20%, #ffd24d 70%, #ff4d8d 140%);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      filter: drop-shadow(0 8px 0 rgba(255, 77, 141, 0.18));
    }

    .sub {
      margin: 12px auto 0;
      max-width: 520px;
      color: var(--muted);
      font-size: 16px;
    }

    .panel {
      background: var(--card);
      border: 1px solid var(--stroke);
      border-radius: 28px;
      padding: 22px;
      backdrop-filter: blur(16px);
      box-shadow: var(--shadow);
      margin-bottom: 18px;
    }

    .panel-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 16px;
    }

    h2 {
      margin: 0;
      font-size: 20px;
    }

    .count {
      color: var(--cyan);
      font-weight: 700;
    }

    .hint {
      color: var(--muted);
      font-size: 13px;
      margin: 0;
    }

    .students {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
      gap: 10px;
    }

    .student {
      appearance: none;
      border: 2px solid transparent;
      background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
      color: var(--text);
      border-radius: 999px;
      padding: 12px 14px;
      font: inherit;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 8px;
      transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
    }

    .student:hover { transform: translateY(-2px); }
    .student:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

    .dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex: 0 0 auto;
      box-shadow: 0 0 10px currentColor;
    }

    .student.here {
      border-color: color-mix(in srgb, var(--accent, var(--lime)) 70%, white 0%);
      background: color-mix(in srgb, var(--accent, var(--lime)) 18%, transparent);
    }

    .student.away {
      opacity: 0.42;
      border-color: rgba(255,255,255,0.08);
      text-decoration: line-through;
      text-decoration-thickness: 2px;
    }

    .add-row {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 14px;
    }

    .add-row input {
      flex: 1 1 180px;
      min-width: 0;
      appearance: none;
      border: 1px solid var(--stroke);
      background: rgba(0,0,0,0.28);
      color: var(--text);
      border-radius: 999px;
      padding: 12px 16px;
      font: inherit;
      font-weight: 700;
    }

    .add-row input:focus {
      outline: 2px solid var(--cyan);
      outline-offset: 2px;
    }

    .add-row button {
      appearance: none;
      border: 0;
      cursor: pointer;
      font: inherit;
      font-weight: 800;
      color: #101218;
      background: var(--cyan);
      padding: 12px 18px;
      border-radius: 999px;
    }

    .add-row button:hover { filter: brightness(1.08); }

    .roster-msg {
      display: none;
      margin: 10px 0 0;
      color: #ff8fab;
      font-weight: 700;
      font-size: 13px;
    }

    .controls {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }

    .size-control {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .stepper {
      display: flex;
      align-items: center;
      background: rgba(0,0,0,0.25);
      border: 1px solid var(--stroke);
      border-radius: 999px;
      overflow: hidden;
    }

    .stepper button {
      appearance: none;
      border: 0;
      background: transparent;
      color: var(--text);
      width: 44px;
      height: 44px;
      font-size: 22px;
      cursor: pointer;
    }

    .stepper button:hover { background: rgba(255,255,255,0.06); }

    #minSize {
      width: 48px;
      text-align: center;
      font-size: 22px;
      font-weight: 800;
      color: var(--gold);
    }

    .go {
      appearance: none;
      border: 0;
      cursor: pointer;
      font: inherit;
      font-size: 22px;
      font-weight: 800;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: #101218;
      background: linear-gradient(180deg, #ffe36a, #ffb347 55%, #ff4d8d);
      padding: 16px 28px;
      border-radius: 18px;
      box-shadow:
        0 0 0 4px rgba(255, 210, 77, 0.15),
        0 12px 0 #9a1d4d,
        0 22px 40px rgba(255, 77, 141, 0.35);
      transition: transform 0.12s ease;
    }

    .go:hover { transform: translateY(-2px); }
    .go:active { transform: translateY(6px); box-shadow: 0 0 0 4px rgba(255, 210, 77, 0.15), 0 6px 0 #9a1d4d; }
    .go:disabled {
      cursor: not-allowed;
      opacity: 0.45;
      transform: none;
      box-shadow: none;
    }

    .error {
      display: none;
      margin-top: 12px;
      color: #ff8fab;
      font-weight: 700;
    }

    .results {
      min-height: 120px;
    }

    .teams {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 14px;
    }

    .team {
      border-radius: 24px;
      padding: 16px;
      background: rgba(8, 10, 22, 0.65);
      border: 1px solid var(--stroke);
      transform: translateY(18px);
      opacity: 0;
      animation: popIn 0.45s cubic-bezier(.2,1.4,.3,1) forwards;
    }

    .team h3 {
      margin: 0 0 12px;
      font-size: 13px;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--team, var(--cyan));
    }

    .member {
      background: rgba(255,255,255,0.06);
      border-radius: 14px;
      padding: 10px 12px;
      margin-bottom: 8px;
      font-weight: 800;
      display: flex;
      align-items: center;
      gap: 8px;
      transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .member.waiting {
      color: transparent;
      background: rgba(255,255,255,0.03);
    }

    .member.waiting .dot { opacity: 0; }

    .member:last-child { margin-bottom: 0; }

    .arena {
      position: fixed;
      inset: 0;
      z-index: 20;
      display: none;
      pointer-events: none;
    }

    .arena.active { display: block; }

    .arena-chip {
      position: absolute;
      padding: 11px 18px;
      border-radius: 999px;
      font-weight: 800;
      white-space: nowrap;
      border: 2px solid rgba(255,255,255,0.45);
      box-shadow: 0 10px 30px rgba(0,0,0,0.35), 0 0 22px rgba(255,255,255,0.25);
      will-change: transform, left, top;
    }

    .flash {
      position: fixed;
      inset: 0;
      z-index: 19;
      display: none;
      background:
        radial-gradient(circle at 50% 48%, rgba(255,210,77,0.16), transparent 36%),
        rgba(7, 10, 22, 0.86);
      pointer-events: none;
      overflow: hidden;
    }

    .flash.active { display: block; pointer-events: auto; }
    .flash.lock { animation: whiteFlash 0.35s ease; }
    .flash.reveal {
      background: rgba(7, 10, 22, 0.28);
    }
    .flash.reveal .vortex,
    .flash.reveal .flash-copy {
      opacity: 0;
      transition: opacity 0.25s ease;
    }

    .vortex {
      position: absolute;
      left: 50%;
      top: 46%;
      width: min(520px, 78vw);
      height: min(520px, 78vw);
      transform: translate(-50%, -50%);
      border-radius: 50%;
      background: conic-gradient(from 0deg, #ff4d8d, #ffd24d, #5ce1ff, #b6ff4d, #9b7dff, #ff4d8d);
      filter: blur(0.4px);
      opacity: 0.55;
      animation: spin 0.7s linear infinite;
      -webkit-mask: radial-gradient(circle, transparent 58%, #000 59%, #000 68%, transparent 70%);
      mask: radial-gradient(circle, transparent 58%, #000 59%, #000 68%, transparent 70%);
    }

    .flash-copy {
      position: absolute;
      left: 0;
      right: 0;
      top: 7vh;
      text-align: center;
      font-size: clamp(28px, 6vw, 64px);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      animation: pulse 0.35s ease-in-out infinite alternate;
    }

    #confetti {
      position: fixed;
      inset: 0;
      z-index: 30;
      pointer-events: none;
    }

    @keyframes popIn {
      to { opacity: 1; transform: none; }
    }

    @keyframes pulse {
      from { transform: scale(1); filter: drop-shadow(0 0 12px rgba(255,210,77,.4)); }
      to { transform: scale(1.06); filter: drop-shadow(0 0 28px rgba(255,77,141,.6)); }
    }

    @keyframes spin {
      to { transform: translate(-50%, -50%) rotate(360deg); }
    }

    @keyframes whiteFlash {
      0% { background: #fff; }
      100% {
        background:
          radial-gradient(circle at 50% 48%, rgba(255,210,77,0.16), transparent 36%),
          rgba(7, 10, 22, 0.86);
      }
    }

    @media (max-width: 640px) {
      .controls { align-items: stretch; flex-direction: column; }
      .go { width: 100%; }
    }
