/* PG Arcade — lobby, game shell and shared UI.
   Leans on the site theme: purple #c8a2ff -> orange #ffd27a gradient,
   dark panels, Bootstrap 5 utilities. Per-game accent arrives through
   the --pga-accent custom property. */

.pga-lobby, .pga-game-page, .pga-profile { --pga-accent: #c8a2ff; }

/* ---------------- Lobby ---------------- */

.pga-hero-title {
    display: inline-block; /* gradient spans the text, not the row */
    font-weight: 900;
    letter-spacing: .02em;
    background: linear-gradient(92deg, #c8a2ff 10%, #fff 50%, #ffd27a 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.pga-hero-sub { color: rgba(244, 239, 255, .7); }

.pga-stats-strip {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: .95rem;
    color: rgba(244, 239, 255, .75);
}
.pga-stats-strip strong { color: #ffd27a; }
.pga-dot { opacity: .4; }

.pga-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 16px;
    border-radius: 16px;
    background: rgba(20, 13, 36, .72);
    border: 1px solid rgba(200, 162, 255, .18);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.pga-card:hover {
    color: inherit;
    transform: translateY(-4px);
    border-color: var(--pga-accent);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5), 0 0 24px color-mix(in srgb, var(--pga-accent) 35%, transparent);
}
.pga-card::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--pga-accent), transparent);
    opacity: .8;
}

.pga-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.pga-card-icon {
    width: 46px; height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 12px;
    color: #1a1027;
    background: linear-gradient(135deg, var(--pga-accent), #fff3);
}
.pga-card-type {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--pga-accent);
}
.pga-card-name { font-size: 1.25rem; font-weight: 800; margin: 0 0 2px; }
.pga-card-tagline {
    font-size: .875rem;
    color: rgba(244, 239, 255, .65);
    margin: 0 0 14px;
    flex: 1;
}
.pga-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: .78rem;
    color: rgba(244, 239, 255, .6);
}
.pga-card-champ i { color: #ffd27a; }
.pga-card-champ-empty { opacity: .55; }
.pga-card-play {
    position: absolute;
    right: 14px; bottom: 46px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    color: #1a1027;
    background: linear-gradient(90deg, var(--pga-accent), #ffd27a);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease;
}
.pga-card:hover .pga-card-play { opacity: 1; transform: none; }

/* ---------------- Game page shell ---------------- */

.pga-back {
    width: 38px; height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(200, 162, 255, .12);
    border: 1px solid rgba(200, 162, 255, .25);
    color: inherit;
}
.pga-back:hover { color: #ffd27a; border-color: #ffd27a; }

.pga-game-title { font-weight: 800; }
.pga-game-title i { color: var(--pga-accent); }

.pga-chip {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(200, 162, 255, .12);
    border: 1px solid rgba(200, 162, 255, .28);
    white-space: nowrap;
}
.pga-chip-rank { color: #ffd27a; border-color: rgba(255, 210, 122, .5); }

#pg-arcade-stage {
    position: relative;
    border-radius: 16px;
    background:
        radial-gradient(900px 400px at 20% -10%, rgba(200, 162, 255, .12), transparent 60%),
        radial-gradient(800px 380px at 85% 110%, rgba(255, 210, 122, .09), transparent 60%),
        #0b0714;
    border: 1px solid rgba(200, 162, 255, .2);
    box-shadow: 0 16px 44px rgba(0, 0, 0, .45);
    overflow: hidden;
}
#pg-arcade-stage:fullscreen {
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pga-hud {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    font-size: .85rem;
    color: rgba(244, 239, 255, .75);
    border-bottom: 1px solid rgba(200, 162, 255, .14);
    position: relative;
    z-index: 3;
}
.pga-hud-item strong { color: #ffd27a; font-variant-numeric: tabular-nums; }
.pga-hud-spacer { flex: 1; }
.pga-hud-btn {
    background: none;
    border: 1px solid rgba(200, 162, 255, .3);
    border-radius: 8px;
    color: rgba(244, 239, 255, .8);
    width: 32px; height: 32px;
    cursor: pointer;
}
.pga-hud-btn:hover { color: #ffd27a; border-color: #ffd27a; }
.pga-hud-btn.muted { opacity: .45; }

#pga-canvas-host {
    position: relative;
    display: flex;
    justify-content: center;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
#pga-canvas-host canvas {
    display: block;
    touch-action: none;
    max-width: 100%;
}

/* SDK overlays (start / pause / game over) */
.pga-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 20px;
    background: rgba(8, 5, 16, .78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.pga-overlay h3 {
    font-weight: 900;
    letter-spacing: .03em;
    background: linear-gradient(92deg, #c8a2ff, #fff 55%, #ffd27a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin: 0;
}
.pga-overlay .pga-overlay-sub { color: rgba(244, 239, 255, .75); font-size: .95rem; }
.pga-overlay .pga-overlay-note { color: #ffd27a; font-size: .85rem; font-weight: 700; }
.pga-overlay-btn {
    margin-top: 6px;
    padding: 10px 26px;
    border: 0;
    border-radius: 999px;
    font-weight: 800;
    font-size: 1rem;
    color: #1a1027;
    background: linear-gradient(90deg, #c8a2ff, #ffd27a);
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(200, 162, 255, .4);
}
.pga-overlay-btn:hover { filter: brightness(1.08); }

/* ---------------- Panels / leaderboard ---------------- */

.pga-panel {
    position: relative;
    border-radius: 14px;
    padding: 16px;
    background: rgba(20, 13, 36, .72);
    border: 1px solid rgba(200, 162, 255, .16);
}
.pga-panel-title {
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(244, 239, 255, .7);
}
.pga-panel-title i { color: var(--pga-accent); }

.pga-tabs { display: inline-flex; gap: 4px; }
.pga-tabs button {
    border: 1px solid rgba(200, 162, 255, .25);
    background: none;
    color: rgba(244, 239, 255, .7);
    font-size: .78rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    cursor: pointer;
}
.pga-tabs button.active {
    color: #1a1027;
    background: linear-gradient(90deg, #c8a2ff, #ffd27a);
    border-color: transparent;
}

.pga-lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 10px;
}
.pga-lb-row:nth-child(odd) { background: rgba(255, 255, 255, .03); }
.pga-lb-rank {
    width: 26px;
    text-align: center;
    font-weight: 800;
    color: rgba(244, 239, 255, .55);
    font-variant-numeric: tabular-nums;
}
.pga-lb-top1 .pga-lb-rank { color: #ffd700; }
.pga-lb-top2 .pga-lb-rank { color: #c0c0c0; }
.pga-lb-top3 .pga-lb-rank { color: #cd7f32; }
.pga-lb-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.pga-lb-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    text-decoration: none;
}
.pga-lb-name:hover { color: #ffd27a; }
.pga-lb-score { font-weight: 800; color: #ffd27a; font-variant-numeric: tabular-nums; }

/* ---------------- Profile ---------------- */

.pga-profile-avatar { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; }
.pga-profile-best {
    font-size: 1.6rem;
    font-weight: 900;
    color: #ffd27a;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

/* ---------------- Connect Four lobby (game-injected DOM) ---------------- */

#pga-extra:not(:empty) { margin-top: 12px; }
.pga-c4-lobby { display: flex; flex-direction: column; gap: 10px; }
.pga-c4-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(20, 13, 36, .72);
    border: 1px solid rgba(200, 162, 255, .16);
}
.pga-c4-btn {
    border: 1px solid rgba(200, 162, 255, .35);
    background: rgba(200, 162, 255, .12);
    color: inherit;
    font-weight: 700;
    font-size: .85rem;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
}
.pga-c4-btn:hover { border-color: #ffd27a; color: #ffd27a; }
.pga-c4-btn.primary {
    color: #1a1027;
    background: linear-gradient(90deg, #c8a2ff, #ffd27a);
    border-color: transparent;
}

/* ---------------- Small screens ---------------- */

@media (max-width: 576px) {
    .pga-hud { font-size: .78rem; gap: 10px; padding: 8px 10px; }
    .pga-game-title { font-size: 1.2rem; }
}

/* ---------------- v2: presence / friends / rich profiles ---------------- */

.pga-online-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #7dffa8;
    box-shadow: 0 0 8px rgba(125, 255, 168, .9);
    margin-right: 5px;
    vertical-align: 1px;
}
.pga-online-pill strong { color: #7dffa8; }
.pga-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pga-card-playing { font-size: .72rem; font-weight: 700; color: #7dffa8; white-space: nowrap; }
.pga-chip-online { color: #7dffa8; border-color: rgba(125, 255, 168, .4); }

/* Friends panel */
.pga-friend-search { position: relative; }
.pga-friend-search input {
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(200, 162, 255, .3);
    border-radius: 999px;
    color: inherit;
    font-size: .85rem;
    padding: 6px 14px;
    width: 240px;
}
.pga-friend-search input:focus { outline: none; border-color: #ffd27a; }
#pga-friend-results {
    position: absolute;
    top: 110%; right: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 240px;
}
.pga-friend-result { text-align: left; background: #1a1027 !important; }
#pga-friend-requests:not(:empty) { margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.pga-friend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}
.pga-friend-card {
    border: 1px solid rgba(200, 162, 255, .16);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .03);
}
.pga-friend-card.online { border-color: rgba(125, 255, 168, .35); }
.pga-friend-card.pending { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pga-friend-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pga-friend-avatar { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.pga-friend-name { font-weight: 700; color: inherit; text-decoration: none; }
.pga-friend-name:hover { color: #ffd27a; }
.pga-friend-status { font-size: .75rem; color: rgba(244, 239, 255, .5); }
.pga-friend-status.is-online { color: #7dffa8; }
.pga-friend-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pga-friend-actions .pga-c4-btn { font-size: .72rem; padding: 4px 10px; }
.pga-c4-btn.danger { border-color: rgba(255, 107, 129, .4); }
.pga-c4-btn.danger:hover { color: #ff6b81; border-color: #ff6b81; }

/* Profile hero + XP */
.pga-profile-hero { --pga-accent: #c8a2ff; }
.pga-profile-avatar-wrap { position: relative; }
.pga-profile-avatar-wrap.is-online::after {
    content: '';
    position: absolute;
    right: -3px; bottom: -3px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #7dffa8;
    border: 3px solid #140d24;
}
.pga-level-chip {
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 999px;
    color: #1a1027;
    background: linear-gradient(90deg, #c8a2ff, #ffd27a);
    white-space: nowrap;
}
.pga-nowplaying { color: #7dffa8; font-weight: 600; }
.pga-xp-bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .08);
    overflow: hidden;
}
.pga-xp-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #8a63e8, #c8a2ff 45%, #ffd27a);
    box-shadow: 0 0 14px rgba(200, 162, 255, .7);
}

/* Stat tiles */
.pga-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.pga-tile {
    border: 1px solid rgba(200, 162, 255, .16);
    border-radius: 14px;
    background: rgba(20, 13, 36, .72);
    padding: 14px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pga-tile .v { font-size: 1.35rem; font-weight: 900; color: #ffd27a; font-variant-numeric: tabular-nums; }
.pga-tile .k { font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(244, 239, 255, .55); }
.pga-tile.gold { border-color: rgba(255, 215, 0, .45); }
.pga-tile.gold .v { color: #ffd700; }

/* Achievement badges */
.pga-badges {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.pga-badge {
    border: 1px solid rgba(200, 162, 255, .16);
    border-radius: 12px;
    padding: 12px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, .03);
}
.pga-badge.done { border-color: rgba(255, 210, 122, .5); }
.pga-badge.done .pga-badge-icon { color: #ffd27a; text-shadow: 0 0 14px rgba(255, 210, 122, .6); }
.pga-badge.locked { opacity: .38; filter: saturate(.4); }
.pga-badge-icon { font-size: 1.3rem; }
.pga-badge-name { font-weight: 800; font-size: .82rem; }
.pga-badge-desc { font-size: .7rem; color: rgba(244, 239, 255, .55); line-height: 1.3; }

/* Recent runs */
.pga-recent-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    font-size: .85rem;
}
.pga-recent-row:nth-child(odd) { background: rgba(255, 255, 255, .03); }
.pga-recent-row:hover { color: #ffd27a; }
.pga-recent-row i { color: var(--pga-accent, #c8a2ff); width: 18px; text-align: center; }
.pga-recent-row .g { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pga-recent-row .s { font-weight: 800; color: #ffd27a; font-variant-numeric: tabular-nums; }
.pga-recent-row .t { font-size: .72rem; color: rgba(244, 239, 255, .45); white-space: nowrap; }

/* Rank chips on the per-game cards */
.pga-chip-rank.r1 { color: #ffd700; border-color: rgba(255, 215, 0, .55); }
.pga-chip-rank.r3 { color: #c0c0c0; border-color: rgba(192, 192, 192, .5); }
.pga-chip-rank.r10 { color: #ffd27a; }
.pga-record { color: rgba(244, 239, 255, .75); font-weight: 600; }
