    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg:      #0d0b1a;
      --surface: #1c1636;
      --border:  #2d2854;
      --accent:  #7c3aed;
      --accent2: #a855f7;
      --text:    #f0ecff;
      --muted:   #8b82b5;
      --danger:  #ef4444;
      --success: #22c55e;
      --yt:      #ff0000;
      --radius:  14px;
      --glow:    rgba(124, 58, 237, 0.3);
      --font-display: 'Fredoka', 'Arial Rounded MT Bold', sans-serif;
      --font-body:    'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    html, body {
      height: 100%;
      font-family: var(--font-body);
      background: var(--bg);
      color: var(--text);
    }

    body {
      display: flex;
      flex-direction: column;
      min-height: 100vh;
      min-height: 100dvh;
      overflow: hidden;
      background: radial-gradient(ellipse at 50% 20%, #1e1245 0%, #120e2a 45%, #0a0816 100%);
    }

    /* ── Header ───────────────────────────── */
    header {
      background: linear-gradient(180deg, rgba(30, 18, 69, 0.95), rgba(21, 16, 48, 0.95));
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-bottom: 1px solid rgba(255,255,255,0.06);
      box-shadow: 0 2px 20px rgba(0,0,0,0.3);
      padding: 12px 14px 0;
      position: sticky;
      top: 0;
      z-index: 100;
      display: flex;
      flex-direction: column;
      gap: 10px;
      flex-shrink: 0;
    }

    .header-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    header h1 {
      font-family: var(--font-display);
      font-size: 1.1rem;
      font-weight: 700;
      letter-spacing: 1px;
      background: linear-gradient(135deg, var(--accent2), #ec4899);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      white-space: nowrap;
      flex: 1;
      filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    }

    /* ── Header profile avatar ───────────────── */
    .header-avatar {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: var(--bg);
      border: 2px solid var(--border);
      overflow: hidden;
      cursor: pointer;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--muted);
      transition: border-color 0.15s;
    }
    .header-avatar:hover { border-color: var(--accent2); box-shadow: 0 0 12px var(--glow); }
    .header-avatar img { width: 100%; height: 100%; object-fit: cover; }

    /* ── Footer bar ──────────────────────────── */
    .app-footer {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: linear-gradient(180deg, rgba(28, 22, 54, 0.95), rgba(13, 11, 26, 0.98));
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-top: 1px solid rgba(255,255,255,0.06);
      padding: 8px 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      height: 44px;
      z-index: 100;
    }


    /* ── YT Now Playing (footer) ─────────────── */
    #yt-footer-np {
      display: flex;
      align-items: center;
      gap: 7px;
      background: rgba(255,0,0,0.1);
      border: 1px solid rgba(255,0,0,0.25);
      border-radius: 20px;
      padding: 4px 12px 4px 9px;
      min-width: 0;
      flex: 1;
      max-width: 260px;
    }

    .yt-fnp-dot {
      color: #ff0000;
      font-size: 0.65rem;
      flex-shrink: 0;
    }

    .yt-fnp-info { min-width: 0; flex: 1; }

    .yt-fnp-label {
      display: block;
      font-size: 0.58rem;
      color: #ff0000;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .yt-fnp-title {
      display: block;
      font-size: 0.74rem;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .yt-fnp-title.scrolling {
      text-overflow: clip;
      mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
      -webkit-mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
    }

    .yt-fnp-title.scrolling .scroll-inner {
      display: inline-block;
      animation: marquee var(--scroll-dur, 10s) linear infinite;
    }

    @keyframes marquee {
      0%   { transform: translateX(0); }
      100% { transform: translateX(-50%); }
    }

    .footer-coins {
      display: flex;
      align-items: center;
      gap: 5px;
      flex-shrink: 0;
    }

    .footer-coins-amount {
      font-size: 0.95rem;
      font-weight: 800;
      color: #eab308;
    }

    .coin-icon {
      flex-shrink: 0;
    }

    /* ── Tab bar ──────────────────────────── */
    .tab-bar {
      display: flex;
      gap: 4px;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;          /* Firefox */
      -ms-overflow-style: none;       /* IE/Edge */
      padding: 4px 0 8px;
    }
    .tab-bar::-webkit-scrollbar { display: none; } /* Chrome/Safari */

    .tab-btn {
      flex: 0 0 auto;
      white-space: nowrap;
      background: rgba(255,255,255,0.04);
      border: 1px solid transparent;
      border-radius: 10px;
      color: var(--muted);
      font-family: var(--font-display);
      font-size: 0.8rem;
      font-weight: 600;
      padding: 7px 13px;
      cursor: pointer;
      transition: all 0.25s var(--spring);
      letter-spacing: 0.02em;
    }

    .tab-btn:hover {
      color: var(--text);
      background: rgba(255,255,255,0.08);
    }

    .tab-btn.active {
      color: #fff;
      background: linear-gradient(135deg, var(--accent), var(--accent2));
      border-color: transparent;
      box-shadow: 0 2px 12px var(--glow);
    }

    /* ── Main content area (between header & footer) ── */
    .main-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
      padding-bottom: 44px;
    }

    /* ── Tab panels ───────────────────────── */
    .tab-panel {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }

    .tab-panel[hidden] { display: none !important; }

    /* ── Search bar ───────────────────────── */
    .search-wrap {
      display: flex;
      gap: 8px;
      padding: 12px 14px;
      flex-shrink: 0;
      background: linear-gradient(180deg, rgba(30, 18, 69, 0.9), rgba(28, 22, 54, 0.8));
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    .search-input {
      flex: 1;
      background: rgba(13, 11, 26, 0.8);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-family: var(--font-body);
      font-size: 16px;
      padding: 11px 14px;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .search-input:focus { border-color: var(--accent); box-shadow: 0 0 12px rgba(124, 58, 237, 0.2); }
    .search-input::placeholder { color: var(--muted); }

    .btn {
      cursor: pointer;
      border: none;
      border-radius: var(--radius);
      font-family: var(--font-display);
      font-size: 0.9rem;
      font-weight: 600;
      padding: 11px 18px;
      transition: all 0.2s var(--spring);
      white-space: nowrap;
      min-height: 44px;
    }
    .btn:active { transform: scale(0.95); }
    .btn-primary {
      background: linear-gradient(135deg, var(--accent), var(--accent2));
      color: #fff;
      box-shadow: 0 4px 16px var(--glow);
    }
    .btn-primary:hover { box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5); transform: translateY(-1px); }
    .btn-danger  { background: linear-gradient(135deg, var(--danger), #dc2626); color: #fff; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
    .btn-yt      { background: var(--yt); color: #fff; box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3); }

    /* ── Banners ──────────────────────────── */
    #disabled-banner {
      display: none;
      background: var(--danger);
      color: #fff;
      text-align: center;
      padding: 10px 14px;
      font-size: 0.88rem;
      font-weight: 700;
      letter-spacing: 0.03em;
      flex-shrink: 0;
    }

    #party-banner {
      display: none;
      background: #f59e0b;
      color: #000;
      text-align: center;
      padding: 8px 14px;
      font-size: 0.88rem;
      font-weight: 700;
      letter-spacing: 0.03em;
      flex-shrink: 0;
    }

    body.is-disabled #gif-grid {
      opacity: 0.35;
      pointer-events: none;
    }


    /* ── GIF Grid ─────────────────────────── */
    #gif-grid-wrap {
      flex: 1;
      overflow-y: auto;
      padding: 12px;
      -webkit-overflow-scrolling: touch;
    }

    #grid-label {
      font-family: var(--font-display);
      font-size: 0.72rem;
      color: var(--muted);
      margin-bottom: 10px;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      font-weight: 700;
    }

    #gif-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
    }

    @media (min-width: 480px) { #gif-grid { grid-template-columns: repeat(4, 1fr); } }
    @media (min-width: 700px) { #gif-grid { grid-template-columns: repeat(5, 1fr); } }

    .gif-card {
      border-radius: 12px;
      overflow: hidden;
      cursor: pointer;
      position: relative;
      background: rgba(28, 22, 54, 0.7);
      aspect-ratio: 1;
      border: 2px solid transparent;
      transition: all 0.2s var(--spring);
      -webkit-tap-highlight-color: transparent;
    }

    .gif-card:hover { transform: scale(1.04); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
    .gif-card:active { transform: scale(0.97); }
    .gif-card.active { border-color: var(--success); box-shadow: 0 0 12px rgba(34, 197, 94, 0.3); }
    .gif-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

    #status-msg {
      grid-column: 1 / -1;
      text-align: center;
      color: var(--muted);
      padding: 48px 0;
      font-size: 0.95rem;
    }

    .spinner {
      display: inline-block;
      width: 22px;
      height: 22px;
      border: 3px solid var(--border);
      border-top-color: var(--accent2);
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
      vertical-align: middle;
      margin-right: 8px;
    }

    @keyframes spin { to { transform: rotate(360deg); } }

    @keyframes postPopIn {
      0% { transform: translateY(16px) scale(0.97); opacity: 0; }
      100% { transform: translateY(0) scale(1); opacity: 1; }
    }

    @keyframes popIn {
      0%   { transform: scale(0.9); opacity: 0; }
      60%  { transform: scale(1.02); opacity: 1; }
      100% { transform: scale(1); opacity: 1; }
    }

    .giphy-attr {
      text-align: center;
      padding: 12px;
      font-size: 0.7rem;
      color: var(--muted);
    }

    .yt-search-wrap {
      display: flex;
      gap: 8px;
      padding: 12px 14px;
      flex-shrink: 0;
      background: linear-gradient(180deg, rgba(30, 18, 69, 0.9), rgba(28, 22, 54, 0.8));
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-bottom: 1px solid rgba(255,255,255,0.06);
    }


    /* ── Music sub-tabs ───────────────────── */
    .yt-sub-tab-bar {
      display: flex;
      background: linear-gradient(180deg, rgba(28, 22, 54, 0.8), rgba(28, 22, 54, 0.6));
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-bottom: 1px solid rgba(255,255,255,0.06);
      flex-shrink: 0;
      gap: 2px;
      padding: 4px 8px;
    }

    .yt-sub-tab {
      flex: 1;
      background: none;
      border: none;
      border-radius: 8px;
      color: var(--muted);
      font-family: var(--font-display);
      font-size: 0.82rem;
      font-weight: 600;
      padding: 8px 12px;
      cursor: pointer;
      transition: all 0.2s var(--spring);
    }
    .yt-sub-tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }

    .yt-sub-tab.active {
      color: var(--yt);
      background: rgba(255, 0, 0, 0.1);
      box-shadow: 0 0 8px rgba(255, 0, 0, 0.15);
    }

    /* ── YouTube Results ──────────────────── */
    #yt-results-panel,
    #yt-queue-panel,
    #yt-history-panel,
    #yt-favorites-panel {
      flex: 1;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    #yt-results-panel[hidden],
    #yt-queue-panel[hidden],
    #yt-history-panel[hidden],
    #yt-favorites-panel[hidden] { display: none; }

    /* ── Music item action buttons ─────────── */
    .yt-item-actions {
      display: flex;
      gap: 6px;
      align-items: center;
      flex-shrink: 0;
      margin-left: auto;
    }
    .yt-item-actions button {
      background: none;
      border: 1px solid var(--border);
      border-radius: 6px;
      color: var(--muted);
      cursor: pointer;
      padding: 4px 8px;
      font-size: 0.78rem;
      transition: color 0.15s, border-color 0.15s;
      display: flex;
      align-items: center;
      gap: 3px;
    }
    .yt-item-actions button:hover { color: var(--text); border-color: var(--text); }
    .yt-item-actions button.yt-fav-active { color: #ff4d6d; border-color: #ff4d6d; }
    .yt-item-actions .yt-link-btn:hover { color: var(--yt); border-color: var(--yt); }
    .yt-item-actions .yt-add-btn:hover { color: var(--success); border-color: var(--success); }
    .yt-history-time {
      font-size: 0.7rem;
      color: var(--muted);
      margin-top: 2px;
    }

    .yt-results-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      padding: 12px;
    }

    @media (min-width: 480px) { .yt-results-grid { grid-template-columns: repeat(3, 1fr); } }
    @media (min-width: 700px) { .yt-results-grid { grid-template-columns: repeat(4, 1fr); } }

    .yt-video-card {
      background: rgba(28, 22, 54, 0.7);
      border-radius: 14px;
      overflow: hidden;
      cursor: pointer;
      border: 1px solid rgba(255,255,255,0.06);
      transition: all 0.25s var(--spring);
      -webkit-tap-highlight-color: transparent;
      display: flex;
      flex-direction: column;
    }

    .yt-video-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); border-color: rgba(255,255,255,0.12); }
    .yt-video-card:active { transform: scale(0.97); }

    .yt-video-card .thumb-wrap {
      position: relative;
      aspect-ratio: 16/9;
      background: var(--border);
      overflow: hidden;
    }

    .yt-video-card .thumb-wrap img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .yt-video-card .add-overlay {
      position: absolute;
      inset: 0;
      background: rgba(0,0,0,0.55);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: opacity 0.15s;
    }

    .yt-video-card:hover .add-overlay { opacity: 1; }

    .add-overlay span {
      background: var(--yt);
      color: #fff;
      font-size: 0.75rem;
      font-weight: 700;
      padding: 4px 10px;
      border-radius: 4px;
    }

    .yt-video-card .yt-card-info {
      padding: 7px 8px 9px;
      flex: 1;
    }

    .yt-video-card .yt-card-title {
      font-size: 0.78rem;
      color: var(--text);
      line-height: 1.35;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .yt-video-card .yt-card-channel {
      font-size: 0.68rem;
      color: var(--muted);
      margin-top: 3px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .yt-status-msg {
      text-align: center;
      color: var(--muted);
      padding: 48px 16px;
      font-size: 0.95rem;
    }

    /* ── Queue list ───────────────────────── */
    .yt-queue-list {
      padding: 10px 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .yt-queue-item {
      display: flex;
      align-items: center;
      gap: 10px;
      background: rgba(28, 22, 54, 0.7);
      border: 1px solid rgba(255,255,255,0.06);
      border-radius: 12px;
      padding: 10px 12px;
      transition: all 0.2s ease;
    }
    .yt-queue-item:hover { background: rgba(28, 22, 54, 0.9); }

    .yt-queue-pos {
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--muted);
      min-width: 18px;
      text-align: center;
      flex-shrink: 0;
    }

    .yt-queue-thumb {
      width: 64px;
      height: 36px;
      border-radius: 5px;
      object-fit: cover;
      background: var(--border);
      flex-shrink: 0;
    }

    .yt-queue-info { flex: 1; min-width: 0; }

    .yt-queue-title {
      font-size: 0.82rem;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .yt-queue-channel {
      font-size: 0.7rem;
      color: var(--muted);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .yt-queue-requester { font-size: 0.72rem; color: var(--accent); margin-top: 1px; }

    .yt-queue-now {
      font-size: 0.65rem;
      font-weight: 700;
      color: var(--yt);
      border: 1px solid var(--yt);
      border-radius: 4px;
      padding: 2px 5px;
      flex-shrink: 0;
    }

    /* ── Toast ────────────────────────────── */
    #toast {
      position: fixed;
      bottom: 60px;
      left: 50%;
      transform: translateX(-50%) translateY(12px);
      background: rgba(28, 22, 54, 0.92);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 20px;
      padding: 10px 22px;
      font-family: var(--font-display);
      font-size: 0.88rem;
      color: var(--text);
      box-shadow: 0 8px 24px rgba(0,0,0,0.4);
      opacity: 0;
      transition: opacity 0.3s, transform 0.3s var(--spring);
      pointer-events: none;
      z-index: 999;
      white-space: nowrap;
    }

    #toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    /* ── Speak Tab ──────────────────────────── */
    .speak-compose {
      max-width: 500px;
      margin: 24px auto;
      padding: 0 16px;
    }

    .speak-preview {
      display: flex;
      justify-content: center;
      padding: 24px 0;
    }

    .speak-preview-bubble {
      --bubble-bg: #FFE66D;
      --bubble-border: #E8B800;
      background: var(--bubble-bg);
      border: 3px solid var(--bubble-border);
      border-radius: 24px;
      padding: 16px 24px;
      color: #333;
      font-size: 1.05rem;
      font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', cursive;
      font-weight: 700;
      line-height: 1.4;
      max-width: 340px;
      word-wrap: break-word;
      position: relative;
      min-height: 44px;
      box-shadow: 4px 5px 0 rgba(232,184,0,0.3);
      transform: rotate(-1deg);
      transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
    }

    .speak-preview-bubble::before {
      content: '';
      position: absolute;
      bottom: -16px;
      left: 22px;
      border: 9px solid transparent;
      border-top: 16px solid var(--bubble-border);
      border-bottom: 0;
    }
    .speak-preview-bubble::after {
      content: '';
      position: absolute;
      bottom: -11px;
      left: 24px;
      border: 7px solid transparent;
      border-top: 13px solid var(--bubble-bg);
      border-bottom: 0;
    }

    #speak-input {
      width: 100%;
      background: rgba(28, 22, 54, 0.8);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-size: 0.95rem;
      padding: 12px 14px;
      outline: none;
      resize: none;
      font-family: inherit;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    #speak-input:focus { border-color: var(--accent); box-shadow: 0 0 12px rgba(124, 58, 237, 0.2); }
    #speak-input::placeholder { color: var(--muted); }

    .speak-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 10px;
    }

    .speak-char-count {
      font-size: 0.78rem;
      color: var(--muted);
    }

    .btn-speak {
      background: linear-gradient(135deg, var(--accent), var(--accent2));
      color: #fff;
      cursor: pointer;
      border: none;
      border-radius: var(--radius);
      font-family: var(--font-display);
      font-size: 0.88rem;
      font-weight: 600;
      padding: 9px 20px;
      transition: all 0.2s var(--spring);
      box-shadow: 0 4px 12px var(--glow);
    }
    .btn-speak:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4); }
    .btn-speak:disabled { opacity: 0.4; cursor: default; transform: none; box-shadow: none; }

    .speak-color-picker {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 12px;
    }
    .speak-color-label {
      font-size: 0.82rem;
      color: var(--muted);
      white-space: nowrap;
    }
    .speak-color-swatches {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }
    .speak-color-swatch {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      border: 3px solid transparent;
      cursor: pointer;
      transition: all 0.2s var(--spring);
    }
    .speak-color-swatch:hover { transform: scale(1.2); box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
    .speak-color-swatch.active { border-color: #fff; transform: scale(1.2); box-shadow: 0 0 12px rgba(255,255,255,0.2); }

    /* ── Games Tab Button ─────────────────── */
    .tab-btn[data-tab="games"] {
      font-weight: 800;
    }
    .tab-btn[data-tab="games"]:not(.active) {
      background: linear-gradient(135deg, #ef4444, #eab308, #22c55e, #3b82f6);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }
    .tab-btn[data-tab="games"].active {
      background: linear-gradient(135deg, #ef4444, #eab308, #22c55e, #3b82f6);
      -webkit-background-clip: initial;
      -webkit-text-fill-color: #fff;
      background-clip: initial;
      border-color: transparent;
      box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
    }

    /* ── Games Picker ────────────────────── */
    .games-picker {
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding: 16px;
    }
    .games-picker-card {
      display: flex;
      align-items: center;
      gap: 14px;
      background: rgba(28, 22, 54, 0.7);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 16px;
      padding: 18px 20px;
      cursor: pointer;
      transition: all 0.25s var(--spring);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }
    .games-picker-card:hover {
      transform: translateY(-3px) scale(1.02);
      border-color: rgba(255,255,255,0.15);
      box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 0 20px var(--glow);
    }
    .games-picker-card:active { transform: scale(0.98); }
    .games-picker-icon {
      width: 48px;
      height: 48px;
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-display);
      font-weight: 900;
      font-size: 14px;
      color: #fff;
      flex-shrink: 0;
      letter-spacing: 0.04em;
      box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    .games-picker-card span {
      font-family: var(--font-display);
      font-weight: 700;
      font-size: 15px;
      color: var(--text);
    }
    .games-back-btn {
      background: none;
      border: none;
      color: var(--accent2);
      font-family: var(--font-display);
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      padding: 10px 16px 4px;
      display: block;
      transition: color 0.15s;
    }
    .games-back-btn:hover {
      text-decoration: underline;
      color: var(--text);
    }

    /* ── UNO Tab ──────────────────────────── */

    #tab-uno {
      padding: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
      overflow-y: auto;
    }

    .uno-join-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 24px;
      max-width: 400px;
      width: 100%;
      text-align: center;
    }

    .uno-join-box h2 {
      font-size: 20px;
      margin-bottom: 6px;
      background: linear-gradient(135deg, #ef4444, #eab308, #22c55e, #3b82f6);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .uno-join-box p {
      color: var(--muted);
      font-size: 13px;
      margin-bottom: 14px;
    }

    .uno-join-btn {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 8px;
      background: linear-gradient(135deg, #ef4444, #eab308, #22c55e, #3b82f6);
      color: #fff;
      font-size: 15px;
      font-weight: 700;
      cursor: pointer;
      transition: opacity 0.15s;
    }
    .uno-join-btn:hover { opacity: 0.9; }
    .uno-join-btn:disabled { opacity: 0.4; cursor: not-allowed; }

    .uno-status-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 20px;
      max-width: 400px;
      width: 100%;
      text-align: center;
    }

    .uno-status-text {
      color: var(--muted);
      font-size: 14px;
      margin-bottom: 12px;
    }
    .uno-status-text strong { color: var(--text); }

    .uno-lobby-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      justify-content: center;
      margin-bottom: 12px;
    }

    .uno-lobby-chip {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 600;
    }
    .uno-lobby-chip.me {
      border-color: var(--accent);
      color: #a855f7;
    }

    .uno-open-btn {
      display: inline-block;
      padding: 10px 20px;
      background: var(--accent);
      color: #fff;
      border-radius: 8px;
      text-decoration: none;
      font-size: 14px;
      font-weight: 700;
      transition: background 0.15s;
    }
    .uno-open-btn:hover { background: #a855f7; }

    .uno-no-game {
      color: var(--muted);
      font-size: 14px;
      padding: 24px 0;
    }

    /* ── CAH Tab ──────────────────────────── */

    #tab-cah {
      padding: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
      overflow-y: auto;
    }

    .cah-join-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 24px;
      max-width: 400px;
      width: 100%;
      text-align: center;
    }

    .cah-join-box h2 {
      font-size: 20px;
      margin-bottom: 6px;
      color: #fff;
    }

    .cah-join-box p {
      color: var(--muted);
      font-size: 13px;
      margin-bottom: 14px;
    }

    .cah-join-btn {
      width: 100%;
      padding: 10px;
      border: 2px solid #fff;
      border-radius: 8px;
      background: #000;
      color: #fff;
      font-size: 15px;
      font-weight: 700;
      cursor: pointer;
      transition: opacity 0.15s;
    }
    .cah-join-btn:hover { opacity: 0.9; }
    .cah-join-btn:disabled { opacity: 0.4; cursor: not-allowed; }

    .cah-status-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 20px;
      max-width: 400px;
      width: 100%;
      text-align: center;
    }

    .cah-status-text {
      color: var(--muted);
      font-size: 14px;
      margin-bottom: 12px;
    }
    .cah-status-text strong { color: var(--text); }

    /* ── BJ Tab ──────────────────────────── */

    #tab-bj {
      padding: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
      overflow-y: auto;
    }

    /* ── WrestleBet Tab ─────────────────── */
    .tab-btn[data-tab="wb"] {
      font-weight: 800;
      color: #eab308;
    }
    .tab-btn[data-tab="wb"].active {
      background: linear-gradient(135deg, #b91c1c, #eab308);
      color: #fff;
      border-color: transparent;
      -webkit-text-fill-color: initial;
      box-shadow: 0 2px 12px rgba(234, 179, 8, 0.3);
    }

    #tab-wb {
      padding: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      overflow-y: auto;
    }

    .bj-no-game {
      text-align: center;
      padding: 32px;
      color: var(--muted);
    }

    .bj-join-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 24px;
      max-width: 400px;
      width: 100%;
      text-align: center;
    }

    .bj-join-box h2 {
      font-size: 20px;
      margin-bottom: 6px;
      color: #22c55e;
    }

    .bj-join-box p {
      color: var(--muted);
      font-size: 13px;
      margin-bottom: 14px;
    }

    .bj-join-btn {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 8px;
      background: linear-gradient(135deg, #16a34a, #22c55e);
      color: #fff;
      font-size: 15px;
      font-weight: 700;
      cursor: pointer;
      transition: opacity 0.15s;
    }
    .bj-join-btn:hover { opacity: 0.9; }
    .bj-join-btn:disabled { opacity: 0.4; cursor: not-allowed; }

    .bj-status-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 20px;
      max-width: 400px;
      width: 100%;
      text-align: center;
    }

    .bj-status-text {
      color: var(--muted);
      font-size: 14px;
      margin-bottom: 12px;
    }
    .bj-status-text strong { color: var(--text); }

    .bj-lobby-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      justify-content: center;
      margin-bottom: 12px;
    }

    .bj-lobby-chip {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 4px 10px;
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
    }
    .bj-lobby-chip.me {
      border-color: #22c55e;
      color: #22c55e;
    }

    .bj-open-btn {
      display: inline-block;
      padding: 8px 20px;
      background: linear-gradient(135deg, #16a34a, #22c55e);
      color: #fff;
      text-decoration: none;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 700;
    }
    .bj-open-btn:hover { opacity: 0.9; }

    .cah-lobby-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      justify-content: center;
      margin-bottom: 12px;
    }

    .cah-lobby-chip {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 600;
    }
    .cah-lobby-chip.me {
      border-color: var(--accent);
      color: #a855f7;
    }

    .cah-open-btn {
      display: inline-block;
      padding: 10px 20px;
      background: #000;
      color: #fff;
      border: 1px solid #fff;
      border-radius: 8px;
      text-decoration: none;
      font-size: 14px;
      font-weight: 700;
      transition: background 0.15s;
    }
    .cah-open-btn:hover { background: #222; }

    .cah-no-game {
      color: var(--muted);
      font-size: 14px;
      padding: 24px 0;
    }

    /* ── Profile Tab ─────────────────────── */
    #tab-profile {
      padding: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
      overflow-y: auto;
    }

    .profile-card {
      background: rgba(28, 22, 54, 0.7);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 20px;
      padding: 28px;
      max-width: 400px;
      width: 100%;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    }

    .profile-card h2 {
      font-family: var(--font-display);
      font-size: 1.2rem;
      margin-bottom: 6px;
      background: linear-gradient(135deg, var(--accent2), #ec4899);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .profile-card p {
      color: var(--muted);
      font-size: 0.82rem;
      margin-bottom: 16px;
    }

    .profile-avatar-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      margin-bottom: 18px;
    }

    .profile-avatar {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      background: var(--bg);
      border: 3px solid var(--accent);
      object-fit: cover;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 2rem;
      color: var(--muted);
      overflow: hidden;
      box-shadow: 0 0 20px var(--glow);
    }

    .profile-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .profile-photo-btn {
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 20px;
      color: var(--text);
      font-family: var(--font-display);
      font-size: 0.78rem;
      font-weight: 600;
      padding: 6px 16px;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .profile-photo-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--accent); }

    .profile-field {
      margin-bottom: 14px;
    }

    .profile-field label {
      display: block;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.04em;
      margin-bottom: 5px;
    }

    .profile-field input {
      width: 100%;
      padding: 10px 14px;
      background: rgba(13, 11, 26, 0.8);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-size: 1rem;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .profile-field input:focus { border-color: var(--accent); box-shadow: 0 0 12px rgba(124, 58, 237, 0.2); }

    .profile-pin-input {
      letter-spacing: 0.5em;
      text-align: center;
      font-size: 1.4rem;
      font-weight: 700;
    }

    .profile-save-btn {
      width: 100%;
      padding: 12px;
      border: none;
      border-radius: 12px;
      background: linear-gradient(135deg, var(--accent), var(--accent2));
      color: #fff;
      font-family: var(--font-display);
      font-size: 0.95rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s var(--spring);
      margin-top: 6px;
      box-shadow: 0 4px 16px var(--glow);
    }
    .profile-save-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(124, 58, 237, 0.4); }

    .profile-coins {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 14px;
      background: rgba(13, 11, 26, 0.6);
      border: 1px solid rgba(234, 179, 8, 0.2);
      border-radius: 14px;
      margin-bottom: 18px;
      box-shadow: 0 0 16px rgba(234, 179, 8, 0.08);
    }

    .profile-coins-amount {
      font-size: 1.6rem;
      font-weight: 800;
      color: #eab308;
    }

    .profile-coins .coin-icon {
      width: 22px;
      height: 22px;
    }

    .profile-msg {
      font-size: 0.82rem;
      text-align: center;
      margin-top: 10px;
      min-height: 1.2em;
    }
    .profile-msg.ok { color: var(--success); }
    .profile-msg.err { color: var(--danger); }

    /* ── Shit Posts Tab ──────────────────── */
    .tab-btn[data-tab="shitposts"] {
      font-weight: 800;
      color: #eab308;
    }
    .tab-btn[data-tab="shitposts"].active {
      background: linear-gradient(135deg, #eab308, #f97316);
      color: #fff;
      border-color: transparent;
      -webkit-text-fill-color: initial;
      box-shadow: 0 2px 12px rgba(234, 179, 8, 0.3);
    }

    #tab-shitposts {
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }

    .sp-compose {
      background: linear-gradient(180deg, rgba(30, 18, 69, 0.9), rgba(28, 22, 54, 0.8));
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-bottom: 1px solid rgba(255,255,255,0.06);
      padding: 14px;
      flex-shrink: 0;
    }
    .sp-compose textarea {
      width: 100%;
      background: rgba(13, 11, 26, 0.8);
      border: 2px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-size: 14px;
      padding: 10px 12px;
      resize: none;
      outline: none;
      font-family: inherit;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .sp-compose textarea:focus { border-color: var(--accent); box-shadow: 0 0 12px rgba(124, 58, 237, 0.2); }
    .sp-compose textarea::placeholder { color: var(--muted); }

    .sp-compose-media-preview {
      margin-top: 8px;
      position: relative;
      display: none;
    }
    .sp-compose-media-preview.has-media { display: block; }
    .sp-compose-media-preview img {
      max-height: 140px;
      border-radius: 8px;
      display: block;
    }
    .sp-compose-media-remove {
      position: absolute;
      top: 4px;
      right: 4px;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: rgba(0,0,0,0.7);
      color: #fff;
      border: none;
      cursor: pointer;
      font-size: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .sp-compose-actions {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-top: 8px;
    }
    .sp-compose-btn {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.08);
      color: var(--muted);
      border-radius: 20px;
      padding: 6px 12px;
      cursor: pointer;
      font-family: var(--font-display);
      font-size: 12px;
      font-weight: 600;
      transition: all 0.2s var(--spring);
    }
    .sp-compose-btn:hover { color: var(--text); border-color: var(--accent); background: rgba(124, 58, 237, 0.1); }
    .sp-compose-btn.active { color: var(--accent2); border-color: var(--accent2); background: rgba(168, 85, 247, 0.1); }
    .sp-char-counter {
      margin-left: auto;
      font-size: 12px;
      color: var(--muted);
    }
    .sp-char-counter.warn { color: var(--danger); }
    .sp-post-btn {
      font-size: 13px;
      padding: 7px 16px;
      min-height: 34px;
      display: flex;
      align-items: center;
      gap: 6px;
      border-radius: 20px;
    }
    .sp-post-btn:hover { transform: translateY(-1px); }
    .sp-cost-badge {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      font-size: 11px;
      opacity: 0.8;
    }

    /* GIF picker inline */
    .sp-gif-picker {
      margin-top: 8px;
      background: rgba(13, 11, 26, 0.8);
      border: 1px solid rgba(255,255,255,0.06);
      border-radius: var(--radius);
      padding: 8px;
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }
    .sp-gif-picker input {
      width: 100%;
      background: rgba(28, 22, 54, 0.8);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-size: 13px;
      padding: 8px 10px;
      outline: none;
      margin-bottom: 8px;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .sp-gif-picker input:focus { border-color: var(--accent); box-shadow: 0 0 8px rgba(124, 58, 237, 0.15); }
    .sp-gif-picker input::placeholder { color: var(--muted); }
    .sp-gif-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 6px;
      max-height: 200px;
      overflow-y: auto;
    }
    .sp-gif-grid img {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      border-radius: 10px;
      cursor: pointer;
      transition: all 0.2s var(--spring);
    }
    .sp-gif-grid img:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

    /* Feed disabled */
    .sp-disabled-banner {
      background: var(--danger);
      color: #fff;
      text-align: center;
      padding: 10px 14px;
      font-size: 0.88rem;
      font-weight: 700;
      letter-spacing: 0.03em;
      flex-shrink: 0;
    }

    /* Feed list */
    .sp-feed {
      flex: 1;
      overflow-y: auto;
      padding: 10px 12px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      -webkit-overflow-scrolling: touch;
    }

    /* Post card */
    .sp-post {
      background: rgba(28, 22, 54, 0.7);
      border: 1px solid rgba(255,255,255,0.06);
      border-radius: 16px;
      padding: 16px;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      box-shadow: 0 4px 20px rgba(0,0,0,0.2);
      transition: all 0.25s ease;
      animation: postPopIn 0.35s var(--spring);
    }
    .sp-post:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.08);
    }
    .sp-post.pinned {
      border-color: rgba(234, 179, 8, 0.3);
      position: relative;
      box-shadow: 0 4px 20px rgba(0,0,0,0.2), 0 0 20px rgba(234, 179, 8, 0.08);
    }
    .sp-pin-badge {
      position: absolute;
      top: 10px;
      right: 12px;
      font-size: 11px;
      font-family: var(--font-display);
      color: #eab308;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 3px;
      text-shadow: 0 0 8px rgba(234, 179, 8, 0.3);
    }
    .sp-post-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 8px;
    }
    .sp-post-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--accent), #ec4899);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 14px;
      flex-shrink: 0;
      overflow: hidden;
      box-shadow: 0 2px 8px var(--glow);
    }
    .sp-post-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .sp-post-author {
      font-family: var(--font-display);
      font-weight: 700;
      font-size: 13px;
      color: var(--text);
      cursor: pointer;
      transition: color 0.2s;
    }
    .sp-post-author:hover { color: var(--accent2); text-shadow: 0 0 8px rgba(168, 85, 247, 0.3); }
    .sp-post-time {
      font-size: 11px;
      color: var(--muted);
    }
    .sp-post-edited {
      font-size: 10px;
      color: var(--muted);
      font-style: italic;
    }
    .sp-post-body {
      font-size: 14px;
      line-height: 1.5;
      color: var(--text);
      margin-bottom: 8px;
      word-wrap: break-word;
      white-space: pre-wrap;
    }
    .sp-post-media {
      margin-bottom: 10px;
      border-radius: 12px;
      overflow: hidden;
    }
    .sp-post-media img {
      max-width: 100%;
      max-height: 300px;
      border-radius: 12px;
      display: block;
      box-shadow: 0 4px 16px rgba(0,0,0,0.3);
      transition: transform 0.3s ease;
    }
    .sp-post-media img:hover { transform: scale(1.02); }

    /* Reactions */
    .sp-post-actions {
      display: flex;
      align-items: center;
      gap: 5px;
      flex-wrap: wrap;
      margin-top: 8px;
    }
    .sp-reaction-btn {
      background: rgba(13, 11, 26, 0.6);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 20px;
      padding: 4px 10px;
      font-size: 13px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      color: var(--muted);
      transition: all 0.2s var(--spring);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }
    .sp-reaction-btn:hover { border-color: var(--accent); transform: scale(1.08); box-shadow: 0 2px 8px var(--glow); }
    .sp-reaction-btn.active {
      border-color: var(--accent2);
      color: var(--accent2);
      background: rgba(124, 58, 237, 0.15);
      box-shadow: 0 0 12px rgba(124, 58, 237, 0.2);
    }
    .sp-reaction-btn .sp-r-count {
      font-size: 11px;
      font-weight: 700;
    }

    .sp-action-btn {
      background: none;
      border: none;
      color: var(--muted);
      font-size: 12px;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 8px;
      transition: all 0.2s ease;
    }
    .sp-action-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
    .sp-action-btn.danger:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

    /* Replies */
    .sp-replies {
      margin-top: 10px;
      margin-left: 20px;
      padding-left: 12px;
      border-left: 2px solid rgba(124, 58, 237, 0.2);
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .sp-reply-compose {
      display: flex;
      gap: 6px;
      margin-top: 6px;
    }
    .sp-reply-compose input {
      flex: 1;
      background: rgba(13, 11, 26, 0.8);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-size: 13px;
      padding: 8px 12px;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .sp-reply-compose input:focus { border-color: var(--accent); box-shadow: 0 0 8px rgba(124, 58, 237, 0.15); }
    .sp-reply-compose button {
      background: linear-gradient(135deg, var(--accent), var(--accent2));
      color: #fff;
      border: none;
      border-radius: 10px;
      padding: 8px 14px;
      font-family: var(--font-display);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s var(--spring);
    }
    .sp-reply-compose button:hover { transform: translateY(-1px); box-shadow: 0 2px 8px var(--glow); }

    /* Inline edit */
    .sp-edit-box {
      width: 100%;
      margin-bottom: 6px;
    }
    .sp-edit-box textarea {
      width: 100%;
      background: rgba(13, 11, 26, 0.8);
      border: 2px solid var(--accent);
      border-radius: 10px;
      color: var(--text);
      font-size: 14px;
      padding: 8px 10px;
      resize: none;
      outline: none;
      font-family: inherit;
      box-shadow: 0 0 12px rgba(124, 58, 237, 0.15);
    }
    .sp-edit-actions {
      display: flex;
      gap: 6px;
      margin-top: 6px;
    }
    .sp-edit-actions button {
      font-family: var(--font-display);
      font-size: 12px;
      padding: 5px 12px;
      border-radius: 8px;
      border: none;
      cursor: pointer;
      font-weight: 600;
      transition: all 0.15s ease;
    }
    .sp-edit-save { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
    .sp-edit-cancel { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid rgba(255,255,255,0.08); }

    /* User profile panel */
    .sp-user-panel {
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse at 50% 20%, #1e1245 0%, #120e2a 45%, #0a0816 100%);
      z-index: 10;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .sp-user-panel[hidden] { display: none !important; }
    .sp-user-panel-header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 16px;
      background: linear-gradient(180deg, rgba(30, 18, 69, 0.9), rgba(28, 22, 54, 0.8));
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-bottom: 1px solid rgba(255,255,255,0.06);
    }
    .sp-user-panel-avatar {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--accent), #ec4899);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 22px;
      flex-shrink: 0;
      overflow: hidden;
      box-shadow: 0 4px 16px var(--glow);
    }
    .sp-user-panel-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .sp-user-panel-name {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 18px;
      color: var(--text);
    }
    .sp-user-panel-meta {
      font-size: 12px;
      color: var(--muted);
    }
    .sp-user-posts {
      flex: 1;
      overflow-y: auto;
      padding: 10px 12px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      -webkit-overflow-scrolling: touch;
    }

    /* ── Users Tab ─────────────────────────────────────────── */
    #tab-users {
      padding: 12px 12px 48px 12px;
      overflow-y: auto;
    }
    .idx-users-search {
      width: 100%;
      max-width: 500px;
      margin: 0 auto 16px;
      display: block;
      padding: 10px 14px;
      background: rgba(13, 11, 26, 0.8);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-family: var(--font-body);
      font-size: 0.92rem;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .idx-users-search:focus { border-color: var(--accent); box-shadow: 0 0 12px rgba(124, 58, 237, 0.2); }
    .idx-users-search::placeholder { color: var(--muted); }

    .idx-users-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 12px;
      max-width: 700px;
      margin: 0 auto;
    }
    .idx-user-card {
      background: rgba(28, 22, 54, 0.7);
      border: 1px solid rgba(255,255,255,0.06);
      border-radius: 14px;
      padding: 18px 14px;
      text-align: center;
      cursor: pointer;
      transition: all 0.25s var(--spring);
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
    }
    .idx-user-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 16px var(--glow); }
    .idx-user-avatar {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: var(--bg);
      border: 2px solid var(--border);
      overflow: hidden;
      margin: 0 auto 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--muted);
      transition: border-color 0.2s;
    }
    .idx-user-card:hover .idx-user-avatar { border-color: var(--accent); }
    .idx-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
    .idx-user-name {
      font-family: var(--font-display);
      font-size: 0.88rem;
      font-weight: 700;
      color: var(--text);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .idx-user-coins {
      font-size: 0.78rem;
      color: #eab308;
      font-weight: 700;
      margin-top: 4px;
    }

    /* User detail panel on index */
    .idx-user-detail {
      max-width: 600px;
      width: 100%;
      margin: 0 auto;
      overflow: hidden;
      flex-shrink: 0;
    }
    .idx-detail-back {
      background: none;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      font-size: 0.85rem;
      font-weight: 600;
      padding: 8px 16px;
      cursor: pointer;
      margin-bottom: 16px;
      transition: border-color 0.15s;
    }
    .idx-detail-back:hover { border-color: var(--accent); }
    .idx-detail-header {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 18px;
      background: rgba(28, 22, 54, 0.7);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 16px;
      margin-bottom: 12px;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }
    .idx-detail-avatar {
      width: 56px;
      height: 56px;
      border-radius: 50%;
      background: var(--bg);
      border: 2px solid var(--accent);
      overflow: hidden;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.3rem;
      font-weight: 700;
      color: var(--muted);
      box-shadow: 0 2px 12px var(--glow);
    }
    .idx-detail-avatar img { width: 100%; height: 100%; object-fit: cover; }
    .idx-detail-name { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--text); }
    .idx-detail-meta { font-size: 0.75rem; color: var(--muted); margin-top: 3px; }
    .idx-detail-stats {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
      gap: 10px;
      margin-bottom: 12px;
    }
    .idx-stat-card {
      background: rgba(28, 22, 54, 0.7);
      border: 1px solid rgba(255,255,255,0.06);
      border-radius: 12px;
      padding: 14px;
      text-align: center;
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
    }
    .idx-stat-value { font-size: 1.1rem; font-weight: 700; color: var(--text); }
    .idx-stat-value.coins { color: #eab308; }
    .idx-stat-value.wins { color: var(--success); }
    .idx-stat-value.losses { color: var(--danger); }
    .idx-stat-label { font-size: 0.68rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 3px; }
    .idx-detail-section {
      overflow: hidden;
      min-width: 0;
    }
    .idx-detail-section h4 {
      font-size: 0.82rem;
      font-weight: 700;
      color: var(--text);
      margin: 12px 0 8px;
      padding-bottom: 6px;
      border-bottom: 1px solid var(--border);
    }
    .idx-history-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
      max-height: 250px;
      overflow-y: auto;
    }
    .idx-history-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 7px 10px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 0.78rem;
    }
    .idx-history-item .hist-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
    .idx-history-item .hist-link { text-decoration: none; color: inherit; }
    .idx-history-item .hist-link:hover { text-decoration: underline; color: var(--accent, #58a6ff); }
    .idx-history-item .hist-time { color: var(--muted); font-size: 0.7rem; flex-shrink: 0; }
    .idx-history-item .hist-result { font-weight: 700; font-size: 0.72rem; flex-shrink: 0; }
    .idx-history-item .hist-result.win { color: var(--success); }
    .idx-history-item .hist-result.loss { color: var(--danger); }
    .idx-history-empty { color: var(--muted); font-size: 0.78rem; font-style: italic; padding: 6px 0; }
    .idx-history-pagination { display: flex; gap: 8px; padding: 8px 0 4px; }
    .idx-hist-page-btn {
      background: var(--surface2, #2a2a3e); color: var(--muted, #aaa); border: 1px solid var(--border, #333);
      border-radius: 6px; padding: 4px 12px; font-size: 0.78rem; cursor: pointer; transition: background 0.15s;
    }
    .idx-hist-page-btn:hover { background: var(--surface3, #333350); color: var(--text, #fff); }

    /* ── Mobile Responsiveness ────────────── */
    @media (max-width: 480px) {
      .tab-btn {
        font-size: 0.74rem;
        padding: 6px 10px;
      }
      .sp-post {
        padding: 12px;
        border-radius: 14px;
      }
      .sp-post:hover { transform: none; }
      .games-picker-card {
        padding: 14px 16px;
      }
      .games-picker-card:hover { transform: none; }
      .idx-user-card:hover { transform: none; }
    }

