    @font-face {
      font-family: 'NRT';
      src: url('https://db.onlinewebfonts.com/t/dc9a8bb1a3a65504c8d90566a26d5327.woff2') format('woff2'),
        url('https://db.onlinewebfonts.com/t/dc9a8bb1a3a65504c8d90566a26d5327.woff') format('woff'),
        url('https://db.onlinewebfonts.com/t/dc9a8bb1a3a65504c8d90566a26d5327.ttf') format('truetype');
      font-weight: 400 700;
      font-style: normal;
    }


    /* ===== CSS VARIABLES ===== */
    :root {
      --bg: #0d0d0d;
      --surface: #1a1a1a;
      --surface2: #242424;
      --border: #333;
      --red: #e63946;
      --red-dark: #c1121f;
      --gold: #ffd60a;
      --blue: #4361ee;
      --green: #2dc653;
      --text: #f0f0f0;
      --text-muted: #888;
      --radius: 14px;
      --font: 'NRT', 'Reem Kufi', sans-serif;
      --font-header: 'Reem Kufi', sans-serif;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: var(--font);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      direction: rtl;
    }

    /* ===== SCREENS ===== */
    .screen {
      display: none;
      flex-direction: column;
      align-items: center;
      width: 100%;
      max-width: 480px;
      min-height: 100vh;
      padding: 24px 20px;
      gap: 16px;
    }

    .screen.active {
      display: flex;
      padding-bottom: 70px;
      animation: screenIn 0.35s ease both;
    }

    @keyframes screenIn {
      from {
        opacity: 0;
        transform: translateY(14px)
      }

      to {
        opacity: 1;
        transform: translateY(0)
      }
    }

    /* ── Main menu: bounces up ── */
    #screen-main.active {
      animation: mainIn 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
    }

    @keyframes mainIn {
      from {
        opacity: 0;
        transform: translateY(28px) scale(0.97)
      }

      70% {
        transform: translateY(-3px) scale(1.01)
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1)
      }
    }

    /* ── Waiting room: slide up ── */
    #screen-waiting.active {
      animation: waitingIn 0.4s ease both;
    }

    @keyframes waitingIn {
      from {
        opacity: 0;
        transform: translateY(22px)
      }

      to {
        opacity: 1;
        transform: translateY(0)
      }
    }

    /* ── Role reveal: lights out → spotlight on ── */
    #screen-role.active {
      animation: roleIn 0.85s ease both;
    }

    @keyframes roleIn {
      0% {
        opacity: 0;
        filter: brightness(0)
      }

      35% {
        opacity: 0.5;
        filter: brightness(0.08)
      }

      65% {
        filter: brightness(1.25)
      }

      100% {
        opacity: 1;
        filter: brightness(1)
      }
    }

    /* ── Discussion: dawn brightness flash ── */
    #screen-discussion.active {
      animation: dayIn 0.7s ease both;
    }

    @keyframes dayIn {
      0% {
        opacity: 0;
        filter: brightness(0.12)
      }

      50% {
        filter: brightness(1.45)
      }

      100% {
        opacity: 1;
        filter: brightness(1)
      }
    }

    /* ── Vote: snaps in with bounce ── */
    #screen-vote.active {
      animation: voteIn 0.45s cubic-bezier(0.2, 0.8, 0.3, 1.2) both;
    }

    @keyframes voteIn {
      from {
        opacity: 0;
        transform: scale(0.91)
      }

      70% {
        transform: scale(1.04)
      }

      to {
        opacity: 1;
        transform: scale(1)
      }
    }

    /* ── Vote result: zooms in from center ── */
    #screen-vote-result.active {
      animation: voteResultIn 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
    }

    @keyframes voteResultIn {
      from {
        opacity: 0;
        transform: scale(0.72)
      }

      70% {
        transform: scale(1.05)
      }

      to {
        opacity: 1;
        transform: scale(1)
      }
    }

    /* ── Game over: big bounce (win class = celebration, lose class = shake) ── */
    #screen-gameover.active {
      animation: gameOverIn 0.7s cubic-bezier(0.2, 0.8, 0.3, 1.3) both;
    }

    #screen-gameover.go-lose.active {
      animation: gameOverLose 0.65s ease both;
    }

    @keyframes gameOverIn {
      from {
        opacity: 0;
        transform: scale(0.5) translateY(30px)
      }

      65% {
        transform: scale(1.07) translateY(-5px)
      }

      to {
        opacity: 1;
        transform: scale(1) translateY(0)
      }
    }

    @keyframes gameOverLose {
      0% {
        opacity: 0;
        filter: brightness(3)
      }

      15% {
        opacity: 1;
        filter: brightness(1)
      }

      25% {
        transform: translateX(-10px)
      }

      40% {
        transform: translateX(10px)
      }

      55% {
        transform: translateX(-6px)
      }

      70% {
        transform: translateX(6px)
      }

      85% {
        transform: translateX(-2px)
      }

      100% {
        opacity: 1;
        transform: translateX(0)
      }
    }

    /* ===== HEADER / LOGO ===== */
    .logo {
      font-size: 42px;
      font-weight: 800;
      font-family: var(--font-header);
      color: var(--gold);
      text-shadow: 0 0 20px rgba(255, 214, 10, 0.4);
      letter-spacing: 2px;
      text-align: center;
      margin-bottom: 4px;
    }

    .logo-sub {
      font-size: 12px;
      color: var(--text-muted);
      text-align: center;
      letter-spacing: 1px;
      margin-bottom: 20px;
    }

    /* ===== CARDS ===== */
    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 20px;
      width: 100%;
    }

    .card-title {
      font-size: 16px;
      font-weight: 700;
      color: var(--gold);
      margin-bottom: 14px;
      text-align: center;
    }

    /* ===== INPUTS ===== */
    input[type="text"],
    input[type="number"] {
      width: 100%;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-family: var(--font);
      font-size: 16px;
      padding: 14px 16px;
      outline: none;
      text-align: center;
      direction: rtl;
    }

    input:focus {
      border-color: var(--gold);
    }

    input::placeholder {
      color: var(--text-muted);
    }

    /* ===== BUTTONS ===== */
    .btn {
      width: 100%;
      padding: 16px;
      border: none;
      border-radius: var(--radius);
      font-family: var(--font);
      font-size: 17px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.18s ease;
      letter-spacing: 1px;
      position: relative;
      overflow: hidden;
    }

    .btn:active {
      transform: scale(0.97);
    }

    .btn-gold {
      background: var(--gold);
      color: #0d0d0d;
      box-shadow: 0 4px 15px rgba(255, 214, 10, 0.25);
    }

    .btn-gold:hover:not(:disabled) {
      background: #ffe033;
      box-shadow: 0 6px 22px rgba(255, 214, 10, 0.45);
      transform: translateY(-1px);
    }

    .btn-red {
      background: var(--red);
      color: white;
      box-shadow: 0 4px 15px rgba(230, 57, 70, 0.25);
    }

    .btn-red:hover:not(:disabled) {
      background: #f04452;
      box-shadow: 0 6px 22px rgba(230, 57, 70, 0.45);
      transform: translateY(-1px);
    }

    .btn-outline {
      background: transparent;
      border: 1.5px solid var(--border);
      color: var(--text);
    }

    .btn-outline:hover:not(:disabled) {
      border-color: var(--text-muted);
      background: rgba(255, 255, 255, 0.04);
      transform: translateY(-1px);
    }

    .btn-blue {
      background: var(--blue);
      color: white;
      box-shadow: 0 4px 15px rgba(67, 97, 238, 0.25);
    }

    .btn-blue:hover:not(:disabled) {
      background: #5572f5;
      box-shadow: 0 6px 22px rgba(67, 97, 238, 0.45);
      transform: translateY(-1px);
    }

    .btn-green {
      background: var(--green);
      color: #0d0d0d;
      box-shadow: 0 4px 15px rgba(45, 198, 83, 0.25);
    }

    .btn-green:hover:not(:disabled) {
      background: #3de068;
      box-shadow: 0 6px 22px rgba(45, 198, 83, 0.45);
      transform: translateY(-1px);
    }

    .btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    /* ===== PLAYER COUNT ===== */
    .count-row {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 20px;
      margin: 8px 0;
    }

    .count-btn {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      border: 1.5px solid var(--border);
      background: var(--surface2);
      color: var(--text);
      font-size: 22px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .count-num {
      font-size: 32px;
      font-weight: 800;
      color: var(--gold);
      min-width: 50px;
      text-align: center;
    }

    /* ===== ROLE TOGGLES ===== */
    .roles-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .role-toggle {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--surface2);
      border: 1.5px solid var(--border);
      border-radius: 10px;
      padding: 12px 14px;
      cursor: pointer;
      transition: border-color 0.15s, background 0.15s, transform 0.12s;
    }

    .role-toggle:hover {
      background: rgba(255, 255, 255, 0.04);
      transform: translateY(-1px);
    }

    .role-toggle.on {
      border-color: var(--gold);
      background: rgba(255, 214, 10, 0.06);
    }

    .role-toggle .role-name {
      font-size: 14px;
      font-weight: 600;
    }

    .role-toggle .role-emoji {
      font-size: 20px;
    }

    .role-toggle .role-dot {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: var(--border);
      transition: background 0.15s;
    }

    .role-toggle.on .role-dot {
      background: var(--gold);
    }

    /* ===== WAITING ROOM SLOTS ===== */
    .slots {
      display: flex;
      flex-direction: column;
      gap: 8px;
      width: 100%;
    }

    .slot {
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 16px;
    }

    .slot.filled {
      border-color: var(--green);
    }

    .slot-num {
      font-size: 14px;
      color: var(--text-muted);
      min-width: 24px;
    }

    .slot-name {
      font-size: 15px;
      font-weight: 600;
    }

    .slot-badge {
      margin-right: auto;
      font-size: 11px;
      background: var(--gold);
      color: #0d0d0d;
      border-radius: 6px;
      padding: 2px 8px;
      font-weight: 700;
    }

    /* ===== GAME CODE BOX ===== */
    .code-box {
      background: var(--surface2);
      border: 2px dashed var(--gold);
      border-radius: var(--radius);
      padding: 18px;
      text-align: center;
      width: 100%;
      cursor: pointer;
      transition: transform 0.15s, box-shadow 0.15s;
      animation: codePulse 2.5s ease-in-out infinite;
    }

    .code-box:hover {
      transform: scale(1.02);
      box-shadow: 0 0 24px rgba(255, 214, 10, 0.2);
    }

    @keyframes codePulse {

      0%,
      100% {
        box-shadow: 0 0 0px rgba(255, 214, 10, 0);
      }

      50% {
        box-shadow: 0 0 18px rgba(255, 214, 10, 0.35);
      }
    }

    .code-label {
      font-size: 12px;
      color: var(--text-muted);
      margin-bottom: 6px;
    }

    .code-value {
      font-size: 34px;
      font-weight: 800;
      color: var(--gold);
      letter-spacing: 6px;
    }

    .code-hint {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 6px;
    }

    /* ===== ROLE REVEAL ===== */
    .role-card {
      width: 100%;
      border-radius: 20px;
      padding: 40px 24px;
      text-align: center;
      position: relative;
      overflow: hidden;
      border: 2px solid transparent;
    }

    /* role-card + role-guide-card share the same gradient/border per role */
    .role-card.mafia,
    .role-guide-card.mafia {
      background: linear-gradient(135deg, #2d0000, #6b0f1a);
      border-color: #e63946;
    }

    .role-card.civilian,
    .role-guide-card.civilian {
      background: linear-gradient(135deg, #0a1628, #1a3a5c);
      border-color: #4361ee;
    }

    .role-card.doctor,
    .role-guide-card.doctor {
      background: linear-gradient(135deg, #0a2818, #1a5c3a);
      border-color: #2dc653;
    }

    .role-card.detective,
    .role-guide-card.detective {
      background: linear-gradient(135deg, #1a1a2e, #16213e);
      border-color: #7b2d8b;
    }

    .role-card.fool,
    .role-guide-card.fool {
      background: linear-gradient(135deg, #1a0a2e, #2d1a5c);
      border-color: #9b5de5;
    }

    .role-card.sniper,
    .role-guide-card.sniper {
      background: linear-gradient(135deg, #1a1200, #3d2e00);
      border-color: #ffd60a;
    }

    .role-card.hakim,
    .role-guide-card.hakim {
      background: linear-gradient(135deg, #1a0d00, #3d2000);
      border-color: #ff8c00;
    }

    .role-card.layla,
    .role-guide-card.layla {
      background: linear-gradient(135deg, #1a0028, #3d0060);
      border-color: #9b59b6;
    }

    .role-card.coroner,
    .role-guide-card.coroner {
      background: linear-gradient(135deg, #001a0d, #003320);
      border-color: #00ff88;
    }

    .role-card.mele,
    .role-guide-card.mele,
    .role-card.mela,
    .role-guide-card.mela {
      background: linear-gradient(135deg, #001428, #002a50);
      border-color: #00bfff;
    }

    .role-card.mole,
    .role-guide-card.mole {
      background: linear-gradient(135deg, #0a0a0a, #1a1a0a);
      border-color: #888800;
    }

    .role-card.blackmailer,
    .role-guide-card.blackmailer {
      background: linear-gradient(135deg, #0a001a, #1a0033);
      border-color: #9900cc;
    }

    .role-card.bodyguard,
    .role-guide-card.bodyguard {
      background: linear-gradient(135deg, #001428, #002060);
      border-color: #4895ef;
    }

    .role-card.hitman,
    .role-guide-card.hitman {
      background: linear-gradient(135deg, #0a0000, #1a0000);
      border-color: #cc0000;
    }

    .role-card.towzher,
    .role-guide-card.towzher {
      background: linear-gradient(135deg, #001a1a, #003d3d);
      border-color: #00d4d4;
    }

    .role-emoji-big {
      font-size: 64px;
      margin-bottom: 12px;
    }

    .role-title {
      font-size: 28px;
      font-weight: 800;
      font-family: var(--font-header);
      margin-bottom: 8px;
    }

    .role-desc {
      font-size: 14px;
      color: rgba(255, 255, 255, 0.7);
      line-height: 1.7;
    }

    /* ===== NIGHT PHASE ===== */
    .night-overlay {
      background: linear-gradient(180deg, #000 0%, #0a0a1a 100%);
      border-radius: var(--radius);
      padding: 24px;
      width: 100%;
      text-align: center;
    }

    .night-title {
      font-size: 22px;
      font-weight: 800;
      font-family: var(--font-header);
      color: #a0a0ff;
      margin-bottom: 6px;
    }

    .night-sub {
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 20px;
    }

    /* ===== PLAYER LIST (selectable) ===== */
    .player-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      width: 100%;
    }

    .player-item {
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--surface2);
      border: 1.5px solid var(--border);
      border-radius: 10px;
      padding: 13px 16px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .player-item:hover:not(.dead):not(.self) {
      background: rgba(255, 255, 255, 0.04);
      border-color: #555;
      transform: translateY(-1px);
    }

    .player-item:active {
      transform: scale(0.98);
    }

    .player-item.selected {
      border-color: var(--gold);
      background: rgba(255, 214, 10, 0.08);
      box-shadow: 0 0 12px rgba(255, 214, 10, 0.15);
    }

    .player-item.dead {
      opacity: 0.35;
      pointer-events: none;
      text-decoration: line-through;
    }

    .player-item.self {
      opacity: 0.5;
      pointer-events: none;
    }

    .player-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: var(--surface);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      border: 1px solid var(--border);
      flex-shrink: 0;
    }

    .player-name {
      font-size: 15px;
      font-weight: 600;
    }

    .player-status {
      font-size: 12px;
      color: var(--text-muted);
      margin-right: auto;
    }

    /* ===== DISCUSSION / VOTE ===== */
    .vote-header {
      font-size: 20px;
      font-weight: 800;
      color: var(--red);
      text-align: center;
      margin-bottom: 4px;
    }

    .vote-sub {
      font-size: 13px;
      color: var(--text-muted);
      text-align: center;
      margin-bottom: 16px;
    }

    /* ===== VOTE TIMER ===== */
    #vote-timer-wrap {
      text-align: center;
      margin: 6px 0 10px;
    }

    #vote-timer-circle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 62px;
      height: 62px;
      border-radius: 50%;
      border: 4px solid #2dc653;
      font-family: var(--font-header);
      font-size: 26px;
      font-weight: 800;
      color: #f0f0f0;
      background: rgba(255, 255, 255, 0.05);
      transition: border-color 0.4s, color 0.4s;
    }

    #vote-timer-circle.warn {
      border-color: #ffd60a;
      color: #ffd60a;
    }

    #vote-timer-circle.danger {
      border-color: #e63946;
      color: #e63946;
      animation: timerPulse 0.45s ease infinite alternate;
    }

    @keyframes timerPulse {
      from {
        transform: scale(1)
      }

      to {
        transform: scale(1.12)
      }
    }

    /* ===== STATUS BAR ===== */
    .status-bar {
      display: flex;
      justify-content: space-around;
      width: 100%;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 12px;
    }

    .status-item {
      text-align: center;
    }

    .status-num {
      font-size: 22px;
      font-weight: 800;
      color: var(--gold);
    }

    .status-label {
      font-size: 11px;
      color: var(--text-muted);
    }

    /* ===== TOAST ===== */
    .toast {
      position: fixed;
      bottom: 30px;
      left: 50%;
      transform: translateX(-50%) translateY(80px);
      background: var(--surface);
      border: 1px solid var(--gold);
      color: var(--text);
      padding: 12px 24px;
      border-radius: 30px;
      font-size: 14px;
      font-weight: 600;
      z-index: 999;
      transition: transform 0.3s;
      white-space: nowrap;
      text-align: center;
    }

    .toast.show {
      transform: translateX(-50%) translateY(0);
    }

    /* ===== ROLE BAR (bottom of every game screen) ===== */
    .role-bar {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      display: none;
      align-items: center;
      justify-content: space-between;
      padding: 8px 16px;
      background: rgba(13, 13, 13, 0.95);
      border-top: 1px solid var(--border);
      z-index: 50;
      backdrop-filter: blur(10px);
      max-width: 480px;
      margin: 0 auto;
    }

    .role-bar.visible {
      display: flex;
    }

    .role-bar-role {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
      font-weight: 700;
    }

    .role-bar-team {
      font-size: 11px;
      padding: 3px 10px;
      border-radius: 20px;
      font-weight: 600;
    }

    .team-mafia {
      background: rgba(230, 57, 70, 0.2);
      color: #e63946;
    }

    .team-good {
      background: rgba(45, 198, 83, 0.15);
      color: #2dc653;
    }

    .team-solo {
      background: rgba(255, 214, 10, 0.15);
      color: #ffd60a;
    }

    .players-btn {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 5px 10px;
      color: var(--text);
      font-size: 12px;
      cursor: pointer;
      font-family: var(--font);
    }

    /* ===== PLAYERS TABLE OVERLAY ===== */
    .players-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 200;
      background: rgba(0, 0, 0, 0.85);
      align-items: flex-end;
      justify-content: center;
    }

    .players-overlay.open {
      display: flex;
    }

    .players-sheet {
      background: var(--surface);
      border-radius: 24px 24px 0 0;
      border: 1px solid var(--border);
      width: 100%;
      max-width: 480px;
      padding: 20px 20px 36px;
      animation: slideUp 0.25s ease;
      max-height: 80vh;
      overflow-y: auto;
    }

    .players-sheet-title {
      font-size: 16px;
      font-weight: 800;
      color: var(--gold);
      text-align: center;
      margin-bottom: 16px;
      font-family: var(--font-header);
    }

    .player-row {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 14px;
      border-radius: 12px;
      margin-bottom: 6px;
      border: 1px solid var(--border);
    }

    .player-row.alive-row {
      background: var(--surface2);
    }

    .player-row.dead-row {
      background: rgba(255, 255, 255, 0.03);
      opacity: 0.5;
    }

    .player-row-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      font-weight: 800;
      flex-shrink: 0;
    }

    .player-row-name {
      font-size: 14px;
      font-weight: 600;
      flex: 1;
    }

    .player-row-status {
      font-size: 18px;
    }

    /* ===== REVIVE POPUP (Layla - 10s) ===== */
    @keyframes rpBg {
      0% {
        background: rgba(0, 0, 0, 0);
      }

      15% {
        background: rgba(50, 0, 80, 0.92);
      }

      100% {
        background: rgba(18, 0, 36, 0.92);
      }
    }

    #rp-bg {
      animation: rpBg 0.9s ease forwards;
    }

    .rp-rays {
      position: absolute;
      top: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 200%;
      height: 100%;
      pointer-events: none;
    }

    .rp-ray {
      position: absolute;
      top: 0;
      left: 50%;
      width: 3px;
      height: 0;
      background: linear-gradient(to bottom, rgba(224, 86, 253, 0.85), transparent);
      transform-origin: top center;
      transform: translateX(-50%) rotate(var(--angle));
      animation: rpRay 1.8s ease var(--delay, 0s) forwards;
    }

    @keyframes rpRay {
      0% {
        height: 0;
        opacity: 0
      }

      40% {
        opacity: 0.7
      }

      100% {
        height: 85vh;
        opacity: 0.2
      }
    }

    .rp-spark {
      position: absolute;
      left: var(--sx);
      top: var(--sy);
      font-size: 22px;
      animation: rpSpark 2.8s ease var(--sdelay, 0.2s) infinite;
      opacity: 0;
    }

    @keyframes rpSpark {
      0% {
        opacity: 0;
        transform: translateY(0) scale(0.4)
      }

      25% {
        opacity: 1;
        transform: translateY(-18px) scale(1)
      }

      100% {
        opacity: 0;
        transform: translateY(-55px) scale(0.2)
      }
    }

    #rp-orb {
      font-size: 84px;
      display: block;
      margin-bottom: 14px;
      animation: rpOrb 0.8s cubic-bezier(0.2, 0.8, 0.3, 1.3) 0.3s both;
    }

    @keyframes rpOrb {
      0% {
        transform: translateY(120px) scale(0.2);
        opacity: 0
      }

      65% {
        transform: translateY(-14px) scale(1.18);
        opacity: 1
      }

      100% {
        transform: translateY(0) scale(1);
        opacity: 1
      }
    }

    #revive-popup-name {
      font-family: var(--font-header);
      font-size: 34px;
      font-weight: 800;
      color: #e056fd;
      text-shadow: 0 0 20px #9b59b6, 0 0 45px #6c2eb9, 0 0 80px #e056fd;
      margin-bottom: 10px;
      animation: rpName 0.6s ease 1.1s both;
    }

    @keyframes rpName {
      from {
        opacity: 0;
        transform: translateY(22px);
        filter: blur(5px)
      }

      to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0)
      }
    }

    #rp-revive-text {
      font-size: 20px;
      color: #e056fd;
      font-weight: 700;
      animation: rpText 0.5s ease 1.8s both;
    }

    #rp-sub {
      font-size: 14px;
      color: #bb88dd;
      animation: rpText 0.5s ease 2.2s both;
    }

    @keyframes rpText {
      from {
        opacity: 0;
        transform: translateY(10px)
      }

      to {
        opacity: 1;
        transform: translateY(0)
      }
    }

    @keyframes rpFadeOut {
      0% {
        opacity: 1;
        transform: scale(1)
      }

      100% {
        opacity: 0;
        transform: scale(0.85) translateY(-18px);
        filter: blur(7px)
      }
    }

    /* ===== SNIPER POPUP (6s) ===== */
    @keyframes spBg {
      0% {
        background: rgba(0, 0, 0, 0)
      }

      5% {
        background: rgba(255, 255, 220, 0.85)
      }

      18% {
        background: rgba(8, 8, 0, 0.94)
      }

      100% {
        background: rgba(8, 8, 0, 0.94)
      }
    }

    #sp-bg {
      animation: spBg 0.6s ease forwards;
    }

    #sp-crosshair {
      position: absolute;
      width: 200px;
      height: 200px;
      left: 50%;
      top: 42%;
      transform: translate(-50%, -50%);
    }

    .sp-ring {
      position: absolute;
      border-radius: 50%;
      border: 2px solid rgba(255, 214, 10, 0.75);
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }

    .sp-ring1 {
      width: 180px;
      height: 180px;
      animation: spRing 0.45s ease 0.1s both;
    }

    .sp-ring2 {
      width: 96px;
      height: 96px;
      animation: spRing 0.45s ease 0.2s both;
    }

    @keyframes spRing {
      from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.2)
      }

      to {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1)
      }
    }

    .sp-hline,
    .sp-vline {
      position: absolute;
      background: rgba(255, 214, 10, 0.65);
    }

    .sp-hline {
      width: 180px;
      height: 1px;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      animation: spLine 0.35s ease 0.3s both;
    }

    .sp-vline {
      width: 1px;
      height: 180px;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      animation: spLine 0.35s ease 0.3s both;
    }

    @keyframes spLine {
      from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0)
      }

      to {
        opacity: 0.65;
        transform: translate(-50%, -50%) scale(1)
      }
    }

    .sp-crack {
      position: absolute;
      left: var(--cx);
      top: var(--cy);
      width: var(--cw);
      height: 1.5px;
      background: linear-gradient(to right, rgba(255, 200, 0, 0.9), transparent);
      transform-origin: left center;
      transform: translate(-50%, -50%) rotate(var(--ca));
      animation: spCrack 0.3s ease 0.55s both;
    }

    @keyframes spCrack {
      from {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(var(--ca)) scaleX(0)
      }

      to {
        opacity: 0.8;
        transform: translate(-50%, -50%) rotate(var(--ca)) scaleX(1)
      }
    }

    #sp-icon {
      font-size: 80px;
      display: block;
      margin-bottom: 10px;
      animation: spIcon 0.4s ease 0.65s both, sniperShake 0.35s ease 1.05s;
    }

    @keyframes spIcon {
      from {
        opacity: 0;
        transform: scale(0.4)
      }

      to {
        opacity: 1;
        transform: scale(1)
      }
    }

    #sniper-popup-top {
      font-size: 14px;
      color: #ffd60a;
      font-weight: 600;
      margin-bottom: 8px;
      animation: spTxt 0.4s ease 1.15s both;
    }

    #sniper-popup-name {
      font-family: var(--font-header);
      font-size: 34px;
      font-weight: 800;
      color: #ffd60a;
      text-shadow: 0 0 20px #ffd60a, 0 0 40px #ff8c00;
      margin-bottom: 10px;
      animation: spName 0.5s ease 1.45s both;
    }

    #sp-sub {
      font-size: 18px;
      color: #ff8c00;
      font-weight: 700;
      animation: spTxt 0.4s ease 1.95s both;
    }

    #sp-sub2 {
      font-size: 13px;
      color: var(--text-muted);
      animation: spTxt 0.4s ease 2.25s both;
    }

    @keyframes spName {
      from {
        opacity: 0;
        transform: scale(2.2) translateY(-6px);
        filter: blur(5px)
      }

      to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0)
      }
    }

    @keyframes spTxt {
      from {
        opacity: 0;
        transform: translateY(8px)
      }

      to {
        opacity: 1;
        transform: translateY(0)
      }
    }

    @keyframes spFadeOut {
      from {
        opacity: 1
      }

      to {
        opacity: 0;
        transform: scale(0.9);
        filter: blur(7px)
      }
    }

    /* ===== MELA POPUP (6s) ===== */
    @keyframes mpBgBlue {
      0% {
        background: rgba(0, 0, 0, 0)
      }

      15% {
        background: rgba(0, 55, 95, 0.93)
      }

      100% {
        background: rgba(0, 18, 38, 0.93)
      }
    }

    @keyframes mpBgRed {
      0% {
        background: rgba(0, 0, 0, 0)
      }

      15% {
        background: rgba(110, 0, 18, 0.93)
      }

      100% {
        background: rgba(28, 0, 8, 0.93)
      }
    }

    .mp-ring-wrap {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      pointer-events: none;
    }

    .mp-ring {
      position: absolute;
      border-radius: 50%;
      left: 0;
      top: 0;
      transform: translate(-50%, -50%);
      border: 2px solid rgba(0, 191, 255, 0.5);
      animation: mpRing 1.6s ease var(--mdelay, 0s) infinite;
    }

    @keyframes mpRing {
      0% {
        width: 24px;
        height: 24px;
        opacity: 0.85
      }

      100% {
        width: 320px;
        height: 320px;
        opacity: 0
      }
    }

    #mp-drop {
      font-size: 72px;
      display: block;
      margin-bottom: 10px;
      animation: mpDrop 0.65s cubic-bezier(0.2, 0.8, 0.3, 1.2) 0.2s both;
    }

    @keyframes mpDrop {
      0% {
        transform: translateY(-130px) scale(0.35);
        opacity: 0
      }

      68% {
        transform: translateY(12px) scale(1.18);
        opacity: 1
      }

      100% {
        transform: translateY(0) scale(1)
      }
    }

    #mela-popup-top {
      font-size: 13px;
      font-weight: 600;
      animation: mpTxt 0.4s ease 0.9s both;
      margin-bottom: 8px;
    }

    #mela-popup-name {
      font-family: var(--font-header);
      font-size: 30px;
      font-weight: 800;
      margin-bottom: 8px;
      animation: mpName 0.5s ease 1.25s both;
    }

    #mela-popup-result {
      font-size: 16px;
      font-weight: 700;
      margin-bottom: 6px;
      animation: mpTxt 0.4s ease 1.75s both;
    }

    #mela-popup-sub {
      font-size: 13px;
      color: var(--text-muted);
      animation: mpTxt 0.4s ease 2.05s both;
    }

    @keyframes mpName {
      from {
        opacity: 0;
        transform: scale(1.6);
        filter: blur(4px)
      }

      to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0)
      }
    }

    @keyframes mpTxt {
      from {
        opacity: 0;
        transform: translateY(10px)
      }

      to {
        opacity: 1;
        transform: translateY(0)
      }
    }

    @keyframes mpFadeOut {
      from {
        opacity: 1
      }

      to {
        opacity: 0;
        transform: scale(0.95);
        filter: blur(5px)
      }
    }

    /* ===== VOTED OUT POPUP (6s) ===== */
    @keyframes vpBg {
      0% {
        background: rgba(0, 0, 0, 0)
      }

      10% {
        background: rgba(140, 35, 0, 0.92)
      }

      30% {
        background: rgba(18, 8, 0, 0.94)
      }

      100% {
        background: rgba(18, 8, 0, 0.94)
      }
    }

    #vp-bg {
      animation: vpBg 0.65s ease forwards;
    }

    #vp-gavel {
      font-size: 80px;
      display: block;
      margin-bottom: 10px;
      animation: vpGavel 0.4s cubic-bezier(0.4, 0, 0.2, 1.6) 0.2s both;
    }

    @keyframes vpGavel {
      0% {
        transform: translateY(-220px) rotate(-50deg) scale(0.4);
        opacity: 0
      }

      78% {
        transform: translateY(10px) rotate(4deg) scale(1.12);
        opacity: 1
      }

      100% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1
      }
    }

    #vp-stamp {
      font-size: 26px;
      font-weight: 900;
      color: #ff3300;
      border: 4px solid #ff3300;
      border-radius: 6px;
      padding: 3px 14px;
      display: inline-block;
      transform: rotate(-8deg);
      text-shadow: 0 0 10px #ff330088;
      box-shadow: 0 0 14px #ff330055;
      margin-bottom: 14px;
      animation: vpStamp 0.3s ease 0.75s both;
    }

    @keyframes vpStamp {
      0% {
        transform: rotate(-8deg) scale(3.5);
        opacity: 0;
        filter: blur(5px)
      }

      70% {
        transform: rotate(-8deg) scale(0.93);
        opacity: 1;
        filter: blur(0)
      }

      100% {
        transform: rotate(-8deg) scale(1);
        opacity: 1
      }
    }

    #voted-popup-name {
      font-family: var(--font-header);
      font-size: 32px;
      font-weight: 800;
      color: #ff8c00;
      text-shadow: 0 0 20px #ff8c00, 0 0 40px #e63946;
      margin-bottom: 10px;
      animation: vpName 0.5s ease 1.25s both;
    }

    @keyframes vpName {
      from {
        opacity: 0;
        transform: translateX(-35px)
      }

      to {
        opacity: 1;
        transform: translateX(0)
      }
    }

    #vp-sub {
      font-size: 16px;
      color: #ff8c00;
      font-weight: 600;
      animation: mpTxt 0.4s ease 1.75s both;
    }

    @keyframes vpFadeOut {
      from {
        opacity: 1
      }

      to {
        opacity: 0;
        transform: scale(0.88) translateY(22px);
        filter: blur(6px)
      }
    }

    /* ===== SAVED POPUP (6s) ===== */
    @keyframes svpBg {
      0% {
        background: rgba(0, 0, 0, 0)
      }

      15% {
        background: rgba(0, 90, 25, 0.9)
      }

      40% {
        background: rgba(0, 18, 8, 0.93)
      }

      100% {
        background: rgba(0, 18, 8, 0.93)
      }
    }

    #svp-bg {
      animation: svpBg 0.7s ease forwards;
    }

    .svp-ring {
      position: absolute;
      border-radius: 50%;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      border: 2px solid rgba(45, 198, 83, 0.5);
      animation: svpRing 1.6s ease var(--svpd, 0s) infinite;
    }

    @keyframes svpRing {
      0% {
        width: 28px;
        height: 28px;
        opacity: 0.85
      }

      100% {
        width: 300px;
        height: 300px;
        opacity: 0
      }
    }

    #svp-icon {
      font-size: 82px;
      display: block;
      margin-bottom: 12px;
      animation: svpShield 0.6s cubic-bezier(0.2, 0.8, 0.3, 1.3) 0.3s both;
    }

    @keyframes svpShield {
      0% {
        transform: scale(0.15) rotate(-22deg);
        opacity: 0
      }

      68% {
        transform: scale(1.18) rotate(3deg);
        opacity: 1
      }

      100% {
        transform: scale(1) rotate(0deg);
        opacity: 1
      }
    }

    #saved-popup-name {
      font-family: var(--font-header);
      font-size: 34px;
      font-weight: 800;
      color: #2dc653;
      text-shadow: 0 0 20px #2dc653, 0 0 40px #1a8a3a;
      margin-bottom: 10px;
      animation: svpName 0.5s ease 1.05s both;
    }

    @keyframes svpName {
      from {
        opacity: 0;
        transform: scale(0.4);
        filter: blur(5px)
      }

      to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0)
      }
    }

    #svp-text {
      font-size: 18px;
      color: #2dc653;
      font-weight: 700;
      animation: mpTxt 0.4s ease 1.65s both;
    }

    #svp-hb {
      font-size: 22px;
      margin-top: 12px;
      animation: mpTxt 0.4s ease 2.0s both, svpHb 0.6s ease 2.4s 3;
    }

    @keyframes svpHb {

      0%,
      100% {
        transform: scale(1)
      }

      50% {
        transform: scale(1.3);
        filter: drop-shadow(0 0 8px #2dc653)
      }
    }

    @keyframes svpFadeOut {
      from {
        opacity: 1
      }

      to {
        opacity: 0;
        transform: scale(1.12);
        filter: blur(7px)
      }
    }

    /* ===== SILENCED POPUP (6s) ===== */
    @keyframes slpBg {
      0% {
        background: rgba(0, 0, 0, 0)
      }

      10% {
        background: rgba(35, 0, 55, 0.96)
      }

      100% {
        background: rgba(10, 0, 26, 0.96)
      }
    }

    #slp-bg {
      animation: slpBg 0.5s ease forwards;
    }

    .slp-bar {
      position: absolute;
      left: 0;
      right: 0;
      top: var(--slpt);
      height: 3px;
      background: rgba(204, 68, 255, 0.35);
      animation: slpGlitch 0.09s ease var(--slpd, 0s) infinite;
    }

    @keyframes slpGlitch {

      0%,
      100% {
        opacity: 0.25;
        transform: translateX(0) scaleX(1)
      }

      25% {
        opacity: 0.85;
        transform: translateX(-10px) scaleX(0.93)
      }

      50% {
        opacity: 0.08;
        transform: translateX(5px) scaleX(1.07)
      }

      75% {
        opacity: 0.55;
        transform: translateX(-3px)
      }
    }

    #slp-icon {
      font-size: 80px;
      display: block;
      margin-bottom: 12px;
      animation: slpIcon 0.4s ease 0.2s both, slpPulse 0.5s ease 0.7s 3;
    }

    @keyframes slpIcon {
      from {
        transform: scale(0) rotate(-22deg);
        opacity: 0
      }

      to {
        transform: scale(1) rotate(0deg);
        opacity: 1
      }
    }

    @keyframes slpPulse {

      0%,
      100% {
        transform: scale(1)
      }

      50% {
        transform: scale(1.18);
        filter: drop-shadow(0 0 18px #cc44ff)
      }
    }

    #silenced-popup-name {
      font-family: var(--font-header);
      font-size: 32px;
      font-weight: 800;
      color: #cc44ff;
      text-shadow: 0 0 20px #9900cc, 0 0 40px #6600aa;
      margin-bottom: 10px;
      animation: slpName 0.5s ease 0.85s both, slpGlitchName 0.35s ease 1.4s both;
    }

    @keyframes slpName {
      from {
        opacity: 0;
        transform: scaleX(2.2);
        filter: blur(7px)
      }

      to {
        opacity: 1;
        transform: scaleX(1);
        filter: blur(0)
      }
    }

    @keyframes slpGlitchName {

      0%,
      100% {
        text-shadow: 0 0 20px #9900cc;
        transform: translateX(0)
      }

      20% {
        text-shadow: 5px 0 0 #0ff, -5px 0 0 #cc44ff;
        transform: translateX(-5px)
      }

      40% {
        text-shadow: -5px 0 0 #0ff, 5px 0 0 #cc44ff;
        transform: translateX(5px)
      }

      60% {
        transform: translateX(-2px);
        opacity: 0.6
      }

      80% {
        transform: translateX(2px);
        opacity: 1
      }
    }

    #slp-text {
      font-size: 20px;
      color: #cc44ff;
      font-weight: 700;
      animation: slpTxt 0.4s ease 1.8s both;
    }

    #slp-sub {
      font-size: 14px;
      color: #aa88cc;
      animation: slpTxt 0.4s ease 2.2s both;
    }

    @keyframes slpTxt {
      from {
        opacity: 0;
        transform: translateY(8px);
        filter: blur(2px)
      }

      to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0)
      }
    }

    @keyframes slpFadeOut {
      0% {
        opacity: 1
      }

      30% {
        filter: blur(0) brightness(2)
      }

      100% {
        opacity: 0;
        filter: blur(9px) brightness(0.4)
      }
    }

    /* ===== BODYGUARD SACRIFICE POPUP (6s) ===== */
    @keyframes bgpBg {
      0% {
        background: rgba(0, 0, 0, 0)
      }

      10% {
        background: rgba(0, 50, 120, 0.92)
      }

      35% {
        background: rgba(0, 12, 35, 0.96)
      }

      100% {
        background: rgba(0, 12, 35, 0.96)
      }
    }

    #bgp-bg {
      animation: bgpBg 0.7s ease forwards;
    }

    .bgp-ring {
      position: absolute;
      border-radius: 50%;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      border: 2px solid rgba(72, 149, 239, 0.5);
      animation: bgpRing 2s ease var(--bgpd, 0s) infinite;
    }

    @keyframes bgpRing {
      0% {
        width: 30px;
        height: 30px;
        opacity: 0.9
      }

      100% {
        width: 340px;
        height: 340px;
        opacity: 0
      }
    }

    #bgp-shield {
      font-size: 78px;
      display: block;
      margin-bottom: 10px;
      animation: bgpShield 0.65s cubic-bezier(0.2, 0.8, 0.3, 1.3) 0.2s both;
    }

    @keyframes bgpShield {
      0% {
        transform: scale(0.1) rotate(-30deg);
        opacity: 0;
        filter: blur(6px)
      }

      70% {
        transform: scale(1.22) rotate(5deg);
        opacity: 1;
        filter: blur(0)
      }

      100% {
        transform: scale(1) rotate(0deg);
        opacity: 1
      }
    }

    #bgp-title {
      font-size: 15px;
      font-weight: 700;
      color: #64B5F6;
      animation: bgpTxt 0.4s ease 1.0s both;
      margin-bottom: 4px;
    }

    #bgp-bodyguard-name {
      font-family: var(--font-header);
      font-size: 30px;
      font-weight: 800;
      color: #4895ef;
      text-shadow: 0 0 20px #4895ef, 0 0 40px #1565C0;
      margin-bottom: 14px;
      animation: bgpName 0.5s ease 1.3s both;
    }

    @keyframes bgpName {
      from {
        opacity: 0;
        transform: translateX(30px);
        filter: blur(4px)
      }

      to {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0)
      }
    }

    #bgp-saved-wrap {
      background: rgba(72, 149, 239, 0.12);
      border: 1px solid rgba(72, 149, 239, 0.35);
      border-radius: 10px;
      padding: 8px 20px;
      animation: bgpSaved 0.4s ease 2.0s both;
    }

    @keyframes bgpSaved {
      from {
        opacity: 0;
        transform: scale(0.85)
      }

      to {
        opacity: 1;
        transform: scale(1)
      }
    }

    #bgp-saved-label {
      font-size: 13px;
      color: #90CAF9;
      margin-bottom: 3px;
    }

    #bgp-saved-name {
      font-family: var(--font-header);
      font-size: 24px;
      font-weight: 800;
      color: #90CAF9;
      text-shadow: 0 0 14px #4895ef;
    }

    @keyframes bgpTxt {
      from {
        opacity: 0;
        transform: translateY(8px)
      }

      to {
        opacity: 1;
        transform: translateY(0)
      }
    }

    @keyframes bgpFadeOut {
      from {
        opacity: 1;
        transform: scale(1)
      }

      to {
        opacity: 0;
        transform: scale(1.12);
        filter: blur(7px)
      }
    }

    /* legacy - kept for any leftover references */
    @keyframes reviveIn {
      0% {
        transform: scale(0.3) translateY(40px);
        opacity: 0
      }

      60% {
        transform: scale(1.1) translateY(-10px);
        opacity: 1
      }

      100% {
        transform: scale(1) translateY(0);
        opacity: 1
      }
    }

    @keyframes reviveFadeOut {
      0% {
        opacity: 1;
        transform: scale(1) translateY(0)
      }

      100% {
        opacity: 0;
        transform: scale(1.2) translateY(-30px)
      }
    }

    /* ===== KILL POPUP ANIMATIONS ===== */
    .kp-drip-wrap {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 140px;
      pointer-events: none;
    }

    .kp-drip {
      position: absolute;
      top: 0;
      background: linear-gradient(to bottom, #5a0000, #cc0000 60%, #ff000088);
      border-radius: 0 0 8px 8px;
      animation: bloodDrip 1.4s ease-out forwards;
    }

    @keyframes bloodDrip {
      0% {
        height: 0;
        opacity: 1;
      }

      100% {
        height: 110px;
        opacity: 0.85;
      }
    }

    @keyframes killBgFlash {
      0% {
        background: rgba(0, 0, 0, 0);
      }

      12% {
        background: rgba(160, 0, 0, 0.92);
      }

      35% {
        background: rgba(8, 0, 0, 0.96);
      }

      100% {
        background: rgba(8, 0, 0, 0.96);
      }
    }

    #kp-bg {
      animation: killBgFlash 0.9s ease forwards;
    }

    #kp-skull {
      font-size: 96px;
      display: block;
      margin-bottom: 14px;
      animation: skullCrash 0.75s cubic-bezier(0.2, 0.8, 0.3, 1.3) 0.25s both;
    }

    @keyframes skullCrash {
      0% {
        transform: translateY(-340px) scale(0.2) rotate(-25deg);
        opacity: 0;
      }

      65% {
        transform: translateY(18px) scale(1.25) rotate(4deg);
        opacity: 1;
      }

      80% {
        transform: translateY(-8px) scale(0.93) rotate(-1deg);
      }

      92% {
        transform: translateY(4px) scale(1.04);
      }

      100% {
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 1;
      }
    }

    #killed-popup-name {
      font-family: var(--font-header);
      font-size: 36px;
      font-weight: 800;
      color: #ff2020;
      text-shadow: 0 0 24px #e63946, 0 0 50px #c1121f;
      margin-bottom: 10px;
      animation: nameSlam 0.55s ease 1.05s both, nameGlitch 0.45s ease 1.6s both;
    }

    @keyframes nameSlam {
      0% {
        transform: scale(4) translateY(-8px);
        opacity: 0;
        filter: blur(8px);
      }

      65% {
        transform: scale(0.94);
        opacity: 1;
        filter: blur(0);
      }

      100% {
        transform: scale(1);
        opacity: 1;
      }
    }

    @keyframes nameGlitch {

      0%,
      100% {
        text-shadow: 0 0 24px #e63946, 0 0 50px #c1121f;
        transform: translateX(0);
      }

      18% {
        transform: translateX(-6px);
        text-shadow: 6px 0 0 #0ff, -6px 0 0 #f00;
      }

      36% {
        transform: translateX(6px);
        text-shadow: -6px 0 0 #0ff, 6px 0 0 #f00;
      }

      54% {
        transform: translateX(-3px);
      }

      72% {
        transform: translateX(3px);
      }
    }

    #kp-killed-text {
      font-size: 20px;
      color: #e63946;
      font-weight: 700;
      margin-bottom: 6px;
      animation: killTextIn 0.5s ease 2.0s both;
    }

    #kp-sub {
      font-size: 14px;
      color: var(--text-muted);
      animation: killTextIn 0.5s ease 2.4s both;
    }

    @keyframes killTextIn {
      from {
        opacity: 0;
        transform: translateY(12px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes killFadeOut {
      0% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
      }

      100% {
        opacity: 0;
        transform: scale(1.2);
        filter: blur(10px);
      }
    }

    @keyframes sniperShake {

      0%,
      100% {
        transform: rotate(0deg) scale(1);
      }

      20% {
        transform: rotate(-15deg) scale(1.3);
      }

      40% {
        transform: rotate(15deg) scale(1.1);
      }

      60% {
        transform: rotate(-10deg) scale(1.2);
      }

      80% {
        transform: rotate(10deg) scale(1.05);
      }
    }

    @keyframes sparkleFloat {

      0%,
      100% {
        transform: translateY(0) rotate(0deg);
      }

      50% {
        transform: translateY(-10px) rotate(20deg);
      }
    }

    /* ===== KURDI LABEL ===== */
    .kurdi-label {
      font-family: var(--font-header);
      font-size: 22px;
      font-weight: 800;
      color: #fff;
      position: relative;
      letter-spacing: 2px;
      animation: kurdiFlicker 3s infinite;
      text-shadow:
        0 0 8px #fff,
        0 0 20px #ffd60a,
        0 0 40px #ffd60a;
    }

    .kurdi-label::before,
    .kurdi-label::after {
      content: '⚡';
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      font-size: 14px;
    }

    .kurdi-label::before {
      top: -14px;
      animation: boltFlash 1.5s infinite;
    }

    .kurdi-label::after {
      bottom: -14px;
      animation: boltFlash 1.5s infinite 0.75s;
    }

    @keyframes kurdiFlicker {
      0% {
        opacity: 1;
        text-shadow: 0 0 8px #fff, 0 0 20px #ffd60a, 0 0 40px #ffd60a;
        color: #fff;
      }

      5% {
        opacity: 0.3;
        text-shadow: none;
      }

      6% {
        opacity: 1;
        text-shadow: 0 0 8px #fff, 0 0 20px #ffd60a, 0 0 60px #ffd60a;
      }

      45% {
        opacity: 1;
        text-shadow: 0 0 8px #fff, 0 0 20px #ffd60a, 0 0 40px #ffd60a;
        color: #fff;
      }

      46% {
        opacity: 0.2;
        text-shadow: none;
        color: #ffd60a;
      }

      47% {
        opacity: 1;
        text-shadow: 0 0 8px #fff, 0 0 30px #ffd60a, 0 0 80px #ffd60a;
        color: #fff;
      }

      48% {
        opacity: 0.5;
      }

      49% {
        opacity: 1;
        text-shadow: 0 0 8px #fff, 0 0 20px #ffd60a, 0 0 40px #ffd60a;
      }

      100% {
        opacity: 1;
        text-shadow: 0 0 8px #fff, 0 0 20px #ffd60a, 0 0 40px #ffd60a;
      }
    }

    @keyframes boltFlash {

      0%,
      100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
      }

      50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.2);
      }
    }

    /* ===== ROLE SELECT DOT ===== */
    .role-select-dot {
      position: absolute;
      top: 6px;
      left: 6px;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: var(--border);
      border: 1.5px solid var(--border);
      transition: background 0.15s;
    }

    .role-select-dot.on {
      background: #2dc653;
      border-color: #2dc653;
    }

    /* Dim card when off */
    .role-guide-card.role-off {
      opacity: 0.35;
    }

    /* ===== ANONYMOUS TOGGLE ===== */
    .anon-toggle {
      width: 52px;
      height: 28px;
      background: var(--border);
      border-radius: 30px;
      position: relative;
      cursor: pointer;
      transition: background 0.2s;
      flex-shrink: 0;
    }

    .anon-toggle.on {
      background: var(--gold);
    }

    .anon-knob {
      width: 22px;
      height: 22px;
      background: white;
      border-radius: 50%;
      position: absolute;
      top: 3px;
      left: 3px;
      transition: left 0.2s;
    }

    .anon-toggle.on .anon-knob {
      left: 27px;
    }

    /* ===== ROLES GUIDE ===== */
    .roles-guide-grid {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 12px;
      width: 100%;
    }

    .role-guide-card {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 20px 10px;
      border-radius: 14px;
      cursor: pointer;
      border: 2px solid transparent;
      transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    }

    .role-guide-card:hover:not(.role-off) {
      transform: translateY(-2px) scale(1.03);
      box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    }

    .role-guide-card.role-off:hover {
      transform: scale(1.02);
      opacity: 0.5;
    }

    .role-guide-card:active {
      transform: scale(0.95);
    }

    .rg-emoji {
      font-size: 36px;
    }

    .rg-name {
      font-size: 13px;
      font-weight: 700;
      color: #fff;
      text-align: center;
    }

    /* Role Modal */
    .role-modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.85);
      z-index: 100;
      align-items: flex-end;
      justify-content: center;
    }

    .role-modal-overlay.open {
      display: flex;
    }

    .role-modal {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 24px 24px 0 0;
      padding: 28px 24px 40px;
      width: 100%;
      max-width: 480px;
      display: flex;
      flex-direction: column;
      align-items: center;
      animation: slideUp 0.25s ease;
    }

    @keyframes slideUp {
      from {
        transform: translateY(100%);
      }

      to {
        transform: translateY(0);
      }
    }

    .role-modal-emoji {
      font-size: 56px;
      margin-bottom: 8px;
    }

    .role-modal-name {
      font-size: 26px;
      font-weight: 800;
      font-family: var(--font-header);
      color: var(--gold);
    }

    .role-modal-team {
      font-size: 13px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    .role-modal-divider {
      width: 60px;
      height: 2px;
      background: var(--border);
      margin: 14px 0;
      border-radius: 2px;
    }

    .role-modal-section-title {
      font-size: 13px;
      color: var(--gold);
      font-weight: 700;
      align-self: flex-start;
      margin-bottom: 4px;
    }

    .role-modal-text {
      font-size: 14px;
      color: var(--text);
      line-height: 1.8;
      align-self: flex-start;
    }

    /* ===== RESULT SCREEN ===== */
    .result-big {
      font-size: 60px;
      text-align: center;
      margin: 10px 0;
    }

    .result-title {
      font-size: 26px;
      font-weight: 800;
      text-align: center;
    }

    .result-sub {
      font-size: 14px;
      color: var(--text-muted);
      text-align: center;
      margin-top: 6px;
    }

    /* ===== MISC ===== */
    .divider {
      width: 100%;
      height: 1px;
      background: var(--border);
    }

    .label {
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 6px;
      text-align: right;
    }

    .info-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 13px;
      color: var(--text-muted);
      padding: 4px 0;
    }

    .tag {
      font-size: 12px;
      padding: 3px 10px;
      border-radius: 20px;
      font-weight: 600;
    }

    .tag-red {
      background: rgba(230, 57, 70, 0.2);
      color: var(--red);
    }

    .tag-gold {
      background: rgba(255, 214, 10, 0.15);
      color: var(--gold);
    }

    .tag-green {
      background: rgba(45, 198, 83, 0.15);
      color: var(--green);
    }

    /* Waiting message */
    .waiting-msg {
      font-size: 14px;
      color: var(--text-muted);
      text-align: center;
      padding: 20px;
      animation: pulse 2s infinite;
    }

    @keyframes pulse {

      0%,
      100% {
        opacity: 1
      }

      50% {
        opacity: 0.4
      }
    }

    @keyframes mvpShine {
      0% {
        background-position: 200% center
      }

      100% {
        background-position: -200% center
      }
    }

    /* Round badge */
    .round-badge {
      background: var(--surface);
      border: 1px solid var(--gold);
      border-radius: 30px;
      padding: 6px 20px;
      font-size: 14px;
      font-family: var(--font-header);
      color: var(--gold);
      font-weight: 700;
      text-align: center;
    }
/* ══════════════════════════════════════════
   AMONG US MODE TOGGLE
══════════════════════════════════════════ */
.among-us-card {
  width: 100%;
  background: linear-gradient(135deg, #1a0000 0%, #2a0500 50%, #1a0000 100%);
  border: 1.5px solid #cc2200;
  border-radius: 16px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(220, 40, 0, 0.35), 0 0 60px rgba(220, 40, 0, 0.1);
  transition: box-shadow 0.3s ease;
}
.among-us-card:active { transform: scale(0.98); }
.among-us-card.on {
  border-color: #ff4400;
  box-shadow: 0 0 32px rgba(255, 80, 0, 0.6), 0 0 80px rgba(255, 40, 0, 0.25);
}

/* Flame background glow */
.flame-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 130%, rgba(255,70,0,0.45) 0%, transparent 65%);
  animation: flamePulse 2.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes flamePulse {
  0%, 100% { opacity: 0.5; transform: scaleY(1); }
  50%       { opacity: 1;   transform: scaleY(1.08); }
}

/* Floating flame particles */
.flame-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.flame-particles span {
  position: absolute;
  bottom: -10px;
  width: 6px;
  height: 6px;
  border-radius: 50% 50% 30% 30%;
  background: #ff5500;
  opacity: 0;
  animation: floatUp 2.5s ease-in infinite;
}
.flame-particles span:nth-child(1) { left: 15%; animation-delay: 0s;    background:#ff3300; }
.flame-particles span:nth-child(2) { left: 35%; animation-delay: 0.5s;  background:#ff6600; width:5px; height:5px; }
.flame-particles span:nth-child(3) { left: 55%; animation-delay: 1s;    background:#ff4400; }
.flame-particles span:nth-child(4) { left: 70%; animation-delay: 1.5s;  background:#ff5500; width:4px; height:4px; }
.flame-particles span:nth-child(5) { left: 85%; animation-delay: 0.8s;  background:#ff6600; }
@keyframes floatUp {
  0%   { opacity:0;   transform: translateY(0)    scale(1); }
  20%  { opacity:0.8; }
  100% { opacity:0;   transform: translateY(-60px) scale(0.3); }
}

/* Knob */
/* Map Preview */
.au-preview {
  display: none;
  margin-top: 14px;
  position: relative;
  z-index: 2;
  animation: fadeSlideIn 0.35s ease both;
}
@keyframes fadeSlideIn {
  from { opacity:0; transform:translateY(-8px); }
  to   { opacity:1; transform:translateY(0); }
}
.among-us-card.on .au-preview { display: block; }

.au-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 4px;
  width: 100%;
  padding: 6px;
  background: #0d0d1a;
  border-radius: 12px;
  border: 1px solid #333;
  overflow: hidden;
  box-sizing: border-box;
}

/* Rooms (preview) */
.au-room {
  background: #1a1a2e;
  border: 1.5px solid #3a3a5c;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
}
.au-room span {
  font-size: 9px;
  color: #aaa;
  text-align: center;
  padding: 2px 4px;
}

/* Corridors */
/* Player dots (preview animation) */
.au-dot {
  display: none;
}

/* ══════════════════════════════════════════
   AMONG US NIGHT SCREEN
══════════════════════════════════════════ */
.aun-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
}
.aun-badge {
  background: #1a1a2e;
  border: 1.5px solid #4361ee;
  color: #aac4ff;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
}
.aun-timer-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aun-timer-num {
  position: absolute;
  font-size: 14px;
  font-weight: 800;
  color: #e63946;
}
.aun-role-bar {
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0;
  min-height: 24px;
}

/* Map grid: 2x3 rooms with corridors between */
.aun-map-grid {
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  grid-template-rows: 1fr 24px 1fr 24px 1fr;
  width: 100%;
  gap: 0;
  background: #0d0d1a;
  border-radius: 16px;
  border: 1px solid #2a2a3a;
  overflow: hidden;
  min-height: 360px;
}
.aun-room {
  background: #141428;
  border: 1px solid #2a2a4a;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 6px;
  gap: 4px;
  position: relative;
  transition: background 0.2s;
}
.aun-room.au-my-room {
  background: #1a1a35;
  border-color: #4361ee;
  box-shadow: inset 0 0 12px rgba(67,97,238,0.2);
}
.aun-room-label {
  font-size: 11px;
  color: #888;
  text-align: center;
  font-weight: 600;
}
.aun-room-players {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  min-height: 30px;
}
.aun-corridor {
  background: #1a1a2a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aun-center-hub {
  background: #111120;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid #222233;
}

/* Player tokens on map */
.aun-token {
  width: auto;
  min-width: 28px;
  max-width: 70px;
  height: 28px;
  padding: 0 8px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.25);
  cursor: default;
  transition: transform 0.2s;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aun-token.aun-self {
  border-color: #ffd60a;
  box-shadow: 0 0 8px rgba(255,214,10,0.7);
}
.aun-token.aun-mafia-team {
  border-color: #e63946;
  box-shadow: 0 0 8px rgba(230,57,70,0.6);
}
.aun-token.aun-dead {
  opacity: 0.4;
  filter: grayscale(1);
}
.aun-body-icon {
  font-size: 20px;
  animation: bodyPulse 1.5s ease-in-out infinite;
}
@keyframes bodyPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Move buttons */
.au-move-btn {
  flex: 1;
  min-width: 100px;
  font-size: 13px;
  padding: 10px 8px;
}

/* Kill button */
.au-kill-btn {
  width: 100%;
  background: #e63946 !important;
  color: #fff !important;
  border: none !important;
  font-size: 14px;
  font-weight: 800;
  animation: killPulse 1s ease-in-out infinite;
  margin-bottom: 6px;
}
@keyframes killPulse {
  0%,100% { box-shadow: 0 0 8px rgba(230,57,70,0.4); }
  50% { box-shadow: 0 0 20px rgba(230,57,70,0.9); }
}

/* Doctor save button */
.au-save-btn {
  width: 100%;
  background: #2dc653 !important;
  color: #fff !important;
  border: none !important;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
}
.au-save-btn:disabled {
  background: #1a4a2a !important;
  color: #555 !important;
}

/* Bodyguard protect button */
.au-bodyguard-btn {
  width: 100%;
  background: #4895ef !important;
  color: #fff !important;
  border: none !important;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
}

/* Detective investigate button */
.au-investigate-btn {
  width: 100%;
  background: #4361ee !important;
  color: #fff !important;
  border: none !important;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
}

/* Towzher player selection */
.au-towzher-player {
  width: 100%;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1.5px solid #333;
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  text-align: right;
  transition: border-color 0.2s, background 0.2s;
  font-family: var(--font);
}
.au-towzher-player.selected-1 {
  border-color: #ff9800;
  background: #2a1800;
  color: #ff9800;
}
.au-towzher-player.selected-2 {
  border-color: #ffd60a;
  background: #2a2200;
  color: #ffd60a;
}

/* Mole sabotage */
.au-mole-room-btn {
  width: 100%;
  background: #222 !important;
  color: #aaa !important;
  border: 1.5px solid #444 !important;
  font-size: 13px;
  margin-bottom: 6px;
}
.au-mole-room-btn:active {
  background: #e63946 !important;
  color: #fff !important;
}
/* Locked room on map */
.aun-room.au-locked {
  border-color: #e63946 !important;
  background: #2a0000 !important;
  animation: lockFlash 0.5s ease-in-out infinite;
}
@keyframes lockFlash {
  0%,100% { box-shadow: inset 0 0 8px rgba(230,57,70,0.3); }
  50% { box-shadow: inset 0 0 20px rgba(230,57,70,0.7); }
}

/* Hakim sealed room */
.aun-room.au-sealed {
  border-color: #ffd60a !important;
  background: #1a1500 !important;
}
.aun-room.au-sealed::after {
  content: '🔒';
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 14px;
}
.au-hakim-room-btn {
  width: 100%;
  background: #2a2000 !important;
  color: #ffd60a !important;
  border: 1.5px solid #ffd60a !important;
  font-size: 13px;
  margin-bottom: 6px;
}

/* ══ D-PAD JOYSTICK ══ */
.au-joystick-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
}
.au-room-label-tag {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.au-dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.au-dpad-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.au-dpad-btn {
  width: 58px;
  height: 58px;
  background: #1e1e2e;
  border: 2px solid #3a3a5c;
  border-radius: 14px;
  color: #aaa;
  font-size: 22px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.au-dpad-btn:not(:disabled):active {
  transform: scale(0.9);
  background: #4361ee;
  border-color: #4361ee;
  color: #fff;
}
.au-dpad-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}
.au-dpad-btn.au-dpad-active {
  background: #4361ee;
  border-color: #6b8aff;
  color: #fff;
}
.au-dpad-center {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: #111120;
  border-radius: 14px;
  border: 2px solid #222233;
}

/* ══ AU DEAD OVERLAY ══ */
#au-dead-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
#au-dead-overlay.active {
  display: flex;
  animation: auDeadFadeIn 0.8s ease forwards;
}
@keyframes auDeadFadeIn {
  from { opacity: 0; background: rgba(180,0,0,0.7); }
  to   { opacity: 1; background: #000; }
}
.au-dead-skull {
  font-size: 96px;
  animation: auSkullDrop 0.7s cubic-bezier(.36,.07,.19,.97) 0.3s both;
  filter: drop-shadow(0 0 30px #e63946);
}
@keyframes auSkullDrop {
  0%   { transform: translateY(-80px) scale(1.4); opacity: 0; }
  60%  { transform: translateY(10px)  scale(0.95); opacity: 1; }
  100% { transform: translateY(0)     scale(1); }
}
.au-dead-title {
  font-size: 32px;
  font-weight: 900;
  color: #e63946;
  letter-spacing: 2px;
  animation: auDeadTitleIn 0.5s ease 0.8s both;
  text-shadow: 0 0 20px #e63946, 0 0 40px #e63946;
}
@keyframes auDeadTitleIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
.au-dead-sub {
  font-size: 16px;
  color: #888;
  animation: auDeadSubIn 0.5s ease 1.2s both;
}
@keyframes auDeadSubIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.au-dead-blood-drip {
  position: absolute;
  top: 0;
  width: 6px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(#b30000, #e63946);
  animation: auBloodDrip 1.5s ease-in both;
}
@keyframes auBloodDrip {
  0%   { height: 0; opacity: 1; }
  70%  { height: var(--h); opacity: 1; }
  100% { height: var(--h); opacity: 0.7; }
}

/* ===== HITMAN POPUP ===== */
#hp-scope {
  position: absolute;
  width: 300px; height: 300px;
  border: 3px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  animation: hitmanScopeZoom 0.8s cubic-bezier(.17,.67,.26,.98) both;
}
.hp-scope-circle {
  position: absolute; inset: 20px;
  border: 1px solid rgba(255,0,0,0.4);
  border-radius: 50%;
}
.hp-scope-line {
  position: absolute; background: #e63946; opacity: 0.8;
}
.hp-h { width: 100%; height: 1.5px; top: 50%; left: 0; }
.hp-v { width: 1.5px; height: 100%; left: 50%; top: 0; }
.hp-scope-dots {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, #e63946 1.5px, transparent 1.5px);
  background-size: 40px 40px;
  background-position: center;
  opacity: 0.2;
}
@keyframes hitmanScopeZoom {
  from { transform: scale(4); opacity: 0; filter: blur(10px); }
  to { transform: scale(1); opacity: 1; filter: blur(0); }
}
#hp-target-label {
  color: #999; font-size: 14px; margin-bottom: 4px;
  animation: hitmanTextIn 0.5s ease 1s both;
}
#hitman-popup-name {
  color: #fff; font-size: 48px; font-weight: 900;
  text-transform: uppercase; margin-bottom: 8px;
  text-shadow: 0 0 20px #e63946;
  animation: hitmanNameIn 0.6s cubic-bezier(0.17, 0.67, 0.83, 0.67) 1.2s both;
}
#hp-result {
  color: #e63946; font-size: 24px; font-weight: 800;
  animation: hitmanTextIn 0.5s ease 1.8s both;
}
#hp-sub {
  color: #777; font-size: 14px; margin-top: 10px;
  animation: hitmanTextIn 0.5s ease 2.2s both;
}
@keyframes hitmanTextIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes hitmanNameIn {
  0% { transform: scale(4) translateY(-8px); opacity: 0; filter: blur(8px); }
  100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); }
}

/* ══════════════════════════════════════════
   CHAT SYSTEM
══════════════════════════════════════════ */
.chat-container {
  background: #0a0a14;
  border: 1px solid #1a1a2e;
  border-radius: 14px;
  overflow: hidden;
}

.chat-messages {
  height: 200px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: chatIn 0.3s ease;
}

.chat-msg.me { align-self: flex-end; }
.chat-msg.other { align-self: flex-start; }

.chat-msg-name {
  font-size: 9px;
  font-weight: 700;
  padding: 0 8px;
  margin-bottom: 2px;
}

.chat-msg.me .chat-msg-name {
  color: #4361ee;
  text-align: right;
}

.chat-msg.other .chat-msg-name {
  color: #888;
  text-align: left;
}

.chat-msg-bubble {
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
}

.chat-msg.me .chat-msg-bubble {
  background: linear-gradient(135deg, #4361ee, #3a56d4);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.other .chat-msg-bubble {
  background: #1a1a2e;
  color: #ddd;
  border: 1px solid #2a2a4a;
  border-bottom-left-radius: 4px;
}

/* Role-colored name badges */
.chat-msg.mafia-team .chat-msg-name { color: #e63946; }
.chat-msg.mafia-team.me .chat-msg-bubble { background: linear-gradient(135deg, #8b0000, #6b0000); }

/* System messages */
.chat-msg-system {
  text-align: center;
  font-size: 10px;
  color: #555;
  padding: 4px 0;
  font-style: italic;
}

.chat-input-wrap {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: #0d0d1a;
  border-top: 1px solid #1a1a2e;
  border-radius: 0 0 14px 14px;
}

.chat-input-wrap input {
  flex: 1;
  background: #141428;
  border: 1px solid #2a2a4a;
  border-radius: 20px;
  padding: 8px 14px;
  color: #fff;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.chat-input-wrap input:focus {
  border-color: #4361ee;
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #4361ee, #3a56d4);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:active {
  transform: scale(0.9);
}

.chat-send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

@keyframes chatIn {
  0% { opacity: 0; transform: translateY(8px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Landscape mode (phone held sideways) ── */
@media (orientation: landscape) and (max-height: 500px) {
  .screen.active {
    padding-bottom: 20px;
  }

  /* Night screen: map + controls side by side */
  #screen-au-night {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding: 4px 8px 10px;
  }
  #screen-au-night > .aun-header {
    width: 100%;
    flex-shrink: 0;
  }
  #screen-au-night .aun-map-grid {
    flex: 1 1 55%;
    min-width: 200px;
    max-height: 70vh;
  }
  #screen-au-night .aun-room {
    padding: 4px 2px;
    min-height: 40px;
  }
  #screen-au-night .aun-room-label {
    font-size: 9px;
  }
  #screen-au-night .au-joystick-wrap {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
  }
  .au-dpad-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
  .au-dpad-center {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
  #screen-au-night .aun-role-bar {
    font-size: 11px;
    padding: 2px 0;
  }
  .aun-timer-wrap {
    width: 40px;
    height: 40px;
  }
  .aun-timer-num {
    font-size: 12px;
  }

  /* Role action cards in night: compact, full width below map+dpad */
  #screen-au-night > [id$="-section"] {
    flex: 0 0 100%;
  }
  #screen-au-night .card {
    padding: 8px;
    margin-top: 0;
  }
  /* Dead overlay text */
  #au-dead-overlay {
    font-size: 14px;
  }

  /* Discussion screen */
  #screen-discussion {
    padding: 4px 6px 10px;
  }
  .chat-container {
    max-height: 35vh;
  }
  .chat-messages {
    max-height: 25vh;
  }

  /* Vote screen */
  #screen-vote {
    padding: 4px 6px 10px;
  }
  #screen-vote .card {
    padding: 10px;
  }

  /* General compact */
  .card {
    padding: 12px;
  }
  .btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  /* Menu screens */
  #screen-menu, #screen-host-name, #screen-join {
    padding-top: 10px;
  }

  /* Waiting room */
  #screen-waiting {
    padding: 4px 6px 10px;
  }

  /* Result screen */
  #screen-vote-result .card,
  #screen-result .card {
    padding: 10px;
  }

  /* Adjust/setup screen: scroll-friendly */
  #screen-adjust {
    padding: 4px 6px 10px;
  }
  #screen-adjust .card {
    padding: 10px;
  }
}
