﻿:root {
        --bg-a: #09131f;
        --bg-b: #0f2740;
        --bg-c: #16395e;
        --ink: #f4f7ff;
        --soft: #b9c8ec;
        --accent: #f4c95d;
        --accent-2: #ff6f59;
        --card: rgba(9, 25, 43, 0.9);
        --glass: rgba(255, 255, 255, 0.08);
        --line: rgba(255, 255, 255, 0.18);
        --good: #53e09b;
        --bad: #ff6b6b;
        --shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
      }

      * {
        box-sizing: border-box;
      }

      body {
        margin: 0;
        min-height: 100vh;
        color: var(--ink);
        font-family: "Space Grotesk", "Segoe UI", sans-serif;
        background:
          radial-gradient(
            1200px 700px at -10% -20%,
            #2b5d86 0%,
            transparent 60%
          ),
          radial-gradient(
            1200px 700px at 110% 120%,
            #2f4f74 0%,
            transparent 58%
          ),
          linear-gradient(150deg, var(--bg-a), var(--bg-b) 45%, var(--bg-c));
        overflow-x: hidden;
      }

      body::before,
      body::after {
        content: "";
        position: fixed;
        inset: auto;
        pointer-events: none;
        z-index: -1;
      }

      body::before {
        width: 46vmax;
        height: 46vmax;
        left: -18vmax;
        top: -15vmax;
        border-radius: 50%;
        background: radial-gradient(
          circle,
          rgba(244, 201, 93, 0.14),
          transparent 70%
        );
        animation: drift 18s ease-in-out infinite alternate;
      }

      body::after {
        width: 40vmax;
        height: 40vmax;
        right: -12vmax;
        bottom: -12vmax;
        border-radius: 50%;
        background: radial-gradient(
          circle,
          rgba(255, 111, 89, 0.16),
          transparent 70%
        );
        animation: drift 22s ease-in-out infinite alternate-reverse;
      }

      @keyframes drift {
        from {
          transform: translateY(0) scale(1);
        }
        to {
          transform: translateY(20px) scale(1.08);
        }
      }

      .wrap {
        width: min(1280px, 96vw);
        margin: 18px auto 28px;
        display: grid;
        gap: 16px;
      }

      .moderator-view {
        width: min(1440px, 96vw);
        margin: 18px auto 28px;
        display: none;
        gap: 16px;
      }

      body[data-view="moderator"] .wrap {
        display: none;
      }

      body[data-view="moderator"] .moderator-view {
        display: grid;
      }

      .hero {
        border: 1px solid var(--line);
        border-radius: 24px;
        padding: 18px 20px;
        background: linear-gradient(
          145deg,
          rgba(255, 255, 255, 0.12),
          rgba(255, 255, 255, 0.04)
        );
        backdrop-filter: blur(8px);
        box-shadow: var(--shadow);
        display: grid;
        gap: 12px;
        align-items: center;
      }

      .topline {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
      }

      h1 {
        margin: 0;
        font-family: "Abril Fatface", Georgia, serif;
        letter-spacing: 0.5px;
        font-size: clamp(2rem, 4vw, 3.4rem);
        font-weight: 400;
        line-height: 1;
        color: #fff8dd;
        text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
      }

      .subtitle {
        margin: 0;
        color: var(--soft);
        font-size: clamp(0.9rem, 1.5vw, 1.05rem);
      }

      .actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
      }

      .actions .accent {
        background: linear-gradient(160deg, #8b5cf6, #5f46d6);
      }

      button,
      .btn {
        border: 1px solid transparent;
        border-radius: 12px;
        padding: 10px 14px;
        color: #fff;
        font: inherit;
        font-weight: 700;
        background: linear-gradient(160deg, #2a567f, #1f3f66);
        cursor: pointer;
        transition:
          transform 0.15s ease,
          filter 0.15s ease,
          border-color 0.2s ease;
      }

      button:hover,
      .btn:hover {
        transform: translateY(-1px);
        filter: brightness(1.1);
        border-color: rgba(255, 255, 255, 0.3);
      }

      button:active,
      .btn:active {
        transform: translateY(1px);
      }

      .btn-muted {
        background: rgba(255, 255, 255, 0.1);
        border-color: var(--line);
      }

      .board {
        border: 1px solid var(--line);
        border-radius: 20px;
        padding: 12px;
        background: var(--card);
        box-shadow: var(--shadow);
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 10px;
      }

      .cat {
        background: linear-gradient(
          180deg,
          rgba(255, 255, 255, 0.13),
          rgba(255, 255, 255, 0.03)
        );
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 14px;
        min-height: 86px;
        padding: 10px;
        text-align: center;
        text-transform: uppercase;
        font-weight: 700;
        font-size: 0.88rem;
        display: grid;
        place-items: center;
        color: #fff3c6;
        letter-spacing: 0.4px;
      }

      .clue {
        border: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 12px;
        min-height: 84px;
        background:
          linear-gradient(180deg, rgba(255, 255, 255, 0.15), transparent 45%),
          linear-gradient(160deg, #1b4c78, #173f66 65%, #143653);
        display: grid;
        place-items: center;
        font-size: clamp(1.35rem, 2.2vw, 2rem);
        font-weight: 700;
        color: var(--accent);
        text-shadow: 0 0 14px rgba(244, 201, 93, 0.35);
        box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.25);
      }

      .clue.used {
        background: rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.4);
        text-shadow: none;
        cursor: not-allowed;
        filter: saturate(0.4);
      }

      .score-wrap {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
      }

      .moderator-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.85fr);
        gap: 16px;
      }

      .stage-card,
      .moderator-scores {
        border: 1px solid var(--line);
        border-radius: 20px;
        background: var(--card);
        box-shadow: var(--shadow);
      }

      .stage-card {
        padding: 16px;
        display: grid;
        gap: 14px;
        align-content: start;
        min-height: calc(100vh - 86px);
      }

      .moderator-hero {
        padding: 18px 20px;
      }

      .stage-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
      }

      .status-badge {
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        padding: 6px 10px;
        background: rgba(255, 255, 255, 0.08);
        color: #d7e9ff;
        font-weight: 700;
      }

      .question-empty {
        min-height: 220px;
        display: grid;
        place-items: center;
        border-radius: 16px;
        border: 1px dashed rgba(255, 255, 255, 0.24);
        color: #d3defd;
        text-align: center;
        padding: 18px;
      }

      .question-empty[hidden] {
        display: none;
      }

      .moderator-question-card {
        display: grid;
        gap: 12px;
      }

      .moderator-answer {
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, 0.24);
        background: rgba(0, 0, 0, 0.22);
        padding: 14px;
        white-space: pre-wrap;
      }

      .moderator-answer.hidden {
        opacity: 0.72;
      }

      .moderator-scores {
        padding: 14px;
        display: grid;
        gap: 12px;
        align-content: start;
      }

      .moderator-score {
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 16px;
        padding: 12px;
        background: linear-gradient(
          160deg,
          rgba(255, 255, 255, 0.12),
          rgba(255, 255, 255, 0.04)
        );
        display: grid;
        gap: 8px;
      }

      .moderator-score .team-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }

      .moderator-score .team-display {
        font-weight: 700;
        font-size: 1.05rem;
        color: #ffffff;
      }

      .moderator-score .team-score {
        font-size: 1.45rem;
      }

      .moderator-score .team-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }

      .moderator-score .team-controls button,
      .moderator-controls button {
        flex: 1 1 auto;
      }

      .moderator-controls {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
      }

      .moderator-controls button {
        background: linear-gradient(160deg, #2a567f, #1f3f66);
      }

      .moderator-note {
        color: var(--soft);
        font-size: 0.95rem;
      }

      .team {
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 10px;
        background: linear-gradient(
          160deg,
          rgba(255, 255, 255, 0.12),
          rgba(255, 255, 255, 0.04)
        );
        display: grid;
        gap: 8px;
        box-shadow: var(--shadow);
      }

      .team-head {
        display: flex;
        gap: 8px;
        align-items: center;
      }

      .team-name {
        flex: 1;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.25);
        padding: 6px 8px;
        font: inherit;
        font-weight: 700;
        color: white;
        background: rgba(0, 0, 0, 0.22);
        min-width: 0;
      }

      .team-score {
        font-size: clamp(1.2rem, 2vw, 1.8rem);
        font-weight: 700;
        color: #fffde5;
        text-shadow: 0 0 12px rgba(244, 201, 93, 0.28);
      }

      .team-controls {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
      }

      .btn-plus {
        background: linear-gradient(160deg, #1f7d51, #196641);
      }
      .btn-minus {
        background: linear-gradient(160deg, #a53535, #802929);
      }

      .modal {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.72);
        backdrop-filter: blur(4px);
        display: none;
        align-items: center;
        justify-content: center;
        padding: 18px;
        z-index: 20;
      }

      .modal.show {
        display: flex;
      }

      .panel {
        width: min(960px, 95vw);
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.28);
        background:
          linear-gradient(
            130deg,
            rgba(255, 255, 255, 0.11),
            rgba(255, 255, 255, 0.04)
          ),
          linear-gradient(160deg, #183d62, #112942);
        box-shadow: var(--shadow);
        padding: 18px;
        display: grid;
        gap: 14px;
        animation: rise 0.28s ease;
      }

      @keyframes rise {
        from {
          transform: translateY(20px) scale(0.98);
          opacity: 0;
        }
        to {
          transform: translateY(0) scale(1);
          opacity: 1;
        }
      }

      .panel h2 {
        margin: 0;
        font-family: "Abril Fatface", Georgia, serif;
        font-weight: 400;
        font-size: clamp(1.4rem, 2.8vw, 2rem);
        color: #fff5d0;
      }

      .meta {
        color: var(--soft);
        font-weight: 700;
      }

      .question {
        margin: 0;
        font-size: clamp(1.1rem, 2.4vw, 1.8rem);
        line-height: 1.35;
        color: #f8fcff;
        white-space: pre-wrap;
      }

      .answer {
        border-radius: 12px;
        border: 1px dashed rgba(255, 255, 255, 0.4);
        background: rgba(0, 0, 0, 0.22);
        padding: 12px;
        color: #d9f6ff;
        display: none;
        white-space: pre-wrap;
      }

      .answer.show {
        display: block;
      }

      .source {
        color: #d8e7ff;
        opacity: 0.86;
        font-size: 0.95rem;
      }

      #modalSource {
        display: none;
      }

      .player-scores {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
      }

      .player-score {
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 10px;
        background: linear-gradient(
          160deg,
          rgba(255, 255, 255, 0.12),
          rgba(255, 255, 255, 0.04)
        );
        display: grid;
        gap: 8px;
        box-shadow: var(--shadow);
      }

      .player-score-name {
        font-weight: 700;
        color: #ffffff;
        font-size: 1.05rem;
      }

      .award-row,
      .panel-controls {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
      }

      .award-row button {
        background: linear-gradient(160deg, #2f6d97, #265b7e);
      }

      .chip {
        border: 1px solid var(--line);
        border-radius: 999px;
        padding: 6px 10px;
        font-weight: 700;
        background: rgba(255, 255, 255, 0.08);
      }

      .flash {
        animation: flash 0.32s ease;
      }

      @keyframes flash {
        0% {
          transform: scale(1);
        }
        50% {
          transform: scale(1.04);
        }
        100% {
          transform: scale(1);
        }
      }

      .particles {
        position: fixed;
        inset: 0;
        pointer-events: none;
        overflow: hidden;
        z-index: 30;
      }

      .dot {
        position: absolute;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        animation: burst 760ms ease-out forwards;
      }

      @keyframes burst {
        from {
          opacity: 1;
          transform: translate(0, 0) scale(1);
        }
        to {
          opacity: 0;
          transform: translate(var(--x), var(--y)) scale(0.2);
        }
      }

      @media (max-width: 1020px) {
        .board {
          grid-template-columns: repeat(3, minmax(0, 1fr));
        }
        .score-wrap {
          grid-template-columns: 1fr;
        }
        .player-scores {
          grid-template-columns: 1fr;
        }
        .moderator-grid {
          grid-template-columns: 1fr;
        }
        .stage-card {
          min-height: auto;
        }
      }

      @media (max-width: 620px) {
        .board {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        .cat,
        .clue {
          min-height: 76px;
        }
        .clue {
          font-size: 1.45rem;
        }
      }
