:root {
      --bg: #0f172a;
      --card: #1e293b;
      --card-border: rgba(255, 255, 255, 0.08);
      --text: #f8fafc;
      --muted: #94a3b8;
      --accent: #6366f1;
      --accent-hover: #4f46e5;
      --accent-soft: rgba(99, 102, 241, 0.15);
      --player-a: #38bdf8;
      --player-b: #f472b6;
      --progress-bg: #334155;
      --success: #10b981;
      --warning: #f59e0b;
      --danger: #ef4444;
    }

    [data-theme="oled"] {
      --bg: #000000;
      --card: #111111;
      --card-border: rgba(255, 255, 255, 0.15);
      --text: #ffffff;
      --muted: #a1a1aa;
      --accent: #818cf8;
      --accent-hover: #6366f1;
      --accent-soft: rgba(129, 140, 248, 0.2);
      --player-a: #38bdf8;
      --player-b: #f472b6;
      --progress-bg: #27272a;
      --success: #10b981;
      --warning: #f59e0b;
      --danger: #ef4444;
    }

    [data-theme="romantic"] {
      --bg: #1e1b4b;
      --card: #312e81;
      --card-border: rgba(165, 180, 252, 0.15);
      --text: #e0e7ff;
      --muted: #c7d2fe;
      --accent: #818cf8;
      --accent-hover: #6366f1;
      --accent-soft: rgba(129, 140, 248, 0.2);
      --player-a: #38bdf8;
      --player-b: #a78bfa;
      --progress-bg: #4338ca;
      --success: #34d399;
      --warning: #fbbf24;
      --danger: #f87171;
    }

    [data-theme="paper"] {
      --bg: #f5f0e6;
      --card: #ffffff;
      --card-border: rgba(0, 0, 0, 0.08);
      --text: #2c2523;
      --muted: #78716c;
      --accent: #b45309;
      --accent-hover: #92400e;
      --accent-soft: rgba(180, 83, 9, 0.12);
      --player-a: #0284c7;
      --player-b: #db2777;
      --progress-bg: #e7dfd5;
      --success: #059669;
      --warning: #d97706;
      --danger: #dc2626;
    }

    [data-theme="neon"] {
      --bg: #090614;
      --card: #150d2a;
      --card-border: rgba(0, 240, 255, 0.25);
      --text: #f0f9ff;
      --muted: #8b9bb4;
      --accent: #00f0ff;
      --accent-hover: #00c8d7;
      --accent-soft: rgba(0, 240, 255, 0.18);
      --player-a: #ff007f;
      --player-b: #00f0ff;
      --progress-bg: #211540;
      --success: #10b981;
      --warning: #f59e0b;
      --danger: #ff0055;
    }

    [data-theme="arcade"] {
      --bg: #1a0933;
      --card: #281048;
      --card-border: rgba(255, 0, 128, 0.3);
      --text: #ffffff;
      --muted: #bda3e6;
      --accent: #ff007f;
      --accent-hover: #e0006c;
      --accent-soft: rgba(255, 0, 127, 0.22);
      --player-a: #ff9900;
      --player-b: #00e5ff;
      --progress-bg: #3c186b;
      --success: #00ffcc;
      --warning: #ffcc00;
      --danger: #ff2a6d;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      user-select: none;
      -webkit-tap-highlight-color: transparent;
    }

    body {
      background-color: var(--bg);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      padding: 0.8rem;
      padding-top: 4.6rem;
      padding-bottom: 2rem;
      transition: background-color 0.4s ease, color 0.4s ease;
      overflow-x: hidden;
    }

    /* --- TOP BAR (Centralisée & Épurée) --- */
    .top-bar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      width: 100%;
      height: 56px;
      display: flex;
      justify-content: center;
      align-items: center;
      background: rgba(15, 23, 42, 0.85);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--card-border);
      z-index: 1000;
      padding: 0 1rem;
      transition: background-color 0.3s ease, border-color 0.3s ease;
    }

    .top-bar-inner {
      width: 100%;
      max-width: 900px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.5rem;
    }

    .top-bar-brand {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      cursor: pointer;
      user-select: none;
      transition: transform 0.2s ease;
      padding: 0.25rem 0.5rem;
      border-radius: 0.8rem;
    }

    .top-bar-brand:hover {
      transform: scale(1.04);
    }

    .brand-text {
      font-size: 1.25rem;
      font-weight: 900;
      letter-spacing: -0.4px;
      color: var(--text);
    }

    .top-actions {
      display: flex;
      gap: 0.4rem;
      align-items: center;
      flex-wrap: nowrap;
    }

    .icon-btn {
      background: var(--card);
      border: 1px solid var(--card-border);
      color: var(--text);
      width: 38px;
      height: 38px;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.05rem;
      transition: all 0.2s ease;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      flex-shrink: 0;
    }

    @media (max-width: 480px) {
      .top-bar {
        padding: 0 0.5rem;
        height: 52px;
      }
      .top-bar-inner {
        gap: 0.3rem;
      }
      .top-bar-brand {
        padding: 0.2rem 0.3rem;
        gap: 0.35rem;
      }
      .brand-text {
        font-size: 1.05rem;
      }
      .top-actions {
        gap: 0.22rem;
      }
      .icon-btn {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
      }
      .network-badge {
        font-size: 0.68rem;
        padding: 0.2rem 0.4rem;
        gap: 0.25rem;
      }
      .modal {
        padding: 1.1rem 0.9rem;
        max-height: 86vh;
        gap: 0.8rem;
      }
      #avatar-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.4rem;
      }
    }

    @media (min-width: 480px) {
      .icon-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
      }

      body {
        padding: 1rem;
        padding-top: 5rem;
      }
    }

    .icon-btn:hover {
      transform: scale(1.06);
      border-color: var(--accent);
      background: var(--accent-soft);
    }

    .icon-btn.active {
      background: var(--accent);
      color: white;
      border-color: var(--accent);
    }

    .container {
      background-color: var(--card);
      border: 1px solid var(--card-border);
      border-radius: 1.5rem;
      padding: 1.5rem;
      max-width: 880px;
      width: 100%;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
      display: flex;
      flex-direction: column;
      gap: 1.3rem;
      text-align: center;
      position: relative;
      margin-bottom: 2rem;
    }

    @media (min-width: 600px) {
      .container {
        padding: 2.2rem;
        gap: 1.5rem;
      }
    }

    .hub-title {
      font-size: 2.2rem;
      font-weight: 800;
      color: var(--accent);
      letter-spacing: -0.5px;
    }

    .hub-subtitle {
      color: var(--muted);
      font-size: 0.95rem;
      margin-top: 0.2rem;
    }

    /* Permanent Hub Leaderboard Card */
    .hub-leaderboard-box {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--card-border);
      border-radius: 1.2rem;
      padding: 1rem 1.4rem;
      display: flex;
      flex-direction: column;
      gap: 0.8rem;
      width: 100%;
    }

    .hub-lb-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.85rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--accent);
    }

    .hub-lb-scores {
      display: flex;
      justify-content: space-around;
      align-items: center;
      gap: 1rem;
    }

    .hub-lb-player {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.2rem;
    }

    .hub-lb-name {
      font-size: 1rem;
      font-weight: 700;
      max-width: 130px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .hub-lb-val {
      font-size: 1.8rem;
      font-weight: 800;
      line-height: 1;
    }

    .hub-lb-vs {
      font-size: 1.1rem;
      font-weight: 800;
      color: var(--muted);
    }

    /* --- HUB CONTROLS & CATEGORY FILTERING --- */
    .hub-controls {
      display: flex;
      flex-direction: column;
      gap: 1rem;
      width: 100%;
      margin: 0.2rem 0;
    }

    .hub-search-bar {
      display: flex;
      gap: 0.8rem;
      width: 100%;
      align-items: center;
      flex-wrap: wrap;
    }

    .search-input-wrapper {
      flex: 1;
      min-width: 220px;
      position: relative;
      display: flex;
      align-items: center;
    }

    .search-input-wrapper .search-icon {
      position: absolute;
      left: 1rem;
      font-size: 1.1rem;
      color: var(--muted);
      pointer-events: none;
    }

    #game-search-input {
      width: 100%;
      padding: 0.75rem 1rem 0.75rem 2.8rem;
      border-radius: 2rem;
      border: 1px solid var(--card-border);
      background: rgba(0, 0, 0, 0.25);
      color: var(--text);
      font-size: 0.95rem;
      outline: none;
      transition: all 0.2s ease;
    }

    #game-search-input:focus {
      border-color: var(--accent);
      background: rgba(0, 0, 0, 0.4);
      box-shadow: 0 0 12px var(--accent-soft);
    }

    .surprise-btn {
      background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
      color: white;
      border: none;
      padding: 0.75rem 1.4rem;
      border-radius: 2rem;
      font-weight: 700;
      font-size: 0.92rem;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.4rem;
      transition: all 0.25s ease;
      box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
      white-space: nowrap;
    }

    .surprise-btn:hover {
      transform: translateY(-2px) scale(1.03);
      box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    }

    .category-tabs-wrapper {
      display: flex;
      gap: 0.5rem;
      overflow-x: auto;
      padding: 0.3rem 0 0.6rem 0;
      width: 100%;
      scrollbar-width: thin;
      scrollbar-color: var(--accent) rgba(255, 255, 255, 0.05);
      -webkit-overflow-scrolling: touch;
    }

    .category-tabs-wrapper::-webkit-scrollbar {
      height: 6px;
      display: block;
    }

    .category-tabs-wrapper::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.05);
      border-radius: 10px;
    }

    .category-tabs-wrapper::-webkit-scrollbar-thumb {
      background: var(--accent);
      border-radius: 10px;
      box-shadow: 0 0 10px var(--accent-soft);
    }

    .category-tabs-wrapper::-webkit-scrollbar-thumb:hover {
      background: #ffffff;
    }

    .cat-tab {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--card-border);
      color: var(--muted);
      padding: 0.55rem 1.1rem;
      border-radius: 1.5rem;
      font-size: 0.88rem;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      gap: 0.35rem;
    }

    .cat-tab:hover {
      color: var(--text);
      border-color: var(--accent);
      background: var(--accent-soft);
    }

    .cat-tab.active {
      background: var(--accent);
      color: white;
      border-color: var(--accent);
      box-shadow: 0 4px 12px var(--accent-soft);
    }

    .fav-star-btn {
      position: absolute;
      top: 0.8rem;
      right: 0.8rem;
      background: transparent;
      border: none;
      color: var(--muted);
      font-size: 1.35rem;
      cursor: pointer;
      transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
      z-index: 5;
      padding: 0.2rem;
      line-height: 1;
      opacity: 0.45;
    }

    .fav-star-btn:hover,
    .game-card:hover .fav-star-btn {
      opacity: 0.9;
      transform: scale(1.1);
    }

    .fav-star-btn.active,
    .fav-star-btn.is-fav,
    .game-card.is-favorite .fav-star-btn {
      color: #fbbf24 !important;
      opacity: 1 !important;
      text-shadow: 0 0 10px rgba(251, 191, 36, 0.75), 0 0 20px rgba(245, 158, 11, 0.4);
      transform: scale(1.18);
    }

    /* --- FLUID VIEW TRANSITIONS --- */
    .view {
      display: none;
      opacity: 0;
      transform: scale(0.985);
      transition: opacity 0.28s ease, transform 0.28s ease;
    }

    .view.active {
      display: flex;
      flex-direction: column;
      gap: 1.2rem;
      opacity: 1;
      transform: scale(1);
    }

    .games-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 1.1rem;
      margin-top: 0.5rem;
      width: 100%;
    }

    .game-card {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--card-border);
      border-radius: 1.2rem;
      padding: 1.3rem;
      text-align: left;
      cursor: pointer;
      transition: transform 0.12s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      position: relative;
      transform-style: preserve-3d;
      perspective: 1000px;
      overflow: hidden;
    }

    .game-card::before,
    .uno-card::before {
      content: '';
      position: absolute;
      inset: -50%;
      background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.3) 50%, transparent 65%);
      background-size: 200% 200%;
      background-position: var(--holo-x, 50%) var(--holo-y, 50%);
      opacity: 0;
      transition: opacity 0.3s ease;
      pointer-events: none;
      border-radius: inherit;
      z-index: 3;
    }

    .game-card:hover::before,
    .uno-card:hover::before {
      opacity: 0.9;
    }

    .game-card:hover {
      border-color: var(--accent);
      background: var(--accent-soft);
      box-shadow: 0 14px 35px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-soft);
    }

    .game-card-header {
      display: flex;
      align-items: center;
      gap: 0.6rem;
    }

    .game-card-icon {
      font-size: 1.8rem;
      line-height: 1;
    }

    .game-card-title {
      font-size: 1.1rem;
      font-weight: 700;
    }

    .game-card-desc {
      font-size: 0.82rem;
      color: var(--muted);
      line-height: 1.4;
    }

    .game-card-footer {
      display: flex;
      margin-top: auto;
      padding-top: 0.4rem;
      width: 100%;
    }

    .game-card-badge {
      font-size: 0.78rem;
      font-weight: 500;
      padding: 0.4rem 0.8rem;
      border-radius: 0.8rem;
      background: var(--accent-soft);
      color: var(--accent);
      line-height: 1.4;
      width: 100%;
      text-align: left;
    }

    .game-card-count {
      font-size: 0.72rem;
      color: var(--muted);
      font-weight: 600;
      margin-top: 0.15rem;
    }

    .view {
      display: none;
      width: 100%;
      flex-direction: column;
      gap: 1.4rem;
      align-items: center;
    }

    .view.active {
      display: flex;
    }

    .lobby-connect-prompt {
      background: var(--accent-soft);
      border: 1px dashed var(--accent);
      border-radius: 1rem;
      padding: 1.1rem;
      display: flex;
      flex-direction: column;
      gap: 0.6rem;
      align-items: center;
      width: 100%;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .lobby-connect-prompt:hover {
      background: rgba(99, 102, 241, 0.25);
    }

    .progress-bar-container {
      width: 100%;
      height: 6px;
      background-color: var(--progress-bg);
      border-radius: 9999px;
      overflow: hidden;
    }

    .progress-bar {
      height: 100%;
      background: var(--accent);
      width: 0%;
      transition: width 0.3s ease;
    }

    .header-info {
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.85rem;
      font-weight: 600;
    }

    .badge-tag {
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--accent);
      font-weight: 700;
    }

    .score-badge {
      background: rgba(255, 255, 255, 0.06);
      padding: 0.3rem 0.8rem;
      border-radius: 1rem;
      font-size: 0.85rem;
      color: var(--text);
      font-weight: 700;
      border: 1px solid var(--card-border);
    }

    .turn-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.45rem 1.3rem;
      border-radius: 2rem;
      font-size: 0.9rem;
      font-weight: 600;
      background-color: var(--accent-soft);
      border: 1px solid transparent;
    }

    .turn-badge.player-a {
      color: var(--player-a);
      border-color: var(--player-a);
      background-color: rgba(56, 189, 248, 0.1);
    }

    .turn-badge.player-b {
      color: var(--player-b);
      border-color: var(--player-b);
      background-color: rgba(244, 114, 182, 0.1);
    }

    .question-box {
      min-height: 140px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      padding: 0.5rem 0;
      transition: all 0.25s ease;
    }

    .question {
      font-size: 1.35rem;
      line-height: 1.6;
      font-weight: 500;
    }

    .sub-hint {
      color: var(--muted);
      font-size: 0.9rem;
      line-height: 1.5;
    }

    .controls {
      display: flex;
      gap: 0.8rem;
      justify-content: center;
      flex-wrap: wrap;
      width: 100%;
    }

    button {
      background-color: var(--accent);
      color: white;
      border: none;
      border-radius: 0.6rem;
      padding: 0.75rem 1.4rem;
      font-size: 0.95rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
    }

    button:hover:not(:disabled) {
      background-color: var(--accent-hover);
      transform: translateY(-1px);
    }

    button:disabled {
      opacity: 0.3;
      cursor: not-allowed;
      transform: none;
    }

    .btn-secondary {
      background-color: transparent;
      border: 1px solid var(--muted);
      color: var(--text);
    }

    .btn-secondary:hover:not(:disabled) {
      background-color: rgba(255, 255, 255, 0.08);
      border-color: var(--text);
    }

    .btn-success {
      background-color: var(--success);
      color: white;
    }

    .btn-success:hover:not(:disabled) {
      background-color: #059669;
    }

    .btn-danger {
      background-color: var(--danger);
      color: white;
    }

    .btn-danger:hover:not(:disabled) {
      background-color: #dc2626;
    }

    .btn-choice {
      width: 100%;
      padding: 1.2rem;
      font-size: 1.05rem;
      line-height: 1.4;
      text-align: center;
      border-radius: 1rem;
      background: rgba(255, 255, 255, 0.04);
      border: 2px solid var(--card-border);
      color: var(--text);
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .btn-choice:hover {
      border-color: var(--accent);
      background: var(--accent-soft);
    }

    .btn-choice.selected {
      border-color: var(--accent);
      background: var(--accent);
      color: white;
    }

    .taboo-card {
      background: rgba(255, 255, 255, 0.03);
      border: 2px solid var(--accent);
      border-radius: 1.2rem;
      padding: 1.5rem;
      width: 100%;
      max-width: 440px;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    .taboo-word {
      font-size: 1.9rem;
      font-weight: 800;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: 1px;
    }

    .taboo-forbidden-list {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      background: rgba(0, 0, 0, 0.25);
      padding: 1rem;
      border-radius: 0.8rem;
    }

    .taboo-forbidden-item {
      font-size: 1.15rem;
      font-weight: 600;
      color: #ef4444;
      text-decoration: line-through;
    }

    .timer-big {
      font-size: 4rem;
      font-weight: 800;
      color: var(--accent);
      font-variant-numeric: tabular-nums;
      margin: 0.5rem 0;
    }

    .category-pills {
      display: flex;
      gap: 0.5rem;
      justify-content: center;
      flex-wrap: wrap;
    }

    .pill {
      padding: 0.45rem 1.1rem;
      border-radius: 1.5rem;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--card-border);
      font-size: 0.85rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .pill.active {
      background: var(--accent);
      color: white;
      border-color: var(--accent);
    }

    /* Wavelength Spectrum Slider & UI */
    .spectrum-container {
      width: 100%;
      max-width: 600px;
      display: flex;
      flex-direction: column;
      gap: 1.2rem;
      margin: 1rem 0;
      position: relative;
    }

    .spectrum-labels {
      display: flex;
      justify-content: space-between;
      font-size: 1.15rem;
      font-weight: 700;
      color: var(--text);
    }

    .spectrum-track {
      position: relative;
      height: 56px;
      /* Bug 4 fix: 56px for better mobile tap zone (was 48px) */
      background: rgba(255, 255, 255, 0.06);
      border: 2px solid var(--card-border);
      border-radius: 2rem;
      overflow: hidden;
      cursor: pointer;
      touch-action: none;
      /* Bug 1+2 fix: let JS fully control touch on this element */
      user-select: none;
    }

    .spectrum-target-zone {
      position: absolute;
      top: 0;
      bottom: 0;
      background: linear-gradient(90deg, #f59e0b 0%, #10b981 50%, #f59e0b 100%);
      opacity: 0.85;
      border-radius: 4px;
      transition: opacity 0.3s ease;
    }

    .spectrum-needle {
      position: absolute;
      top: -4px;
      bottom: -4px;
      width: 6px;
      background: #ffffff;
      box-shadow: 0 0 12px rgba(255, 255, 255, 0.9);
      border-radius: 3px;
      transform: translateX(-50%);
      pointer-events: none;
    }

    .wave-clue-badge {
      background: var(--accent-soft);
      border: 1px solid var(--accent);
      padding: 0.6rem 1.2rem;
      border-radius: 0.8rem;
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text);
    }

    /* Pendu UI */
    .pendu-canvas-box {
      width: 200px;
      height: 180px;
      margin: 0.5rem auto;
    }

    .pendu-word-display {
      font-size: 2.2rem;
      font-weight: 800;
      letter-spacing: 0.35em;
      color: var(--accent);
      margin: 1rem 0;
      font-family: monospace;
    }

    .keyboard-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
      gap: 0.4rem;
      width: 100%;
      max-width: 500px;
      margin: 0.5rem auto;
    }

    .key-btn {
      padding: 0.6rem 0.2rem;
      font-size: 1rem;
      font-weight: 700;
      border-radius: 0.4rem;
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid var(--card-border);
      color: var(--text);
      cursor: pointer;
    }

    .key-btn.used {
      opacity: 0.25;
      pointer-events: none;
      background: transparent;
    }

    /* Uno / Duo Cards DYNAMIQUE & RESPONSIVE */
    .uno-table {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1.4rem;
    }

    .uno-center {
      display: flex;
      gap: 2rem;
      align-items: center;
      justify-content: center;
      perspective: 800px;
    }

    .uno-card {
      width: 76px;
      height: 114px;
      border-radius: 0.85rem;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-size: 1.4rem;
      font-weight: 900;
      color: white;
      box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
      cursor: pointer;
      position: relative;
      transition: transform 0.12s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.25s ease, border-color 0.25s ease;
      border: 3px solid rgba(255, 255, 255, 0.9);
      flex-shrink: 0;
      transform-style: preserve-3d;
      overflow: hidden;
    }

    .uno-card.playable {
      transform: translateY(-8px);
      border-color: #38bdf8;
      box-shadow: 0 0 18px rgba(56, 189, 248, 0.7);
      animation: unoPulse 1.6s infinite ease-in-out;
    }

    @keyframes unoPulse {

      0%,
      100% {
        transform: translateY(-8px) scale(1);
      }

      50% {
        transform: translateY(-12px) scale(1.04);
      }
    }

    .uno-card.disabled {
      opacity: 0.45;
      cursor: not-allowed;
      transform: none;
    }

    .uno-card.red {
      background: linear-gradient(135deg, #ef4444, #dc2626);
    }

    .uno-card.blue {
      background: linear-gradient(135deg, #3b82f6, #2563eb);
    }

    .uno-card.green {
      background: linear-gradient(135deg, #10b981, #059669);
    }

    .uno-card.yellow {
      background: linear-gradient(135deg, #f59e0b, #d97706);
    }

    .uno-card.wild {
      background: linear-gradient(135deg, #ef4444, #3b82f6, #10b981, #f59e0b);
    }

    .uno-card.back {
      background: linear-gradient(135deg, #1e293b, #0f172a);
      border-color: var(--accent);
    }

    .uno-hand {
      display: flex;
      gap: 0.4rem;
      overflow-x: auto;
      max-width: 100%;
      padding: 0.8rem 0.5rem;
      justify-content: flex-start;
      scrollbar-width: thin;
    }

    .uno-color-picker {
      display: flex;
      gap: 0.8rem;
      justify-content: center;
      margin-top: 0.5rem;
    }

    /* Opponent deck (face-down cards) */
    .uno-opponent-area {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 0.5rem;
    }

    .uno-opponent-deck {
      display: flex;
      align-items: flex-end;
      justify-content: center;
      position: relative;
      height: 64px;
      min-width: 60px;
    }

    .uno-card-back {
      width: 38px;
      height: 56px;
      border-radius: 0.5rem;
      background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
      border: 2px solid rgba(255, 255, 255, 0.2);
      position: absolute;
      left: calc(var(--i) * 14px);
      box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
    }

    .uno-card-back::after {
      content: '🎴';
    }

    .uno-opponent-count {
      font-size: 0.82rem;
      font-weight: 700;
      color: var(--muted);
      margin-top: 0.3rem;
    }

    /* Special card animation overlay */
    #uno-special-overlay {
      display: none;
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.55);
      border-radius: 1.4rem;
      z-index: 20;
      align-items: center;
      justify-content: center;
      pointer-events: none;
    }

    .uno-special-anim {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.5rem;
      animation: specialPop 1.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }

    .uno-special-icon {
      font-size: 4rem;
      filter: drop-shadow(0 0 12px rgba(255, 200, 0, 0.9));
    }

    .uno-special-label {
      font-size: 1.3rem;
      font-weight: 800;
      color: #fff;
      text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
      letter-spacing: 0.05em;
    }

    @keyframes specialPop {
      0% {
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
      }

      40% {
        transform: scale(1.15) rotate(3deg);
        opacity: 1;
      }

      70% {
        transform: scale(1.0) rotate(0deg);
        opacity: 1;
      }

      100% {
        transform: scale(1.05) rotate(0deg);
        opacity: 0;
      }
    }

    /* EP correct answer reveal */
    .ep-correct-reveal {
      display: none;
      width: 100%;
      max-width: 440px;
      padding: 0.75rem 1rem;
      border-radius: 0.8rem;
      background: rgba(16, 185, 129, 0.12);
      border: 1px solid var(--success);
      color: var(--success);
      font-size: 0.95rem;
      font-weight: 700;
      text-align: center;
      margin: 0.4rem auto 0;
    }

    .color-pick-btn {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      cursor: pointer;
      border: 3px solid white;
      transition: transform 0.2s ease;
    }

    .color-pick-btn:hover {
      transform: scale(1.15);
    }

    /* Direct Theme Palette Grid in Modal */
    .theme-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.8rem;
      margin: 0.5rem 0;
    }

    .theme-card-option {
      border-radius: 0.8rem;
      padding: 1rem;
      border: 2px solid var(--card-border);
      cursor: pointer;
      font-weight: 700;
      font-size: 0.95rem;
      transition: all 0.2s ease;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.4rem;
    }

    .theme-card-option:hover {
      border-color: var(--accent);
      transform: scale(1.03);
    }

    .theme-card-option.active {
      border-color: var(--accent);
      background: var(--accent-soft);
    }

    /* Modals & Helpers */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.78);
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 2000;
      padding: 0.8rem;
      box-sizing: border-box;
    }

    .modal {
      background: var(--card);
      border: 1px solid var(--card-border);
      border-radius: 1.2rem;
      padding: 1.4rem;
      max-width: 500px;
      max-height: 88vh;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      width: 100%;
      text-align: center;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
      box-sizing: border-box;
    }

    /* Bug 3 fix: prevent iOS auto-zoom on any input (requires font-size >= 16px) */
    input,
    select,
    textarea {
      font-size: 1rem;
    }

    .modal input,
    .modal select {
      padding: 0.8rem 1rem;
      border-radius: 0.5rem;
      border: 1px solid var(--muted);
      background: transparent;
      color: var(--text);
      font-size: 1rem;
      text-align: center;
    }

    .peer-badge {
      font-size: 0.85rem;
      color: var(--player-a);
      word-break: break-all;
      background: rgba(0, 0, 0, 0.2);
      padding: 0.6rem;
      border-radius: 0.4rem;
    }

    #qrcode-container {
      display: flex;
      justify-content: center;
      margin: 0.8rem auto;
      padding: 10px;
      background: white;
      border-radius: 0.6rem;
      width: 170px;
      height: 170px;
    }

    .result-comparison {
      display: flex;
      justify-content: space-around;
      width: 100%;
      gap: 1rem;
      margin: 1rem 0;
    }

    .player-result-box {
      flex: 1;
      padding: 1rem;
      border-radius: 0.8rem;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--card-border);
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .player-result-box.match {
      border-color: var(--success);
      background: rgba(16, 185, 129, 0.1);
    }

    .souvenir-card {
      background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
      border: 2px solid var(--accent);
      border-radius: 1rem;
      padding: 1.5rem;
      margin-top: 1rem;
      text-align: center;
      color: #f8fafc;
      width: 100%;
    }

    .network-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      font-size: 0.75rem;
      font-weight: 600;
      padding: 0.25rem 0.6rem;
      border-radius: 1rem;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--card-border);
      flex-shrink: 0;
    }

    .network-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #ef4444;
    }

    .network-dot.online {
      background: var(--success);
    }

    .asym-guesser-box {
      background: rgba(255, 255, 255, 0.03);
      border: 2px dashed var(--accent);
      border-radius: 1.2rem;
      padding: 2rem 1.5rem;
      width: 100%;
      max-width: 440px;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      align-items: center;
    }

    /* Floating Reactions Anim */

    .floating-reaction {
      position: fixed;
      font-size: 3rem;
      pointer-events: none;
      z-index: 9999;
      animation: floatUp 2.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
      user-select: none;
    }

    @keyframes floatUp {
      0% {
        transform: translateY(0) translateX(0) scale(0.3);
        opacity: 0;
      }

      10% {
        opacity: 1;
        transform: translateY(-50px) translateX(0) scale(1.1);
      }

      100% {
        transform: translateY(-500px) translateX(var(--drift)) scale(1.5);
        opacity: 0;
      }
    }

    /* Doodle Overlay Styles */
    .doodle-toolbar {
      position: fixed;
      top: 15px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(15, 23, 42, 0.94);
      backdrop-filter: blur(16px);
      border: 1px solid var(--accent);
      border-radius: 2rem;
      padding: 0.4rem 1rem;
      display: flex;
      align-items: center;
      gap: 0.8rem;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px var(--accent-soft);
      z-index: 9995;
      animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .doodle-col-btn {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      border: 2px solid transparent;
      cursor: pointer;
      transition: transform 0.2s ease;
    }

    .doodle-col-btn.active {
      border-color: #ffffff;
      transform: scale(1.25);
    }

    .doodle-action-btn {
      background: rgba(255, 255, 255, 0.1);
      border: 1px solid var(--card-border);
      color: #fff;
      border-radius: 50%;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 0.9rem;
      transition: all 0.2s ease;
    }

    .doodle-action-btn:hover {
      background: var(--accent-soft);
      transform: scale(1.1);
    }

    /* Animated Avatars System */
    .avatar-badge {
      width: 46px;
      height: 46px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 1.6rem;
      background: rgba(255, 255, 255, 0.08);
      border: 2px solid var(--accent);
      box-shadow: 0 0 12px var(--accent-soft);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      animation: avatarFloat 3s ease-in-out infinite;
      margin-bottom: 0.3rem;
      user-select: none;
    }

    @keyframes avatarFloat {

      0%,
      100% {
        transform: translateY(0);
      }

      50% {
        transform: translateY(-5px);
      }
    }

    .avatar-badge.victory {
      animation: avatarVictory 0.6s ease infinite alternate !important;
    }

    @keyframes avatarVictory {
      0% {
        transform: translateY(0) scale(1);
      }

      100% {
        transform: translateY(-10px) scale(1.25);
      }
    }

    .avatar-badge.defeat {
      animation: avatarDefeat 0.5s ease !important;
    }

    @keyframes avatarDefeat {

      0%,
      100% {
        transform: rotate(0deg);
      }

      25% {
        transform: rotate(-15deg);
      }

      75% {
        transform: rotate(15deg);
      }
    }

    .avatar-option-btn {
      font-size: 1.5rem;
      padding: 0.4rem;
      border-radius: 0.6rem;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--card-border);
      cursor: pointer;
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .avatar-option-btn:hover {
      transform: scale(1.15);
      background: rgba(255, 255, 255, 0.12);
    }

    .avatar-option-btn.active {
      background: var(--accent-soft);
      border-color: var(--accent);
      box-shadow: 0 0 10px var(--accent-soft);
      transform: scale(1.18);
    }

    .avatar-color-dot {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      cursor: pointer;
      border: 2px solid transparent;
      transition: transform 0.2s ease;
    }

    .avatar-color-dot.active {
      border-color: #ffffff;
      transform: scale(1.2);
    }

    /* --- Quick Reactions Popover (Sous le bouton 😀 du Header) --- */
    .reactions-popover-container {
      position: relative;
    }

    .quick-reactions-popover {
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      background: var(--card);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid var(--card-border);
      border-radius: 2rem;
      padding: 0.35rem 0.6rem;
      display: flex;
      gap: 0.35rem;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
      opacity: 0;
      pointer-events: none;
      transform: translateY(-6px) scale(0.92);
      transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
      z-index: 1100;
    }

    .quick-reactions-popover.active {
      opacity: 1;
      pointer-events: auto;
      transform: translateY(0) scale(1);
    }

    .quick-reactions-popover button {
      background: transparent;
      border: none;
      font-size: 1.35rem;
      cursor: pointer;
      padding: 0.2rem 0.25rem;
      line-height: 1;
      transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .quick-reactions-popover button:hover {
      transform: scale(1.3);
    }

    .quick-reactions-popover button:active {
      transform: scale(0.9);
    }

    /* --- Responsive Avatar Grid & Color Picker --- */
    .avatar-grid-responsive {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
      gap: 0.4rem;
      justify-content: center;
      margin-bottom: 0.8rem;
    }

    .avatar-color-picker-responsive {
      display: flex;
      flex-wrap: wrap;
      gap: 0.45rem;
      justify-content: center;
    }

    .modal-sticky-footer {
      display: flex;
      gap: 0.5rem;
      margin-top: 1rem;
      padding-top: 0.6rem;
      border-top: 1px solid var(--card-border);
      position: sticky;
      bottom: 0;
      background: var(--card);
      z-index: 10;
    }

    /* --- TUSMO 1V1 (MOTUS DUEL) --- */
    .tusmo-arena {
      display: flex;
      gap: 1.2rem;
      align-items: flex-start;
      justify-content: center;
      width: 100%;
    }

    .tusmo-main-board {
      flex: 1;
      display: flex;
      justify-content: center;
    }

    .tusmo-grid-container {
      display: flex;
      flex-direction: column;
      gap: 5px;
      align-items: center;
      justify-content: center;
    }

    .tusmo-row {
      display: flex;
      gap: 5px;
      justify-content: center;
    }

    .tusmo-cell {
      width: 44px;
      height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.4rem;
      font-weight: 900;
      color: #ffffff;
      background: rgba(30, 41, 59, 0.85);
      border: 2px solid rgba(255, 255, 255, 0.16);
      border-radius: 8px;
      text-transform: uppercase;
      user-select: none;
      transition: transform 0.12s ease, background-color 0.2s ease, border-color 0.2s ease;
    }

    .tusmo-cell.filled {
      border-color: rgba(255, 255, 255, 0.45);
      transform: scale(1.04);
    }

    .tusmo-cell.revealed-hint {
      color: #38bdf8;
      border-color: rgba(56, 189, 248, 0.4);
    }

    .tusmo-cell.correct {
      background: #e11d48 !important;
      border-color: #f43f5e !important;
      color: #ffffff !important;
      box-shadow: 0 0 12px rgba(225, 29, 72, 0.6);
    }

    .tusmo-cell.present {
      background: #eab308 !important;
      border-color: #fde047 !important;
      color: #0f172a !important;
      border-radius: 50% !important;
      box-shadow: 0 0 12px rgba(234, 179, 8, 0.55);
    }

    .tusmo-cell.absent {
      background: #0f172a !important;
      border-color: rgba(255, 255, 255, 0.08) !important;
      color: #64748b !important;
      opacity: 0.65;
    }

    @keyframes tusmoFlip {
      0% { transform: scaleY(1); }
      50% { transform: scaleY(0); }
      100% { transform: scaleY(1); }
    }

    .tusmo-cell.flip {
      animation: tusmoFlip 0.35s ease forwards;
    }

    .tusmo-opp-section {
      background: rgba(15, 23, 42, 0.65);
      border: 1px solid var(--card-border);
      border-radius: 0.8rem;
      padding: 0.5rem 0.7rem;
      min-width: 120px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.3rem;
    }

    .tusmo-opp-title {
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .tusmo-opp-grid {
      display: flex;
      flex-direction: column;
      gap: 3px;
      align-items: center;
      margin: 0.2rem 0;
    }

    .tusmo-opp-row {
      display: flex;
      gap: 3px;
    }

    .tusmo-opp-cell {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.12);
    }

    .tusmo-opp-cell.correct {
      background: #e11d48 !important;
      border-color: #f43f5e !important;
    }

    .tusmo-opp-cell.present {
      background: #eab308 !important;
      border-color: #fde047 !important;
      border-radius: 50% !important;
    }

    .tusmo-opp-cell.absent {
      background: #334155 !important;
      border-color: transparent !important;
    }

    .tusmo-opp-status {
      font-size: 0.72rem;
      color: var(--muted);
      font-weight: 600;
    }

    .tusmo-alert {
      background: rgba(239, 68, 68, 0.15);
      border: 1px solid var(--danger);
      color: #fca5a5;
      padding: 0.35rem 0.8rem;
      border-radius: 0.6rem;
      font-weight: 700;
      font-size: 0.85rem;
    }

    .tusmo-keyboard {
      display: flex;
      flex-direction: column;
      gap: 4px;
      align-items: center;
      width: 100%;
      max-width: 480px;
      margin: 0.2rem auto 0;
      user-select: none;
    }

    .tusmo-kb-row {
      display: flex;
      gap: 4px;
      justify-content: center;
      width: 100%;
    }

    .tusmo-key {
      flex: 1;
      max-width: 40px;
      height: 42px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.95rem;
      font-weight: 700;
      color: var(--text);
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid var(--card-border);
      border-radius: 6px;
      cursor: pointer;
      user-select: none;
      transition: all 0.12s ease;
    }

    .tusmo-key:hover {
      background: rgba(255, 255, 255, 0.16);
      transform: scale(1.08);
    }

    .tusmo-key:active {
      transform: scale(0.92);
    }

    .tusmo-key.wide {
      flex: 1.6;
      max-width: 60px;
      font-size: 0.82rem;
    }

    .tusmo-key.correct {
      background: #e11d48 !important;
      color: #ffffff !important;
      border-color: #f43f5e !important;
    }

    .tusmo-key.present {
      background: #eab308 !important;
      color: #0f172a !important;
      border-color: #fde047 !important;
    }

    .tusmo-key.absent {
      background: rgba(15, 23, 42, 0.9) !important;
      color: #475569 !important;
      opacity: 0.45;
      border-color: transparent !important;
    }

    @media (max-width: 480px) {
      .tusmo-arena {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
      }
      .tusmo-opp-section {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        padding: 0.35rem 0.6rem;
      }
      .tusmo-opp-grid {
        flex-direction: row;
        gap: 2px;
      }
      .tusmo-opp-row {
        flex-direction: column;
        gap: 2px;
      }
      .tusmo-cell {
        width: 36px;
        height: 36px;
        font-size: 1.15rem;
      }
      .tusmo-key {
        height: 38px;
        font-size: 0.85rem;
      }
      .tusmo-key.wide {
        font-size: 0.75rem;
      }
    }