/* ============================================================
   GLOBALINK — CTG GAMES CSS v2.0
   Responsive completo · Swipe táctil · Perfil móvil corregido
   ============================================================ */

/* ── Variables ───────────────────────────────────────────────── */
:root {
    --ctgg-primary:   #c639b8;
    --ctgg-secondary: #1e8ee9;
    --ctgg-accent:    #e94560;
    --ctgg-surface:   rgba(255,255,255,.04);
    --ctgg-border:    rgba(255,255,255,.08);
    --ctgg-text:      rgba(255,255,255,.85);
    --ctgg-muted:     rgba(255,255,255,.4);
    --ctgg-sidebar-w: 56px;
}

/* ── Window wrapper ─────────────────────────────────────────── */
/* FIX: #contentArea normalmente reserva espacio para el sidebar/diseño
   del Feed — sin esto, CTG Games solo ocupaba la mitad del ancho en
   móvil, dejando ver el fondo de Globalink detrás. Esta regla fuerza
   pantalla completa SIEMPRE (no solo en escritorio, a diferencia de la
   regla equivalente de CTG singular). */
#contentArea:has(#ctggWindow) {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    overflow: hidden !important;
    width: 100% !important;
    height: 100% !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 7999 !important;
}
#ctggWindow {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, #070711 0%, #04040f 50%, #0d0820 100%);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    position: relative;
}

/* ══════════════════════════════════════════════════════════════
   HEADER — corregido para móvil
   ══════════════════════════════════════════════════════════════ */
.ctgg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ctgg-border);
    flex-shrink: 0;
    gap: 8px;
    min-height: 52px;
    overflow: hidden; /* Evita que los pills desborden */
}

.ctgg-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
}

.ctgg-header-logo {
    font-size: 17px;
    font-weight: 900;
    background: linear-gradient(135deg, #c639b8, #1e8ee9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.ctgg-header-subtitle {
    font-size: 10px;
    color: var(--ctgg-muted);
    display: none; /* Solo desktop */
}

/* Stats pills — se adaptan en móvil */
.ctgg-header-stats {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.ctgg-stat-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid var(--ctgg-border);
    font-size: 11px;
    font-weight: 700;
    background: rgba(0,0,0,.35);
    white-space: nowrap;
    flex-shrink: 0;
}

#ctggLevel  { color: #ffd700; }
#ctggXP     { color: #4caf50; }
#ctggLeague { color: var(--ctgg-primary); }

/* En móvil pequeño ocultar "Bronce" en liga — mostrar solo icono */
@media (max-width: 400px) {
    #ctggLeaguePill .ctgg-league-text { display: none; }
    .ctgg-stat-pill { padding: 4px 6px; font-size: 10px; }
    .ctgg-header-logo { font-size: 15px; }
}

.ctgg-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: none;
    color: rgba(255,255,255,.7);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    transition: background .15s;
}
.ctgg-close-btn:hover { background: rgba(255,255,255,.16); }

/* ══════════════════════════════════════════════════════════════
   BODY LAYOUT
   ══════════════════════════════════════════════════════════════ */
.ctgg-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.ctgg-sidebar {
    width: var(--ctgg-sidebar-w);
    flex-shrink: 0;
    background: rgba(0,0,0,.4);
    border-right: 1px solid var(--ctgg-border);
    display: none; /* oculto en móvil — visible en ≥600px */
    flex-direction: column;
    padding: 6px 0;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.ctgg-sidebar::-webkit-scrollbar { display: none; }

/* Sidebar visible en tablet/desktop */
@media (min-width: 600px) {
    .ctgg-sidebar { display: flex; }
}

.ctgg-side-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 9px 4px;
    cursor: pointer;
    border-radius: 10px;
    margin: 0 4px;
    color: var(--ctgg-muted);
    font-size: 8px;
    gap: 3px;
    transition: all .15s;
    text-align: center;
    border: none;
    background: none;
    font-family: inherit;
    width: calc(var(--ctgg-sidebar-w) - 8px);
}
.ctgg-side-item i { font-size: 17px; }
.ctgg-side-item:hover  { background: rgba(255,255,255,.07); color: rgba(255,255,255,.8); }
.ctgg-side-item.active { background: rgba(198,57,184,.18); color: var(--ctgg-primary); }

/* ── Content area ────────────────────────────────────────────── */
.ctgg-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 8px;
    min-width: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(198,57,184,.3) transparent;
    -webkit-overflow-scrolling: touch;
    /* Asegurar que ocupa todo el ancho disponible */
    width: 100%;
    box-sizing: border-box;
}
.ctgg-content::-webkit-scrollbar { width: 3px; }
.ctgg-content::-webkit-scrollbar-thumb { background: rgba(198,57,184,.3); border-radius: 3px; }

/* ── Section titles ──────────────────────────────────────────── */
.ctgg-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--ctgg-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 18px 0 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.ctgg-section-title:first-child { margin-top: 0; }

/* ══════════════════════════════════════════════════════════════
   SCROLL TÁCTIL HORIZONTAL — aplicado a todas las filas
   ══════════════════════════════════════════════════════════════ */
.ctgg-scroll-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    /* Momentum scroll en iOS */
    scroll-behavior: smooth;
}
.ctgg-scroll-row::-webkit-scrollbar { display: none; }
.ctgg-scroll-row > * { scroll-snap-align: start; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   PLAYER BANNER — portal
   ══════════════════════════════════════════════════════════════ */
.ctgg-player-banner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--ctgg-surface);
    border: 1px solid var(--ctgg-border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 18px;
    width: 100%;
    box-sizing: border-box;
}

.ctgg-player-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ctgg-player-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(198,57,184,.4);
    flex-shrink: 0;
}
.ctgg-player-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ctgg-av-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,#6a1fa8,#c639b8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.ctgg-player-info { flex: 1; min-width: 0; }
.ctgg-player-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.ctgg-player-id     { font-size: 10px; color: var(--ctgg-muted); margin: 2px 0; }
.ctgg-player-league { font-size: 11px; color: var(--ctgg-primary); font-weight: 600; }

.ctgg-player-banner-right { width: 100%; }

.ctgg-xp-bar-wrap { margin-bottom: 10px; }
.ctgg-xp-label { font-size: 10px; color: var(--ctgg-muted); margin-bottom: 4px; }
.ctgg-xp-bar {
    height: 6px;
    background: rgba(255,255,255,.1);
    border-radius: 3px;
    overflow: hidden;
}
.ctgg-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #6a1fa8, #c639b8);
    border-radius: 3px;
    transition: width .5s ease;
}

.ctgg-quick-stats { display: flex; gap: 20px; }
.ctgg-qstat { display: flex; flex-direction: column; align-items: center; }
.ctgg-qstat-n { font-size: 20px; font-weight: 800; color: #fff; }
.ctgg-qstat-l { font-size: 10px; color: var(--ctgg-muted); }

/* ══════════════════════════════════════════════════════════════
   GAME CARDS — grid responsive
   ══════════════════════════════════════════════════════════════ */
.ctgg-games-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.ctgg-game-card {
    position: relative;
    border-radius: 14px;
    padding: 18px 16px;
    border: 1px solid rgba(255,255,255,.1);
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}
.ctgg-game-card:not(.ctgg-card-soon):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.4), 0 0 0 1px var(--ctgg-accent);
}
.ctgg-card-soon { opacity: .65; cursor: default; }

.ctgg-game-badge {
    position: absolute;
    top: 10px; right: 10px;
    font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 20px;
    background: rgba(0,0,0,.55);
    color: var(--ctgg-accent);
    border: 1px solid var(--ctgg-accent);
}
.ctgg-game-card.ctgg-card-soon .ctgg-game-badge {
    color: #9c27b0;
    border-color: #9c27b0;
}

.ctgg-game-icon  { font-size: 34px; }
.ctgg-game-title { font-size: 16px; font-weight: 800; color: #fff; }
.ctgg-game-desc  { font-size: 12px; color: rgba(255,255,255,.6); line-height: 1.5; }

.ctgg-game-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.ctgg-meta-tag {
    font-size: 10px; color: rgba(255,255,255,.5);
    background: rgba(255,255,255,.07); border-radius: 20px; padding: 3px 8px;
}

.ctgg-play-btn {
    padding: 11px 16px;
    background: var(--ctgg-accent);
    border: none; border-radius: 10px;
    color: #fff; font-size: 13px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: opacity .15s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%;
}
.ctgg-play-btn:hover:not(:disabled) { opacity: .88; }
.ctgg-play-disabled { opacity: .4 !important; cursor: not-allowed; background: rgba(255,255,255,.1) !important; }

/* ══════════════════════════════════════════════════════════════
   MISSIONS PREVIEW
   ══════════════════════════════════════════════════════════════ */
.ctgg-missions-preview {
    background: var(--ctgg-surface);
    border: 1px solid var(--ctgg-border);
    border-radius: 14px;
    padding: 12px;
}
.ctgg-mission-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
    flex-wrap: wrap;
}
.ctgg-mission-mini:last-of-type { border-bottom: none; }
.ctgg-mission-mini-info { flex: 1; min-width: 120px; }
.ctgg-mission-mini-title  { font-size: 11px; color: #fff; display: block; }
.ctgg-mission-mini-reward { font-size: 9px; color: var(--ctgg-muted); }
.ctgg-mission-bar-wrap {
    width: 70px; height: 4px;
    background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; flex-shrink: 0;
}
.ctgg-mission-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #c639b8, #1e8ee9);
    border-radius: 2px; transition: width .3s;
}
.ctgg-mission-mini-pct { font-size: 9px; color: var(--ctgg-muted); flex-shrink: 0; }
.ctgg-see-all-btn {
    margin-top: 10px; background: none; border: none;
    color: var(--ctgg-primary); font-size: 11px; font-weight: 600;
    cursor: pointer; font-family: inherit; padding: 6px 0; display: block; width: 100%;
    text-align: left;
}

/* ══════════════════════════════════════════════════════════════
   ESCAPE HUB
   ══════════════════════════════════════════════════════════════ */
.ctgg-escape-hub { padding-bottom: 20px; width: 100%; box-sizing: border-box; }
.ctgg-escape-hero {
    text-align: center;
    padding: 20px 12px 14px;
    background: linear-gradient(135deg, rgba(233,69,96,.1), rgba(198,57,184,.08));
    border: 1px solid rgba(233,69,96,.2);
    border-radius: 14px;
    margin-bottom: 18px;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
}
.ctgg-escape-hero-icon { font-size: 44px; margin-bottom: 6px; }
.ctgg-escape-title     { font-size: 20px; font-weight: 800; color: #fff; margin: 0 0 4px; }
.ctgg-escape-subtitle  { font-size: 12px; color: rgba(255,255,255,.55); margin: 0; }

/* Modes grid — scroll táctil horizontal en móvil */
.ctgg-modes-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding-bottom: 6px;
    margin-bottom: 4px;
}
.ctgg-modes-grid::-webkit-scrollbar { display: none; }
.ctgg-mode-card {
    background: var(--ctgg-surface);
    border: 2px solid var(--ctgg-border);
    border-radius: 12px;
    padding: 14px 10px;
    cursor: pointer; text-align: center;
    transition: all .2s;
    display: flex; flex-direction: column; gap: 4px;
    flex-shrink: 0;
    scroll-snap-align: start;
    width: 110px;
    min-width: 110px;
    box-sizing: border-box;
}
.ctgg-mode-card:hover, .ctgg-mode-card.active {
    border-color: var(--mode-color, #c639b8);
    background: rgba(198,57,184,.1);
}
.ctgg-mode-icon    { font-size: 22px; }
.ctgg-mode-label   { font-size: 12px; font-weight: 700; color: #fff; }
.ctgg-mode-desc    { font-size: 9px; color: var(--ctgg-muted); line-height: 1.3; }
.ctgg-mode-players { font-size: 9px; color: rgba(255,255,255,.3); }

/* Difficulty — scroll táctil horizontal */
.ctgg-diff-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-bottom: 4px;
}
.ctgg-diff-row::-webkit-scrollbar { display: none; }
.ctgg-diff-btn {
    flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 10px 12px;
    background: var(--ctgg-surface);
    border: 1.5px solid var(--ctgg-border);
    border-radius: 12px; cursor: pointer; font-family: inherit; transition: all .15s;
    min-width: 76px;
}
.ctgg-diff-btn:hover, .ctgg-diff-btn.active {
    background: rgba(198,57,184,.15); border-color: rgba(198,57,184,.5);
}
.ctgg-diff-icon  { font-size: 18px; }
.ctgg-diff-label { font-size: 11px; font-weight: 700; color: #fff; }
.ctgg-diff-time  { font-size: 9px; color: var(--ctgg-muted); }
.ctgg-diff-xp    { font-size: 9px; color: #4caf50; font-weight: 600; }

/* Room cards */
.ctgg-rooms-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.ctgg-room-card {
    display: flex; align-items: center; gap: 12px;
    border-radius: 14px; border: 1px solid rgba(255,255,255,.08);
    padding: 12px 14px; cursor: pointer; transition: all .2s;
    width: 100%; box-sizing: border-box;
}
.ctgg-room-card:hover {
    border-color: var(--room-accent, #c639b8);
    box-shadow: inset 0 0 0 1px var(--room-accent, #c639b8), 0 4px 16px rgba(0,0,0,.3);
}
.ctgg-room-icon  { font-size: 28px; flex-shrink: 0; }
.ctgg-room-info  { flex: 1; min-width: 0; }
.ctgg-room-name  { font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctgg-room-desc  { font-size: 11px; color: rgba(255,255,255,.55); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ctgg-room-meta  { font-size: 10px; color: rgba(255,255,255,.3); margin-top: 4px; }
.ctgg-room-play-btn {
    width: 34px; height: 34px; border-radius: 50%;
    border: none; color: #fff; font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: transform .15s;
}
.ctgg-room-play-btn:hover { transform: scale(1.1); }

/* Join room */
.ctgg-join-room-wrap {
    background: rgba(255,255,255,.03); border: 1px solid var(--ctgg-border);
    border-radius: 14px; padding: 12px; margin-top: 6px;
}
.ctgg-join-row { display: flex; gap: 8px; }
.ctgg-join-btn {
    padding: 10px 14px;
    background: rgba(198,57,184,.2); border: 1px solid rgba(198,57,184,.4);
    border-radius: 10px; color: var(--ctgg-primary); font-size: 12px; font-weight: 700;
    cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 5px;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════
   GAME HEADER + TIMER
   ══════════════════════════════════════════════════════════════ */
.ctgg-game-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0 12px;
    border-bottom: 1px solid var(--ctgg-border); margin-bottom: 12px;
    flex-shrink: 0; gap: 8px;
}
.ctgg-abandon-btn {
    background: rgba(255,77,77,.12); border: 1px solid rgba(255,77,77,.25);
    border-radius: 8px; color: rgba(255,100,100,.8); padding: 7px 10px;
    cursor: pointer; font-size: 13px; font-family: inherit; transition: all .15s; flex-shrink: 0;
}
.ctgg-game-header-center { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center; min-width: 0; }
.ctgg-game-header-room { font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctgg-game-header-diff {
    font-size: 9px; font-weight: 700; padding: 3px 8px;
    border-radius: 20px; text-transform: capitalize; flex-shrink: 0;
}
.ctgg-diff-easy   { background: rgba(76,175,80,.2);  color: #4caf50; }
.ctgg-diff-medium { background: rgba(255,193,7,.2);  color: #ffc107; }
.ctgg-diff-hard   { background: rgba(255,152,0,.2);  color: #ff9800; }
.ctgg-diff-expert { background: rgba(244,67,54,.2);  color: #f44336; }
.ctgg-diff-master { background: rgba(156,39,176,.2); color: #ce93d8; }

.ctgg-timer-display {
    display: flex; align-items: center; gap: 5px;
    font-size: 16px; font-weight: 800; font-family: monospace;
    flex-shrink: 0; transition: color .3s;
}

@keyframes ctggPulse { 0%,100% { transform:scale(1); } 50% { transform:scale(1.08); } }

/* Progress */
.ctgg-progress-wrap { margin-bottom: 14px; }
.ctgg-progress-info { display: flex; justify-content: space-between; font-size: 10px; color: var(--ctgg-muted); margin-bottom: 5px; }
.ctgg-progress-bar { height: 5px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.ctgg-progress-fill { height: 100%; background: linear-gradient(90deg,#e94560,#c639b8,#1e8ee9); border-radius: 3px; transition: width .4s ease; }
.ctgg-puzzle-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.ctgg-puzzle-dot {
    width: 24px; height: 24px; border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.15);
    background: rgba(255,255,255,.05);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; color: var(--ctgg-muted); transition: all .2s;
}
.ctgg-puzzle-dot.active  { border-color: #c639b8; color: #c639b8; background: rgba(198,57,184,.15); }
.ctgg-puzzle-dot.solved  { border-color: #4caf50; background: rgba(76,175,80,.2); color: #4caf50; }

/* Puzzle card */
.ctgg-puzzle-area { flex: 1; overflow-y: auto; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.ctgg-puzzle-card {
    background: var(--ctgg-surface); border: 1px solid var(--ctgg-border);
    border-radius: 14px; padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    width: 100%; box-sizing: border-box;
}
.ctgg-puzzle-type-badge {
    display: inline-block; font-size: 10px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    background: rgba(198,57,184,.15); color: var(--ctgg-primary);
    border: 1px solid rgba(198,57,184,.3); align-self: flex-start;
}
.ctgg-puzzle-title { font-size: 15px; font-weight: 800; color: #fff; margin: 0; }
.ctgg-puzzle-desc  { font-size: 13px; color: rgba(255,255,255,.75); line-height: 1.6; }
.ctgg-answer-feedback {
    padding: 10px 12px; border-radius: 10px;
    font-size: 12px; font-weight: 600; transition: all .2s;
}
.ctgg-feedback-correct { background: rgba(76,175,80,.15); border: 1px solid rgba(76,175,80,.35); color: #4caf50; }
.ctgg-feedback-wrong   { background: rgba(244,67,54,.12);  border: 1px solid rgba(244,67,54,.3);  color: #ff6b6b; }

.ctgg-puzzle-input-wrap {
    display: flex; gap: 8px; align-items: stretch;
    flex-wrap: wrap;
}
.ctgg-puzzle-input {
    flex: 1; min-width: 0;
    background: rgba(255,255,255,.07); border: 1.5px solid rgba(255,255,255,.12);
    border-radius: 10px; padding: 12px 12px;
    color: #fff; font-size: 14px; font-family: 'Outfit', monospace; outline: none;
    transition: border-color .2s; min-height: 46px;
}
.ctgg-puzzle-input:focus { border-color: rgba(198,57,184,.6); }
.ctgg-puzzle-input::placeholder { color: rgba(255,255,255,.25); }

.ctgg-submit-btn {
    padding: 12px 16px;
    background: linear-gradient(135deg, #6a1fa8, #c639b8);
    border: none; border-radius: 10px; color: #fff;
    font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
    display: flex; align-items: center; gap: 5px; white-space: nowrap;
    transition: opacity .15s; flex-shrink: 0;
}
.ctgg-submit-btn:hover:not(:disabled) { opacity: .88; }
.ctgg-submit-btn:disabled { opacity: .45; cursor: not-allowed; }

.ctgg-puzzle-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ctgg-hint-btn {
    padding: 9px 14px;
    background: rgba(255,215,0,.1); border: 1px solid rgba(255,215,0,.3);
    border-radius: 10px; color: #ffd700; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 5px;
    transition: all .15s;
}
.ctgg-hint-btn:hover:not(:disabled) { background: rgba(255,215,0,.18); }
.ctgg-hint-btn:disabled { opacity: .4; cursor: not-allowed; }
.ctgg-hint-text {
    background: rgba(255,215,0,.08); border: 1px solid rgba(255,215,0,.25);
    border-radius: 10px; padding: 11px 13px;
    font-size: 12px; color: rgba(255,215,0,.9); line-height: 1.5;
}

@keyframes ctggShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

.ctgg-game-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0 0;
    border-top: 1px solid var(--ctgg-border);
    flex-shrink: 0; gap: 10px; flex-wrap: wrap; margin-top: 6px;
}
.ctgg-hints-info { display: flex; align-items: center; gap: 5px; font-size: 11px; color: rgba(255,255,255,.5); flex-wrap: wrap; }
.ctgg-room-code-display { font-size: 10px; color: var(--ctgg-muted); }

/* ══════════════════════════════════════════════════════════════
   GAME OVER
   ══════════════════════════════════════════════════════════════ */
.ctgg-game-over {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 24px 16px; text-align: center;
    min-height: 360px; gap: 14px;
}
.ctgg-win  { background: radial-gradient(ellipse at center top, rgba(76,175,80,.15) 0%, transparent 70%); }
.ctgg-lose { background: radial-gradient(ellipse at center top, rgba(244,67,54,.12) 0%, transparent 70%); }
@keyframes ctggBounce { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }
.ctgg-go-icon { font-size: 56px; animation: ctggBounce 1s ease infinite; }
.ctgg-go-title    { font-size: 22px; font-weight: 900; color: #fff; margin: 0; }
.ctgg-go-subtitle { font-size: 13px; color: rgba(255,255,255,.6); margin: 0; }

.ctgg-go-stats {
    display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
    background: var(--ctgg-surface); border: 1px solid var(--ctgg-border);
    border-radius: 12px; padding: 14px 20px;
}
.ctgg-go-stat { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ctgg-go-stat-n { font-size: 18px; font-weight: 800; color: #fff; }
.ctgg-go-stat-l { font-size: 10px; color: var(--ctgg-muted); }

.ctgg-go-rewards {
    background: rgba(198,57,184,.08); border: 1px solid rgba(198,57,184,.2);
    border-radius: 12px; padding: 14px 18px; text-align: center; width: 100%; max-width: 380px;
}
.ctgg-go-rewards-title { font-size: 10px; color: var(--ctgg-muted); margin-bottom: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.ctgg-go-rewards-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ctgg-go-reward { display: flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.ctgg-reward-xp     { background: rgba(76,175,80,.2);  color: #4caf50; }
.ctgg-reward-bonus  { background: rgba(255,215,0,.15); color: #ffd700; }
.ctgg-reward-token  { background: rgba(255,193,7,.15); color: #ffc107; }
.ctgg-go-badge { margin-top: 8px; font-size: 11px; color: rgba(255,215,0,.8); background: rgba(255,215,0,.08); border: 1px solid rgba(255,215,0,.2); border-radius: 20px; padding: 4px 12px; display: inline-block; }

.ctgg-go-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ctgg-go-btn {
    padding: 11px 16px; border-radius: 10px; border: none;
    font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit;
    display: flex; align-items: center; gap: 6px; transition: opacity .15s;
}
.ctgg-go-btn:hover { opacity: .85; }
.ctgg-go-retry  { background: linear-gradient(135deg,#e94560,#c639b8); color: #fff; }
.ctgg-go-hub    { background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); }
.ctgg-go-portal { background: rgba(255,255,255,.07); color: rgba(255,255,255,.6); }

/* ══════════════════════════════════════════════════════════════
   PERFIL GAMER — CORREGIDO COMPLETAMENTE
   ══════════════════════════════════════════════════════════════ */
.ctgg-profile-wrap { padding-bottom: 20px; width: 100%; box-sizing: border-box; }

/* Card de perfil — columna en móvil */
.ctgg-profile-card {
    background: var(--ctgg-surface);
    border: 1px solid var(--ctgg-border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    gap: 8px;
}

.ctgg-profile-avatar-lg {
    position: relative;
    width: 72px; height: 72px;
    border-radius: 50%; overflow: visible;
    flex-shrink: 0;
}
.ctgg-profile-avatar-lg img {
    width: 72px; height: 72px;
    border-radius: 50%; object-fit: cover;
    border: 3px solid rgba(198,57,184,.45);
    display: block;
}
.ctgg-av-lg-placeholder {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg,#6a1fa8,#c639b8);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 800; color: #fff;
    border: 3px solid rgba(198,57,184,.45);
}
.ctgg-profile-league-badge {
    position: absolute; bottom: -3px; right: -3px;
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; border: 2px solid rgba(0,0,0,.6);
}

.ctgg-profile-name {
    font-size: 17px; font-weight: 800; color: #fff;
    word-break: break-word; max-width: 100%;
}
.ctgg-profile-gameid    { font-size: 11px; color: var(--ctgg-muted); word-break: break-all; }
.ctgg-profile-league-row { font-size: 12px; color: var(--ctgg-primary); font-weight: 600; }

/* XP bar dentro del perfil */
.ctgg-profile-card .ctgg-xp-bar-wrap {
    width: 100%; margin: 4px 0;
}

/* Ligas — scroll táctil horizontal */
.ctgg-leagues-row {
    display: flex; gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 4px 0 8px;
}
.ctgg-leagues-row::-webkit-scrollbar { display: none; }
.ctgg-league-item {
    flex-shrink: 0;
    scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 10px;
    background: var(--ctgg-surface);
    border: 1.5px solid var(--ctgg-border);
    border-radius: 12px;
    min-width: 62px; /* reducido de 72px */
    transition: all .2s;
}
.ctgg-league-active {
    border-color: var(--lg-color, #c639b8);
    background: rgba(198,57,184,.12);
    box-shadow: 0 0 10px rgba(198,57,184,.18);
}
.ctgg-league-icon { font-size: 20px; }
.ctgg-league-name { font-size: 10px; font-weight: 700; color: #fff; }
.ctgg-league-xp   { font-size: 9px; color: var(--ctgg-muted); }

/* Stats grid — 2 col en móvil, 3 en desktop */
.ctgg-stats-grid-full {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 4px;
    width: 100%;
}
.ctgg-stat-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: var(--ctgg-surface);
    border: 1px solid var(--ctgg-border);
    border-radius: 12px; padding: 12px 8px; text-align: center;
    min-width: 0; box-sizing: border-box;
}
.ctgg-stat-icon { font-size: 16px; }
.ctgg-stat-val  { font-size: 16px; font-weight: 800; color: #fff; }
.ctgg-stat-lab  { font-size: 9px; color: var(--ctgg-muted); text-align: center; line-height: 1.3; }

/* ══════════════════════════════════════════════════════════════
   MISIONES — vista completa
   ══════════════════════════════════════════════════════════════ */
.ctgg-missions-wrap  { padding-bottom: 20px; width: 100%; box-sizing: border-box; }
.ctgg-missions-list  { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; width: 100%; }
.ctgg-mission-card {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--ctgg-surface); border: 1px solid var(--ctgg-border);
    border-radius: 12px; padding: 14px 12px; transition: border-color .2s;
    width: 100%; box-sizing: border-box;
}
.ctgg-mission-done { border-color: rgba(76,175,80,.3); background: rgba(76,175,80,.06); }
.ctgg-mission-icon { font-size: 22px; flex-shrink: 0; }
.ctgg-mission-body { flex: 1; min-width: 0; }
.ctgg-mission-title { font-size: 12px; font-weight: 700; color: #fff; margin-bottom: 2px; }
.ctgg-mission-desc  { font-size: 10px; color: var(--ctgg-muted); margin-bottom: 6px; }
.ctgg-mission-progress-row { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 9px; color: var(--ctgg-muted); flex-wrap: wrap; gap: 4px; }
.ctgg-mission-rewards { color: #4caf50; font-weight: 600; }
.ctgg-claim-btn {
    padding: 7px 11px;
    background: linear-gradient(135deg,#4caf50,#2e7d32);
    border: none; border-radius: 8px; color: #fff;
    font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit;
    white-space: nowrap; display: flex; align-items: center; gap: 4px; flex-shrink: 0;
    align-self: center;
}

/* ══════════════════════════════════════════════════════════════
   RANKING
   ══════════════════════════════════════════════════════════════ */
.ctgg-ranking-wrap { padding-bottom: 20px; width: 100%; box-sizing: border-box; }
.ctgg-ranking-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.ctgg-rank-row {
    display: flex; align-items: center; gap: 10px;
    background: var(--ctgg-surface); border: 1px solid var(--ctgg-border);
    border-radius: 10px; padding: 12px 14px; transition: all .15s;
    width: 100%; box-sizing: border-box;
}
.ctgg-rank-me { border-color: rgba(198,57,184,.4); background: rgba(198,57,184,.1); }
.ctgg-rank-pos { font-size: 16px; flex-shrink: 0; width: 28px; text-align: center; }
.ctgg-rank-av {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg,#6a1fa8,#c639b8);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.ctgg-rank-info { flex: 1; min-width: 0; }
.ctgg-rank-name   { font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctgg-rank-league { font-size: 9px; color: var(--ctgg-muted); }
.ctgg-rank-xp     { font-size: 11px; font-weight: 700; color: #ffd700; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   TIENDA
   ══════════════════════════════════════════════════════════════ */
.ctgg-store-wrap { padding-bottom: 20px; }
.ctgg-store-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.ctgg-store-balance { font-size: 13px; font-weight: 700; color: #ffd700; display: flex; align-items: center; gap: 5px; }
.ctgg-store-notice {
    background: rgba(76,175,80,.08); border: 1px solid rgba(76,175,80,.2);
    border-radius: 10px; padding: 8px 12px; font-size: 11px; color: rgba(76,175,80,.9);
    margin-bottom: 14px; display: flex; align-items: center; gap: 6px;
}
.ctgg-store-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.ctgg-store-item {
    background: var(--ctgg-surface);
    border: 1.5px solid var(--ctgg-border);
    border-radius: 12px; padding: 14px 10px; text-align: center;
    display: flex; flex-direction: column; gap: 6px; transition: all .2s;
    box-sizing: border-box;
}
.ctgg-store-item:hover { border-color: var(--item-color, rgba(255,255,255,.2)); transform: translateY(-2px); }
.ctgg-store-item-icon  { font-size: 26px; }
.ctgg-store-item-name  { font-size: 11px; font-weight: 700; color: #fff; }
.ctgg-store-item-type  { font-size: 9px; color: var(--ctgg-muted); text-transform: capitalize; }
.ctgg-store-item-price { font-size: 11px; font-weight: 700; color: #ffd700; display: flex; align-items: center; justify-content: center; gap: 4px; }
.ctgg-store-buy-btn {
    padding: 7px;
    background: var(--item-color, rgba(198,57,184,.3));
    border: none; border-radius: 8px; color: #fff;
    font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit;
    transition: opacity .15s; margin-top: 2px; width: 100%;
}
.ctgg-store-buy-btn:hover { opacity: .85; }

/* ══════════════════════════════════════════════════════════════
   OVERLAY + INPUT
   ══════════════════════════════════════════════════════════════ */
#ctggOverlay {
    display: none;
    position: fixed; inset: 0; z-index: 8000;
    background: rgba(0,0,0,.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center; justify-content: center;
}
.ctgg-input {
    background: rgba(255,255,255,.07);
    border: 1.5px solid rgba(255,255,255,.12);
    border-radius: 10px; padding: 11px 12px; color: #fff;
    font-size: 14px; font-family: 'Outfit', sans-serif; outline: none;
    width: 100%; box-sizing: border-box; transition: border-color .2s;
}
.ctgg-input:focus { border-color: rgba(198,57,184,.6); }
.ctgg-input::placeholder { color: rgba(255,255,255,.25); }
.ctgg-puzzle-solved-placeholder { text-align: center; padding: 40px; color: #4caf50; }

/* ══════════════════════════════════════════════════════════════
   TABLET  (≥ 600px)
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 600px) {
    .ctgg-games-grid { grid-template-columns: repeat(2, 1fr); display: grid; }
    .ctgg-store-grid { grid-template-columns: repeat(3, 1fr); }
    .ctgg-stats-grid-full { grid-template-columns: repeat(3, 1fr); }
    .ctgg-player-banner { flex-direction: row; }
    .ctgg-player-banner-right { flex: 1; min-width: 0; }
    .ctgg-mode-card { width: 140px; min-width: 140px; }
    .ctgg-content { padding: 14px 12px; }
    .ctgg-bnav { display: none; } /* ocultar bottom nav en tablet */
}

/* ══════════════════════════════════════════════════════════════
   DESKTOP (≥ 1024px)
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
    :root { --ctgg-sidebar-w: 68px; }
    .ctgg-header-subtitle { display: block; }
    .ctgg-games-grid { grid-template-columns: repeat(3, 1fr); }
    .ctgg-store-grid { grid-template-columns: repeat(4, 1fr); }
    .ctgg-stats-grid-full { grid-template-columns: repeat(3, 1fr); }
    .ctgg-profile-card { flex-direction: column; align-items: center; }
    .ctgg-side-item { font-size: 9px; }
    .ctgg-content { padding: 16px; }
    .ctgg-mode-card { width: 160px; min-width: 160px; }
}

/* ══════════════════════════════════════════════════════════════
   MÓVIL PEQUEÑO (≤ 360px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
    .ctgg-header-logo { font-size: 13px; }
    .ctgg-stat-pill   { padding: 3px 5px; font-size: 9px; }
    #ctggLeaguePill   { display: none; }
    .ctgg-mode-card   { width: 96px; min-width: 96px; }
    .ctgg-bnav-item   { font-size: 8px; }
    .ctgg-bnav-item i { font-size: 15px; }
    .ctgg-content     { padding: 10px 8px; }
}

/* ══════════════════════════════════════════════════════════════
   BOTTOM NAV CTG GAMES — inyectada por ctg-games-patch.js
   Clase: .ctgg-bnav (visible solo en móvil <600px)
   ══════════════════════════════════════════════════════════════ */
.ctgg-bnav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(4,4,15,.98);
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 5px 0 max(8px, env(safe-area-inset-bottom));
    flex-shrink: 0;
    z-index: 20;
    width: 100%;
    /* Altura fija para no comprimirse */
    min-height: 54px;
}

.ctgg-bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    padding: 4px 2px;
    min-height: 44px; /* área táctil mínima */
    border: none;
    background: none;
    color: rgba(255,255,255,.38);
    font-size: 9px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s;
    white-space: nowrap;
}
.ctgg-bnav-item i { font-size: 18px; display: block; transition: transform .1s; }
.ctgg-bnav-item:active i { transform: scale(.88); }
.ctgg-bnav-item.active { color: var(--ctgg-primary); }
.ctgg-bnav-item.active i { filter: drop-shadow(0 0 5px rgba(198,57,184,.7)); }

/* ══════════════════════════════════════════════════════════════
   SWIPE TÁCTIL
   ══════════════════════════════════════════════════════════════ */
.ctgg-dragging {
    cursor: grabbing !important;
    user-select: none !important;
    scroll-behavior: auto !important;
}
