/* =====================================================
   CSS CUSTOM PROPERTIES
   ===================================================== */
:root {
    --c-bg:        #050912;
    --c-bg2:       #080d1a;
    --c-surface:   rgba(255,255,255,0.04);
    --c-surface2:  rgba(255,255,255,0.07);
    --c-surface3:  rgba(255,255,255,0.11);
    --c-border:    rgba(255,255,255,0.08);
    --c-border2:   rgba(255,255,255,0.18);
    --c-text:      #ffffff;
    --c-text2:     rgba(255,255,255,0.70);
    --c-text3:     rgba(255,255,255,0.45);

    --neon-cyan:   #00d4ff;
    --neon-gold:   #ffd700;
    --neon-green:  #00ff88;
    --neon-red:    #ff3366;
    --neon-purple: #a855f7;
    --neon-orange: #ff8c42;

    --glow-cyan:   0 0 20px rgba(0,212,255,0.55), 0 0 60px rgba(0,212,255,0.20);
    --glow-gold:   0 0 18px rgba(255,215,0,0.55),  0 0 50px rgba(255,215,0,0.18);
    --glow-green:  0 0 18px rgba(0,255,136,0.55),  0 0 50px rgba(0,255,136,0.18);
    --glow-red:    0 0 18px rgba(255,51,102,0.60),  0 0 50px rgba(255,51,102,0.20);

    --grad-cyan:   linear-gradient(135deg, #00d4ff 0%, #0055ff 100%);
    --grad-gold:   linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    --grad-green:  linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);
    --grad-red:    linear-gradient(135deg, #ff3366 0%, #ff6600 100%);
    --grad-purple: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    --grad-hero:   linear-gradient(135deg, #1a1f3c 0%, #0d1427 100%);

    --ff-display:  'Orbitron', 'SF Pro Display', monospace;
    --ff-ui:       'Rajdhani', 'SF Pro Text', sans-serif;
    --ff-body:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-snappy: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* =====================================================
   RESET
   ===================================================== */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
html { height: 100%; }

/* Keyboard / Telegram-remote focus ring — pointer users see nothing (:focus-visible),
   keyboard/remote users get a clear indicator. outline is drawn outside the box, so
   it survives the overflow:hidden on .btn-play and similar. */
:focus-visible {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 2px;
}

/* =====================================================
   BODY & ATMOSPHERE
   ===================================================== */
body {
    font-family: var(--ff-body);
    background: var(--c-bg);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--c-text);
    overflow-x: hidden;
    /* Layered stadium atmosphere */
    background-image:
        radial-gradient(ellipse 140% 55% at 50% -5%, rgba(0,212,255,0.09) 0%, transparent 60%),
        radial-gradient(ellipse 90% 45% at 10% 100%, rgba(100,50,255,0.08) 0%, transparent 55%),
        radial-gradient(ellipse 70% 40% at 90% 95%, rgba(255,215,0,0.05) 0%, transparent 55%),
        linear-gradient(180deg, #050912 0%, #080d1a 60%, #050912 100%);
    animation: atmosPulse 10s ease-in-out infinite alternate;
}
@keyframes atmosPulse {
    0%   { background-position: 0 0; }
    100% { background-position: 0 8px; }
}

/* Ambient BG canvas � fixed behind everything */
#bgCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
}

#app {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */
.glass-panel {
    background: var(--c-surface);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid var(--c-border);
    border-radius: 18px;
}
.neon-cyan-text   { color: var(--neon-cyan);   text-shadow: 0 0 12px rgba(0,212,255,0.7); }
.neon-gold-text   { color: var(--neon-gold);   text-shadow: 0 0 12px rgba(255,215,0,0.7); }
.neon-green-text  { color: var(--neon-green);  text-shadow: 0 0 12px rgba(0,255,136,0.7); }
.neon-red-text    { color: var(--neon-red);    text-shadow: 0 0 12px rgba(255,51,102,0.7); }
.neon-purple-text { color: var(--neon-purple); text-shadow: 0 0 12px rgba(168,85,247,0.7); }

/* =====================================================
   SCREENS
   ===================================================== */
.screen { display: none; }
.screen.active {
    display: block;
    animation: screenIn 0.32s var(--ease-out) both;
}
@keyframes screenIn {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.screen-scroll {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0 12px 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.game-layout {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 10px 0 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative; /* required for tournament countdown overlay */
}

/* Inner elements in game-layout: side margins so only canvas goes edge-to-edge */
.game-layout > .scoreboard,
.game-layout > .game-status,
.game-layout > .direction-selector {
    margin-left: 10px;
    margin-right: 10px;
}

.result-layout {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0 16px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* =====================================================
   SKELETON LOADERS
   ===================================================== */
@keyframes shimmerSlide {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}
.skeleton-avatar, .skeleton-line {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.05) 25%,
        rgba(255,255,255,0.12) 50%,
        rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmerSlide 1.6s ease-in-out infinite;
    border-radius: 8px;
}
.skeleton-avatar { width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0; }
.skeleton-line   { height: 14px; margin-bottom: 8px; }
.w55 { width: 55%; }
.w38 { width: 38%; }

/* =====================================================
   HOME HEADER
   ===================================================== */
.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 4px 6px;
}
.home-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-ball {
    font-size: 1.9rem;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.35));
    animation: floatBall 3.5s ease-in-out infinite;
}
@keyframes floatBall {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}
.logo-words {
    display: flex;
    flex-direction: column;
    line-height: 1;
}
.logo-main {
    font-family: var(--ff-display);
    font-size: 1.28rem;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #00d4ff 0%, #ffffff 60%, #00d4ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 8px rgba(0,212,255,0.5));
}
.logo-sub {
    font-family: var(--ff-ui);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    color: var(--c-text3);
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 3px;
}
.hdr-icon-btn {
    width: 42px; height: 42px;
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    color: var(--c-text2);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.hdr-icon-btn:active { transform: scale(0.92); }
.hdr-icon-btn:hover  { background: var(--c-surface3); color: var(--neon-cyan); box-shadow: var(--glow-cyan); }

/* =====================================================
   PLAYER HERO CARD
   ===================================================== */
.player-hero {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}
.player-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,212,255,0.04) 0%, transparent 60%);
    pointer-events: none;
}
.player-hero-loading { display: flex; align-items: center; gap: 14px; width: 100%; }
.skeleton-lines { flex: 1; }

/* Rendered by JS � see updatePlayerInfo() */
.ph-avatar {
    width: 54px; height: 54px;
    background: linear-gradient(135deg, #1a2a4a 0%, #0d1a30 100%);
    border: 2px solid var(--c-border2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    position: relative;
}
.ph-avatar::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(var(--neon-cyan), var(--neon-purple), var(--neon-cyan));
    z-index: -1;
    animation: avatarSpin 4s linear infinite;
    opacity: 0.7;
}
@keyframes avatarSpin { to { transform: rotate(360deg); } }
.ph-info { flex: 1; min-width: 0; }
.ph-name {
    font-family: var(--ff-ui);
    font-size: 1.08rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--c-text);
}
.ph-meta {
    font-size: 0.75rem;
    color: var(--c-text3);
    margin-top: 3px;
    font-weight: 500;
}
.ph-balance {
    font-family: var(--ff-display);
    font-size: 0.82rem;
    font-weight: 700;
    margin-top: 4px;
}
.ph-badge {
    font-family: var(--ff-display);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--neon-gold);
    background: rgba(255,215,0,0.12);
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 20px;
    padding: 4px 12px;
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(255,215,0,0.2);
}

/* =====================================================
   PLAY NOW BUTTON
   ===================================================== */
.btn-play {
    position: relative;
    width: 100%;
    padding: 0;
    background: var(--grad-cyan);
    border: none;
    border-radius: 18px;
    cursor: pointer;
    overflow: hidden;
    box-shadow:
        0 0 35px rgba(0,212,255,0.45),
        0 0 70px rgba(0,212,255,0.15),
        inset 0 1px 0 rgba(255,255,255,0.25);
    animation: playPulse 2.8s ease-in-out infinite;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 10px;
}
/* Bot match button variant */
.btn-play-bot {
    background: linear-gradient(135deg, #6a1ed8 0%, #9b3dff 50%, #c471ed 100%);
    box-shadow:
        0 0 35px rgba(154,61,255,0.45),
        0 0 70px rgba(154,61,255,0.15),
        inset 0 1px 0 rgba(255,255,255,0.25);
    animation: playPulseBot 2.8s ease-in-out infinite;
}
@keyframes playPulseBot {
    0%,100% { box-shadow: 0 0 35px rgba(154,61,255,0.45), 0 0 70px rgba(154,61,255,0.15), inset 0 1px 0 rgba(255,255,255,0.25); }
    50%      { box-shadow: 0 0 55px rgba(154,61,255,0.65), 0 0 100px rgba(154,61,255,0.25), inset 0 1px 0 rgba(255,255,255,0.25); }
}
.btn-play:active { transform: scale(0.97); }
@keyframes playPulse {
    0%,100% { box-shadow: 0 0 35px rgba(0,212,255,0.45), 0 0 70px rgba(0,212,255,0.15), inset 0 1px 0 rgba(255,255,255,0.25); }
    50%      { box-shadow: 0 0 55px rgba(0,212,255,0.65), 0 0 100px rgba(0,212,255,0.25), inset 0 1px 0 rgba(255,255,255,0.25); }
}
.btn-play-shimmer {
    position: absolute;
    top: 0; left: -70%;
    width: 50%; height: 100%;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.28) 50%, transparent 60%);
    animation: btnShimmer 3.2s ease-in-out infinite 0.8s;
    pointer-events: none;
}
@keyframes btnShimmer {
    0%   { left: -70%; }
    100% { left: 130%;  }
}
.btn-play-ring {
    position: absolute;
    inset: -2px;
    border-radius: 20px;
    background: conic-gradient(rgba(0,212,255,0.6), rgba(0,85,255,0.6), rgba(0,212,255,0.6));
    z-index: -1;
    animation: ringRotate 3s linear infinite;
}
@keyframes ringRotate { to { transform: rotate(360deg); } }
.btn-play-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
}
.btn-play-icon {
    font-size: 1.7rem;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}
.btn-play-labels { display: flex; flex-direction: column; text-align: left; }
.btn-play-title {
    font-family: var(--ff-display);
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
.btn-play-hint {
    font-family: var(--ff-ui);
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.72);
    font-weight: 500;
    margin-top: 2px;
}

/* =====================================================
   HOME ACTION BUTTONS
   ===================================================== */
.home-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.home-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 6px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    color: var(--c-text2);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.home-action-btn:hover  { background: var(--c-surface3); border-color: var(--c-border2); }
.home-action-btn:active { transform: scale(0.93); }
.ha-icon { font-size: 1.55rem; }
.ha-label {
    font-family: var(--ff-ui);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--c-text3);
}

/* =====================================================
   MODAL HEADER
   ===================================================== */
.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    /* Stay pinned to the top while the screen scrolls so Back + title never slide away */
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0 -12px;              /* bleed past the .screen-scroll side padding to the edges */
    padding: 18px 16px 10px;      /* keep content aligned (12px bleed + 4px original inset) */
    background: var(--c-bg);      /* opaque so scrolled content passes cleanly underneath */
    box-shadow: 0 6px 16px -8px rgba(0,0,0,0.6);
}
.hdr-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    color: var(--c-text2);
    font-family: var(--ff-ui);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 14px 8px 10px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
}
.hdr-back-btn:active { transform: scale(0.94); }
.hdr-back-btn:hover  { background: var(--c-surface3); color: #fff; }
.modal-title {
    flex: 1;
    font-family: var(--ff-display);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--c-text);
    text-align: right;
}
.title-pulse-dot {
    display: inline-block;
    width: 9px; height: 9px;
    background: var(--neon-green);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 8px var(--neon-green);
    animation: dotPulse 1.2s ease-in-out infinite;
    vertical-align: middle;
}
@keyframes dotPulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.7); }
}

/* =====================================================
   BUTTON SYSTEM
   ===================================================== */
.btn-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.btn-neon {
    width: 100%;
    padding: 15px 24px;
    border: none;
    border-radius: 14px;
    font-family: var(--ff-ui);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.btn-neon:active { transform: scale(0.96); }
.btn-neon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}
.btn-neon:hover::before { transform: translateX(100%); }

.btn-neon-cyan {
    background: var(--grad-cyan);
    color: #fff;
    box-shadow: 0 0 24px rgba(0,212,255,0.4), 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-neon-cyan:hover  { box-shadow: var(--glow-cyan), 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2); }

.btn-neon-green {
    background: var(--grad-green);
    color: #fff;
    box-shadow: 0 0 24px rgba(0,255,136,0.4), 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-neon-green:hover  { box-shadow: var(--glow-green), 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2); }

.btn-neon:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }

.btn-ghost {
    width: 100%;
    padding: 13px 24px;
    background: transparent;
    border: 1px solid var(--c-border2);
    border-radius: 14px;
    color: var(--c-text2);
    font-family: var(--ff-ui);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.14s;
}
.btn-ghost:hover  { background: var(--c-surface2); color: #fff; }
.btn-ghost:active { transform: scale(0.96); }
.btn-ghost-danger { border-color: rgba(255,51,102,0.35); color: rgba(255,120,140,0.85); }
.btn-ghost-danger:hover { background: rgba(255,51,102,0.08); border-color: rgba(255,51,102,0.6); color: var(--neon-red); }

/* =====================================================
   JOIN SCREEN
   ===================================================== */
.join-card {
    padding: 28px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.join-icon { font-size: 2.6rem; filter: drop-shadow(0 0 12px rgba(255,215,0,0.4)); }
.join-hint {
    font-size: 0.84rem;
    color: var(--c-text3);
    line-height: 1.5;
    max-width: 280px;
}
.code-input {
    width: 100%;
    padding: 16px;
    background: rgba(255,255,255,0.08);
    border: 1.5px solid var(--c-border2);
    border-radius: 12px;
    color: var(--c-text);
    font-family: var(--ff-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    caret-color: var(--neon-cyan);
}
.code-input::placeholder { color: rgba(255,255,255,0.2); letter-spacing: 6px; }
.code-input:focus {
    border-color: var(--neon-cyan);
    background: rgba(0,212,255,0.06);
    box-shadow: 0 0 0 3px rgba(0,212,255,0.12), var(--glow-cyan);
}

.join-section-title {
    font-family: var(--ff-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--c-text);
    margin: 0;
}

/* Code row: input + copy + share inline */
.private-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.private-code-row .code-input-sm {
    flex: 1;
    min-width: 0;
    font-size: 1.2rem;
    letter-spacing: 6px;
    padding: 14px 12px;
}
.code-action-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1.5px solid var(--c-border2);
    background: rgba(255,255,255,0.06);
    color: var(--c-text2);
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.14s;
}
.code-action-btn:hover {
    background: rgba(0,212,255,0.12);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}
.code-action-btn:active { transform: scale(0.92); }
.code-action-btn.copied {
    border-color: var(--neon-green, #00ff88);
    color: var(--neon-green, #00ff88);
    background: rgba(0,255,136,0.1);
}
.code-action-share:hover {
    background: rgba(255,170,0,0.12);
    border-color: #ffaa00;
    color: #ffaa00;
}

/* OR divider between the two cards */
.join-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--c-text3);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 2px;
    padding: 4px 0;
}
.join-divider::before,
.join-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--c-border2);
}

/* =====================================================
   MATCHMAKING SCREEN
   ===================================================== */
.mm-arena {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}
.mm-card {
    flex: 1;
    padding: 20px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}
.mm-card-you {
    border-color: rgba(0,212,255,0.3);
    background: rgba(0,212,255,0.04);
}
.mm-card-you::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,212,255,0.06) 0%, transparent 60%);
    pointer-events: none;
}
.mm-card-opp {
    border-color: rgba(255,51,102,0.25);
    background: rgba(255,51,102,0.04);
}
.mm-avatar {
    width: 58px; height: 58px;
    background: var(--c-surface3);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.7rem;
    border: 2px solid var(--c-border2);
}
.mm-avatar-you {
    border-color: rgba(0,212,255,0.5);
    box-shadow: 0 0 16px rgba(0,212,255,0.3);
}
.mm-avatar-opp {
    border-color: rgba(255,51,102,0.4);
    animation: oppPulse 2s ease-in-out infinite;
}
@keyframes oppPulse {
    0%,100% { box-shadow: 0 0 10px rgba(255,51,102,0.2); }
    50%      { box-shadow: 0 0 22px rgba(255,51,102,0.45); }
}
.mm-name {
    font-family: var(--ff-ui);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--c-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 90px;
}
.mm-rating {
    font-family: var(--ff-display);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--c-text3);
    letter-spacing: 0.5px;
}

/* Radar animation */
.mm-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 84px;
}
.mm-radar-wrap {
    position: relative;
    width: 76px; height: 76px;
    display: flex; align-items: center; justify-content: center;
}
.mm-radar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid rgba(0,212,255,0.25);
}
.mm-radar-ring.r1 { width: 76px; height: 76px; animation: radarPulse 2.4s ease-out infinite;         }
.mm-radar-ring.r2 { width: 76px; height: 76px; animation: radarPulse 2.4s ease-out infinite 0.6s;    }
.mm-radar-ring.r3 { width: 76px; height: 76px; animation: radarPulse 2.4s ease-out infinite 1.2s;    }
@keyframes radarPulse {
    0%   { transform: scale(0.3); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}
.mm-radar-sweep {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 300deg, rgba(0,212,255,0.4) 360deg);
    animation: sweepSpin 1.8s linear infinite;
}
@keyframes sweepSpin { to { transform: rotate(360deg); } }
.mm-vs-label {
    position: relative;
    font-family: var(--ff-display);
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--c-text);
    text-shadow: 0 0 14px rgba(0,212,255,0.6);
    z-index: 1;
}

.queue-status-box {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.queue-dots-row {
    display: flex;
    gap: 8px;
}
.qdot {
    width: 10px; height: 10px;
    background: var(--neon-cyan);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
    box-shadow: 0 0 8px var(--neon-cyan);
}
.qdot:nth-child(2) { animation-delay: 0.2s; }
.qdot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
    0%,100% { transform: translateY(0);   opacity: 0.55; }
    50%      { transform: translateY(-8px); opacity: 1; }
}
.queue-msg {
    font-family: var(--ff-ui);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--c-text2);
}
.queue-size-text {
    font-family: var(--ff-display);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255,215,0,0.5);
}

/* =====================================================
   LOBBY
   ===================================================== */
.room-code-panel {
    padding: 22px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: rgba(255,215,0,0.04);
    border-color: rgba(255,215,0,0.2);
}
.rcp-label {
    font-family: var(--ff-ui);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--c-text3);
}
.rcp-code {
    font-family: var(--ff-display);
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 8px;
}
.rcp-hint { font-size: 0.72rem; color: var(--c-text3); }
.players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.player-item {
    padding: 14px 16px;
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--ff-ui);
    font-size: 0.92rem;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
}
.player-item.ready {
    background: rgba(0,255,136,0.08);
    border-color: rgba(0,255,136,0.35);
    box-shadow: 0 0 12px rgba(0,255,136,0.12);
}
.player-item.ready .ready-tag { color: var(--neon-green); }
.ready-tag {
    font-size: 0.75rem;
    color: var(--c-text3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =====================================================
   GAMEPLAY � SCOREBOARD
   ===================================================== */
.scoreboard {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 6px;
    border-radius: 16px;
}
/* In-game exit (Home) button + matching spacer keep .sb-center perfectly centered */
.sb-exit-btn {
    flex: 0 0 30px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border: none;
    border-radius: 9px;
    background: rgba(255,255,255,0.06);
    color: var(--c-text2);
    cursor: pointer;
    transition: background .2s var(--ease-out), color .2s var(--ease-out), transform .15s var(--ease-out);
}
.sb-exit-btn:hover  { background: rgba(255,51,102,0.16); color: var(--neon-red); }
.sb-exit-btn:active { transform: scale(0.9); }
.sb-exit-spacer { flex: 0 0 30px; }
.sb-player { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sb-left  { text-align: left; }
.sb-right { text-align: right; align-items: flex-end; }
.sb-name {
    font-family: var(--ff-ui);
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--c-text3);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
}
.sb-score {
    font-family: var(--ff-display);
    font-size: 2.4rem;
    font-weight: 900;
    line-height: 1.05;
    transition: transform 0.2s var(--ease-spring);
}
.sb-score.score-pop { animation: scorePop 0.4s var(--ease-spring); }
@keyframes scorePop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}
.sb-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-width: 130px;
}
.sb-round-wrap { text-align: center; }
.sb-round-label {
    display: block;
    font-family: var(--ff-display);
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: var(--c-text3);
    text-transform: uppercase;
}
.sb-round-val {
    font-family: var(--ff-display);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--c-text);
}
.sb-round-sep { opacity: 0.4; margin: 0 2px; }

/* Ball timer — replaces SVG ring */
.sb-timer-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}
.ball-timer {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 1px;
    white-space: nowrap;
}
.bt-ball {
    font-size: 11px;
    line-height: 1;
    width: 13px;
    display: block;
    text-align: center;
    overflow: hidden;
    transition: opacity 0.25s ease, filter 0.25s ease;
    user-select: none;
    flex-shrink: 0;
}
.bt-ball.bt-empty {
    opacity: 0.22;
    filter: grayscale(1) brightness(1.4);
}
.bt-ball.bt-urgent {
    animation: ballUrgent 0.45s ease infinite;
}
@keyframes ballUrgent {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.3); }
}

/* legacy timer id ✦ mapped to .timer-ring-val colour */
.timer-ring-val.timer-urgent { color: var(--neon-red); text-shadow: 0 0 10px rgba(255,51,102,0.8); }

/* =====================================================
   GAMEPLAY � CANVAS
   ===================================================== */
.canvas-wrapper {
    border-radius: 14px;
    overflow: hidden;
    background: #071408;
    position: relative;
    box-shadow:
        0 0 0 1px rgba(0,212,255,0.08),
        0 8px 32px rgba(0,0,0,0.6) inset,
        0 4px 24px rgba(0,0,0,0.55);
    width: 100%;
}
#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: default;
    touch-action: none;
}
#gameCanvas.zones-active { cursor: crosshair; }

/* =====================================================
   GAME STATUS BAR
   ===================================================== */
.game-status {
    padding: 12px 16px;
    text-align: center;
    font-family: var(--ff-ui);
    font-size: 0.96rem;
    font-weight: 700;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.3px;
    border-radius: 14px;
    transition: background 0.3s ease;
}

/* =====================================================
   ROLE BANNER
   ===================================================== */
.role-banner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    margin-left: 10px;
    margin-right: 10px;
    border-radius: 14px;
    font-family: var(--ff-ui);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    transition: background 0.25s var(--ease-spring), border-color 0.25s var(--ease-spring), color 0.25s var(--ease-spring);
}
.role-banner.atk {
    display: flex;
    background: rgba(0, 255, 136, 0.08);
    border-color: rgba(0, 255, 136, 0.4);
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}
.role-banner.def {
    display: flex;
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.4);
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}
.role-icon { font-size: 1.2rem; line-height: 1; }
.role-text { font-size: 1.05rem; font-weight: 900; letter-spacing: 1px; }
.role-hint { font-size: 0.78rem; font-weight: 500; opacity: 0.7; margin-left: 4px; }

/* =====================================================
   DIRECTION SELECTOR
   ===================================================== */
.direction-selector { display: flex; flex-direction: column; gap: 8px; }
.direction-label {
    text-align: center;
    font-family: var(--ff-display);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--c-text3);
}
.direction-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.direction-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 13px 4px 11px;
    background: var(--c-surface);
    border: 1.5px solid var(--c-border);
    border-radius: 12px;
    color: var(--c-text);
    cursor: pointer;
    transition:
        transform 0.12s ease,
        border-color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.direction-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 100%);
    pointer-events: none;
}
.direction-btn:active:not(:disabled) { transform: scale(0.90); }
.direction-btn:hover:not(:disabled)  {
    background: var(--c-surface3);
    transform: scale(1.05);
}
.dir-zone-num {
    font-family: var(--ff-display);
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0;
    background: rgba(255,255,255,0.10);
    border-radius: 4px;
    padding: 1px 7px;
    opacity: 0.75;
    line-height: 1.4;
    transition: background 0.15s;
}
.dir-arrow { font-size: 1.35rem; line-height: 1; }
.dir-name  { font-size: 0.58rem; font-weight: 600; opacity: 0.65; text-align: center; line-height: 1.2; font-family: var(--ff-ui); }

/* Zone-top � warm orange */
.direction-btn.zone-top {
    border-top: 2px solid rgba(255,140,66,0.4);
    background: rgba(255,90,20,0.05);
}
.direction-btn.zone-top:hover:not(:disabled) {
    border-color: rgba(255,140,66,0.70);
    background: rgba(255,90,20,0.13);
    box-shadow: 0 0 16px rgba(255,140,66,0.22);
}
/* Zone-bottom � cool blue */
.direction-btn.zone-bottom {
    border-bottom: 2px solid rgba(80,160,255,0.4);
    background: rgba(30,80,255,0.05);
}
.direction-btn.zone-bottom:hover:not(:disabled) {
    border-color: rgba(80,160,255,0.70);
    background: rgba(30,80,255,0.13);
    box-shadow: 0 0 16px rgba(80,160,255,0.22);
}
/* Shooter context */
.direction-btn.shooter-btn { border-color: rgba(255,140,66,0.42); background: rgba(255,100,30,0.07); }
.direction-btn.shooter-btn:hover:not(:disabled) { border-color: #ff8c42; background: rgba(255,100,30,0.18); box-shadow: 0 0 18px rgba(255,140,66,0.28); }
.direction-btn.shooter-btn .dir-zone-num { background: rgba(255,140,66,0.22); }
/* Keeper context */
.direction-btn.keeper-btn  { border-color: rgba(80,160,255,0.42); background: rgba(30,80,255,0.07); }
.direction-btn.keeper-btn:hover:not(:disabled) { border-color: #50a0ff; background: rgba(30,80,255,0.18); box-shadow: 0 0 18px rgba(80,160,255,0.28); }
.direction-btn.keeper-btn .dir-zone-num { background: rgba(80,160,255,0.22); }
/* Selected */
.direction-btn.selected {
    background: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);
    border-color: #00ff88;
    color: #03200f;
    box-shadow: 0 0 22px rgba(0,255,136,0.60), 0 0 44px rgba(0,212,255,0.22);
    transform: scale(1.06);
    animation: zonePulse 0.95s ease-in-out infinite;
}
.direction-btn.selected .dir-arrow,
.direction-btn.selected .dir-name,
.direction-btn.selected .dir-zone-num { color: #03200f; opacity: 1; }
.direction-btn.selected .dir-zone-num { background: rgba(3,32,15,0.20); }
@keyframes zonePulse {
    0%,100% { box-shadow: 0 0 22px rgba(0,255,136,0.60), 0 0 44px rgba(0,212,255,0.22); }
    50%      { box-shadow: 0 0 34px rgba(0,255,136,0.85), 0 0 70px rgba(0,212,255,0.38); }
}
.direction-btn:disabled { opacity: 0.30; cursor: not-allowed; transform: none !important; }

/* =====================================================
   CANVAS LOADING OVERLAY
   ===================================================== */
.clo {
    position: absolute; inset: 0;
    background: rgba(5,9,18,0.92);
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
    z-index: 20;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.clo-inner { text-align: center; width: 72%; max-width: 260px; }
.clo-spinner {
    width: 42px; height: 42px;
    border: 3.5px solid rgba(0,212,255,0.15);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
    box-shadow: 0 0 14px rgba(0,212,255,0.3);
}
@keyframes spin { to { transform: rotate(360deg); } }
.clo-track {
    height: 5px; background: rgba(255,255,255,0.08);
    border-radius: 3px; overflow: hidden; margin-bottom: 10px;
}
.clo-bar {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #00d4ff, #00ff88);
    border-radius: 3px;
    transition: width 0.22s ease;
    box-shadow: 0 0 8px var(--neon-cyan);
}
.clo-text { font-size: 0.72rem; font-weight: 600; color: rgba(255,255,255,0.5); letter-spacing: 0.3px; font-family: var(--ff-ui); }

/* =====================================================
   GOAL NOTIFICATION OVERLAY
   ===================================================== */
.goal-notification {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    font-family: var(--ff-display);
    font-size: clamp(2rem, 14vw, 3.8rem);
    font-weight: 900;
    letter-spacing: 4px;
    color: #fff;
    text-align: center;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    text-shadow: 0 4px 30px rgba(0,0,0,0.9);
    line-height: 1.1;
    white-space: nowrap;
}
.goal-notification.show-goal {
    animation: goalIn 2.8s var(--ease-spring) forwards;
    color: #ff5252;
    text-shadow: 0 0 30px rgba(255,82,82,0.9), 0 4px 24px rgba(0,0,0,0.9);
}
.goal-notification.show-save {
    animation: goalIn 2.8s var(--ease-spring) forwards;
    color: #00ff88;
    text-shadow: 0 0 30px rgba(0,255,136,0.9), 0 4px 24px rgba(0,0,0,0.9);
}
@keyframes goalIn {
    0%   { opacity: 0; transform: translate(-50%,-50%) scale(0.5); }
    20%  { opacity: 1; transform: translate(-50%,-50%) scale(1.1); }
    35%  { transform: translate(-50%,-50%) scale(0.96); }
    50%  { opacity: 1; transform: translate(-50%,-50%) scale(1.0); }
    80%  { opacity: 1; transform: translate(-50%,-50%) scale(1.0); }
    100% { opacity: 0; transform: translate(-50%,-50%) scale(0.8); }
}

/* =====================================================
   RESULT SCREEN
   ===================================================== */
.result-confetti-canvas {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}
.result-emblem {
    position: relative;
    width: 120px; height: 120px;
    display: flex; align-items: center; justify-content: center;
    animation: emblemIn 0.7s var(--ease-spring) 0.2s both;
}
@keyframes emblemIn {
    from { opacity: 0; transform: scale(0.3) rotate(-30deg); }
    to   { opacity: 1; transform: scale(1) rotate(0deg); }
}
.result-emblem-ring {
    position: absolute; inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255,215,0,0.3);
}
.re-ring1 { animation: ringExpand 2.5s ease-out infinite; }
.re-ring2 { animation: ringExpand 2.5s ease-out infinite 0.85s; border-color: rgba(0,212,255,0.25); }
@keyframes ringExpand {
    0%   { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(2.0); opacity: 0; }
}
.result-emblem-core {
    width: 80px; height: 80px;
    background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, rgba(255,215,0,0.04) 100%);
    border: 2px solid rgba(255,215,0,0.5);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 30px rgba(255,215,0,0.3), inset 0 0 20px rgba(255,215,0,0.06);
}
.result-icon { font-size: 2.4rem; filter: drop-shadow(0 0 14px rgba(255,215,0,0.7)); }

.result-headline {
    font-family: var(--ff-display);
    font-size: clamp(2rem, 10vw, 2.8rem);
    font-weight: 900;
    letter-spacing: 4px;
    text-align: center;
    animation: headlineIn 0.65s var(--ease-spring) 0.4s both;
}
@keyframes headlineIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.result-headline.win-text  { color: var(--neon-gold);  text-shadow: var(--glow-gold); }
.result-headline.lose-text { color: var(--c-text2); }
.result-headline.draw-text { color: var(--neon-cyan);  text-shadow: var(--glow-cyan); }

.result-subline {
    font-family: var(--ff-ui);
    font-size: 0.9rem;
    color: var(--c-text3);
    font-weight: 500;
    letter-spacing: 0.5px;
    animation: headlineIn 0.6s var(--ease-spring) 0.55s both;
}

.result-score-card {
    width: 100%;
    padding: 22px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: headlineIn 0.6s var(--ease-spring) 0.65s both;
}
/* Player name labels — flex-shrink & min-width allow ellipsis on long names */
.rsc-name {
    flex: 1;
    min-width: 0;
    font-family: var(--ff-ui);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--c-text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rsc-name-p1 { text-align: left; }
.rsc-name-p2 { text-align: right; }
/* Score block: Score1 — colon — Score2 */
.rsc-score-block {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.rsc-score {
    font-family: var(--ff-display);
    font-size: 3.2rem;
    font-weight: 900;
    color: var(--neon-gold);
    line-height: 1;
    text-shadow: var(--glow-gold);
}
.rsc-mid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
    flex-shrink: 0;
}
.rsc-colon { font-family: var(--ff-display); font-size: 2rem; font-weight: 900; color: var(--c-text3); }
.rsc-label { font-family: var(--ff-display); font-size: 0.6rem; letter-spacing: 2px; color: var(--c-text3); text-transform: uppercase; }
/* Legacy selectors kept for backward compatibility */
.rsc-side { display: none; }

.result-rating-change {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    animation: headlineIn 0.6s var(--ease-spring) 0.75s both;
}
.rrc-label { font-family: var(--ff-ui); font-size: 0.8rem; font-weight: 600; color: var(--c-text3); }
.rrc-value {
    font-family: var(--ff-display);
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--neon-green);
    text-shadow: var(--glow-green);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    animation: headlineIn 0.6s var(--ease-spring) 0.85s both;
}

/* =====================================================
   TOURNAMENT MATCH RESULT SCREEN
   ===================================================== */

/* Round name badge displayed at the top of the tournament result screen */
.trn-round-badge {
    font-family: var(--ff-display);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--neon-cyan);
    background: rgba(0,212,255,.12);
    border: 1px solid rgba(0,212,255,.4);
    border-radius: 20px;
    padding: 5px 18px;
    animation: headlineIn .5s var(--ease-spring) .05s both;
}

/* "Next match in Xs" countdown row */
.trn-result-countdown-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
    text-align: center;
    animation: headlineIn .5s var(--ease-spring) .9s both;
}
.trn-result-cd-label {
    font-family: var(--ff-ui);
    font-size: .82rem;
    color: var(--c-text3);
}
.trn-result-cd-number {
    font-family: var(--ff-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neon-gold);
    text-shadow: var(--glow-gold);
    min-width: 2ch;
    text-align: center;
    transition: color .2s;
}

/* =====================================================
   LEADERBOARD
   ===================================================== */
.lb-podium {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 4px;
    margin-bottom: 6px;
}
.lb-podium-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px 0;
    border-radius: 16px 16px 0 0;
    position: relative;
    overflow: hidden;
    animation: podiumRise 0.5s var(--ease-spring) both;
}
.lb-podium-item:nth-child(1) { animation-delay: 0.10s; }
.lb-podium-item:nth-child(2) { animation-delay: 0.25s; }
.lb-podium-item:nth-child(3) { animation-delay: 0.40s; }
@keyframes podiumRise {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Pedestal: 2nd on the left, 1st elevated in the centre, 3rd on the right */
.lb-p1 {
    background: linear-gradient(180deg, rgba(255,215,0,0.12) 0%, rgba(255,215,0,0.04) 100%);
    border: 1px solid rgba(255,215,0,0.35);
    box-shadow: 0 0 24px rgba(255,215,0,0.18);
    order: 2;
    padding-top: 10px;
}
.lb-p2 {
    background: linear-gradient(180deg, rgba(192,192,192,0.10) 0%, rgba(192,192,192,0.03) 100%);
    border: 1px solid rgba(192,192,192,0.25);
    order: 1;
}
.lb-p3 {
    background: linear-gradient(180deg, rgba(205,127,50,0.10) 0%, rgba(205,127,50,0.03) 100%);
    border: 1px solid rgba(205,127,50,0.25);
    order: 3;
}
.lb-p-crown { font-size: 1.4rem; }
.lb-p1 .lb-p-crown { font-size: 1.7rem; }
.lb-p-avatar {
    width: 46px; height: 46px;
    background: var(--c-surface3);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    border: 2px solid rgba(255,255,255,0.15);
    overflow: hidden;
    flex-shrink: 0;
}
.lb-p-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.lb-p1 .lb-p-avatar { width: 58px; height: 58px; border-color: rgba(255,215,0,0.5); box-shadow: 0 0 12px rgba(255,215,0,0.3); }

/* Pedestal base block — stepped heights give the podium silhouette */
.lb-p-base {
    width: 100%;
    margin-top: 4px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 6px;
    font-family: var(--ff-display);
    font-weight: 900;
}
.lb-p1 .lb-p-base { height: 44px; background: linear-gradient(180deg, rgba(255,215,0,0.28), rgba(255,215,0,0.05)); }
.lb-p2 .lb-p-base { height: 30px; background: linear-gradient(180deg, rgba(192,192,192,0.26), rgba(192,192,192,0.05)); }
.lb-p3 .lb-p-base { height: 22px; background: linear-gradient(180deg, rgba(205,127,50,0.26), rgba(205,127,50,0.05)); }
.lb-p-base-rank { font-size: 1.1rem; line-height: 1; }
.lb-p1 .lb-p-base-rank { color: var(--neon-gold); font-size: 1.4rem; text-shadow: 0 0 8px rgba(255,215,0,0.6); }
.lb-p2 .lb-p-base-rank { color: #c0c0c0; }
.lb-p3 .lb-p-base-rank { color: #cd7f32; }
.lb-p-rank {
    font-family: var(--ff-display);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.5px;
}
.lb-p1 .lb-p-rank { color: var(--neon-gold); text-shadow: 0 0 8px rgba(255,215,0,0.6); }
.lb-p2 .lb-p-rank { color: #c0c0c0; }
.lb-p3 .lb-p-rank { color: #cd7f32; }
.lb-p-name {
    font-family: var(--ff-ui);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--c-text2);
    text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80px;
}
.lb-p-rating {
    font-family: var(--ff-display);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--c-text3);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 2px;
}
.leaderboard-list::-webkit-scrollbar { width: 4px; }
.leaderboard-list::-webkit-scrollbar-track  { background: rgba(0,0,0,0.2); border-radius: 4px; }
.leaderboard-list::-webkit-scrollbar-thumb  { background: rgba(0,212,255,0.3); border-radius: 4px; }

.leaderboard-item {
    padding: 13px 16px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.18s;
    animation: lbItemIn 0.35s var(--ease-out) both;
}
.leaderboard-item:hover { background: var(--c-surface2); }
@keyframes lbItemIn {
    from { opacity: 0; transform: translateX(-14px); }
    to   { opacity: 1; transform: translateX(0); }
}
.leaderboard-rank {
    font-family: var(--ff-display);
    font-size: 0.85rem;
    font-weight: 800;
    min-width: 32px;
    color: var(--c-text3);
}
.lb-item-avatar {
    width: 40px; height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--c-surface3);
    border: 2px solid rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--ff-ui);
    font-weight: 700;
    font-size: 1rem;
    color: var(--c-text2);
    overflow: hidden;
}
.lb-item-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lb-item-avatar.tier-diamond  { border-color: var(--tier-diamond); }
.lb-item-avatar.tier-platinum { border-color: var(--tier-platinum); }
.lb-item-avatar.tier-gold     { border-color: var(--tier-gold); }
.lb-item-avatar.tier-silver   { border-color: var(--tier-silver); }
.lb-item-avatar.tier-bronze   { border-color: var(--tier-bronze); }
.lb-item-avatar.tier-iron     { border-color: var(--tier-iron); }
.leaderboard-player { flex: 1; min-width: 0; }
.leaderboard-player strong { display: block; font-size: 0.9rem; font-family: var(--ff-ui); font-weight: 700; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaderboard-player small  { display: block; font-size: 0.72rem; color: var(--c-text3); margin-top: 2px; }
.leaderboard-rating {
    font-family: var(--ff-display);
    font-size: 1rem;
    font-weight: 800;
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255,215,0,0.4);
}

/* =====================================================
   PROFILE SCREEN
   ===================================================== */
.profile-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 20px;
    position: relative;
    overflow: hidden;
}
.profile-hero::before {
    content: '';
    position: absolute;
    top: 0; left: -20px; right: -20px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,212,255,0.4), transparent);
}
.profile-avatar {
    width: 62px; height: 62px;
    background: linear-gradient(135deg, #1a2a4a 0%, #0d1a30 100%);
    border: 2px solid rgba(0,212,255,0.4);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    box-shadow: 0 0 18px rgba(0,212,255,0.25);
}
.profile-avatar-img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name {
    font-family: var(--ff-ui);
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--c-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-sub { font-size: 0.76rem; color: var(--c-text3); margin-top: 3px; font-weight: 500; }
.profile-rank-badge {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px rgba(255,215,0,0.5));
    flex-shrink: 0;
}

.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.stat-card {
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-radius: 14px;
    text-align: center;
}
.sc-val {
    font-family: var(--ff-display);
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
}
.sc-lbl {
    font-family: var(--ff-ui);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-text3);
}

.winrate-panel {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wrp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wrp-label { font-family: var(--ff-ui); font-size: 0.82rem; font-weight: 600; color: var(--c-text2); }
.wrp-value { font-family: var(--ff-display); font-size: 1rem; font-weight: 800; }
.wrp-track {
    height: 8px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
}
.wrp-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00d4ff);
    border-radius: 4px;
    transition: width 1.2s var(--ease-out);
    box-shadow: 0 0 10px rgba(0,255,136,0.5);
}
.wrp-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--c-text3);
    font-family: var(--ff-ui);
}
.wrl-wins   { color: var(--neon-green);  }
.wrl-losses { color: var(--neon-red); }

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: rgba(12,18,40,0.96);
    color: #fff;
    padding: 12px 24px;
    border-radius: 40px;
    font-family: var(--ff-ui);
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 99999;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    transition: transform 0.35s var(--ease-spring), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast-error { border-color: rgba(255,51,102,0.45); background: rgba(60,10,20,0.96); color: #ff8899; }
.toast-info  { border-color: rgba(0,212,255,0.35); }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 400px) {
    .screen-scroll { padding-left: 8px; padding-right: 8px; }
    .game-layout > .scoreboard,
    .game-layout > .game-status,
    .game-layout > .direction-selector { margin-left: 6px; margin-right: 6px; }
    .sb-score     { font-size: 2rem; }
    .sb-name      { font-size: 0.66rem; }
    .timer-ring-val { font-size: 0.88rem; }
    .logo-main    { font-size: 1.1rem; }
    .btn-play-title { font-size: 1rem; }
    .rsc-score    { font-size: 2.4rem; }
    .rsc-name     { font-size: 0.70rem; }
    .result-headline { font-size: 1.8rem; }
    .direction-btn { padding: 10px 3px 8px; }
    .dir-arrow    { font-size: 1.2rem; }
    .dir-name     { font-size: 0.52rem; }
}
@media (max-height: 680px) {
    .game-layout  { padding-top: 6px; gap: 7px; }
    .scoreboard   { padding: 8px 12px; }
    .sb-score     { font-size: 1.9rem; }
    .direction-btn { padding: 9px 3px 7px; }
}
@media (max-width: 480px) and (orientation: portrait) {
    .direction-grid { gap: 7px; }
    .stats-grid-4   { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================
   ELO SYSTEM � LEADERBOARD & RANK BADGES
   ===================================================== */

/* Tier colour vars */
:root {
    --tier-diamond:  #b9f2ff;
    --tier-platinum: #5fb4ff;
    --tier-gold:     #ffd700;
    --tier-silver:   #c0c0c0;
    --tier-bronze:   #cd7f32;
    --tier-iron:     #8899aa;
}

/* Podium ELO display */
.lb-p-elo {
    font-family: var(--ff-display);
    font-size: 0.92rem;
    font-weight: 900;
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255,215,0,0.5);
    letter-spacing: 0.5px;
}
.lb-p-elo-label {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--c-text3);
    letter-spacing: 1px;
    vertical-align: middle;
    margin-left: 2px;
}
.lb-p-stats {
    font-size: 0.62rem;
    color: var(--c-text3);
    font-family: var(--ff-body);
}

/* Avatar tier-coloured border */
.lb-p-avatar-tier { font-size: 1.6rem; }
.lb-p-avatar-tier.tier-diamond  { border-color: var(--tier-diamond);  box-shadow: 0 0 14px rgba(185,242,255,0.40); }
.lb-p-avatar-tier.tier-platinum { border-color: var(--tier-platinum); box-shadow: 0 0 14px rgba(95,180,255,0.40); }
.lb-p-avatar-tier.tier-gold     { border-color: var(--tier-gold);     box-shadow: 0 0 14px rgba(255,215,0,0.45); }
.lb-p-avatar-tier.tier-silver   { border-color: var(--tier-silver);   box-shadow: 0 0 10px rgba(192,192,192,0.35); }
.lb-p-avatar-tier.tier-bronze   { border-color: var(--tier-bronze);   box-shadow: 0 0 10px rgba(205,127,50,0.35); }
.lb-p-avatar-tier.tier-iron     { border-color: var(--tier-iron);     box-shadow: 0 0 6px rgba(136,153,170,0.25); }

/* List row tier icon */
.lb-tier-icon {
    font-size: 1.15rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

/* ELO column in list rows */
.leaderboard-elo {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.lb-elo-val {
    font-family: var(--ff-display);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255,215,0,0.4);
}
.lb-elo-label {
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--c-text3);
    letter-spacing: 0.8px;
    margin-top: 1px;
}

/* "You" tag in leaderboard */
.lb-you-tag {
    display: inline-block;
    background: rgba(0,212,255,0.18);
    color: var(--neon-cyan);
    border: 1px solid rgba(0,212,255,0.35);
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin-left: 4px;
}

/* Highlight self row */
.lb-item-me {
    background: rgba(0,212,255,0.06) !important;
    border-color: rgba(0,212,255,0.25) !important;
}

/* Loading / error states */
.lb-loading {
    text-align: center;
    padding: 32px;
    color: var(--c-text3);
    font-family: var(--ff-ui);
}
.lb-error {
    text-align: center;
    padding: 24px;
    color: var(--neon-red);
    font-family: var(--ff-ui);
    font-size: 0.9rem;
}

/* Leaderboard rows / podium are tappable → open the player-detail popup */
.leaderboard-item, .lb-podium-item { cursor: pointer; }
.leaderboard-item:active { transform: scale(0.99); }
.lb-podium-item:active   { filter: brightness(1.1); }

/* =====================================================
   PLAYER DETAIL POPUP (public profile from leaderboard)
   ===================================================== */
.pd-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(3,6,14,0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s var(--ease-out);
}
.pd-overlay.pd-show { opacity: 1; }
.pd-card {
    position: relative;
    width: 100%;
    max-width: 340px;
    background: linear-gradient(180deg, var(--c-surface2) 0%, var(--c-surface) 100%);
    border: 1px solid var(--c-border);
    border-radius: 20px;
    padding: 26px 20px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 24px 60px -20px rgba(0,0,0,0.8);
    transform: translateY(16px) scale(0.96);
    transition: transform 0.24s var(--ease-spring);
}
.pd-overlay.pd-show .pd-card { transform: translateY(0) scale(1); }
.pd-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--c-surface3);
    border: 1px solid var(--c-border);
    color: var(--c-text2);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.18s, color 0.18s;
}
.pd-close:hover  { background: var(--c-surface); color: #fff; }
.pd-close:active { transform: scale(0.92); }
.pd-rank {
    font-family: var(--ff-display);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255,215,0,0.5);
}
.pd-avatar {
    width: 92px; height: 92px;
    border-radius: 50%;
    background: var(--c-surface3);
    border: 3px solid rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--ff-ui);
    font-weight: 700;
    font-size: 2.2rem;
    color: var(--c-text);
    overflow: hidden;
    margin-top: 2px;
}
.pd-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Online indicator — green pulsing dot on avatars (rows, podium, popup) */
.lb-item-avatar, .lb-p-avatar, .pd-avatar { position: relative; overflow: visible; }
.lb-item-avatar img, .pd-avatar img { border-radius: 50%; }
.online-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 11px;
    height: 11px;
    background: var(--neon-green);
    border: 2px solid var(--c-bg);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(43,217,107,0.85);
    animation: onlinePulse 1.4s ease-in-out infinite;
    pointer-events: none;
}
.online-dot-lg { width: 16px; height: 16px; border-width: 3px; right: 3px; bottom: 3px; }
@keyframes onlinePulse {
    0%, 100% { opacity: 1;    transform: scale(1); }
    50%      { opacity: 0.45; transform: scale(0.8); }
}
.pd-name {
    font-family: var(--ff-display);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--c-text);
    text-align: center;
    word-break: break-word;
}
.pd-tier {
    font-family: var(--ff-ui);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.pd-elo {
    font-family: var(--ff-display);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--neon-gold);
    text-shadow: 0 0 10px rgba(255,215,0,0.45);
    letter-spacing: 0.5px;
    margin-top: 2px;
}
.pd-elo span {
    font-size: 0.6rem;
    color: var(--c-text3);
    letter-spacing: 1px;
    margin-left: 2px;
}
.pd-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    margin-top: 14px;
}
.pd-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 12px 6px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 12px;
}
.pd-stat-val {
    font-family: var(--ff-display);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--c-text);
}
.pd-stat-lbl {
    font-size: 0.62rem;
    color: var(--c-text3);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* Challenge button inside player-detail popup */
.pd-challenge-btn {
    margin-top: 16px;
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--neon-cyan) 0%, #1f8fff 100%);
    color: #04121f;
    font-family: var(--ff-ui);
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: filter 0.18s, transform 0.12s;
}
.pd-challenge-btn:hover  { filter: brightness(1.08); }
.pd-challenge-btn:active { transform: scale(0.98); }

/* =====================================================
   CHALLENGE OVERLAYS (chooser / waiting / incoming)
   ===================================================== */
.ch-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(3,6,14,0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s var(--ease-out);
}
.ch-overlay.pd-show { opacity: 1; }
.ch-card {
    position: relative;
    width: 100%;
    max-width: 320px;
    background: linear-gradient(180deg, var(--c-surface2) 0%, var(--c-surface) 100%);
    border: 1px solid var(--c-border);
    border-radius: 20px;
    padding: 26px 20px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 24px 60px -20px rgba(0,0,0,0.8);
    text-align: center;
}
.ch-title {
    font-family: var(--ff-display);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--c-text);
}
.ch-sub {
    font-family: var(--ff-ui);
    font-size: 0.82rem;
    color: var(--c-text3);
}
.ch-avatar {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--c-surface3);
    border: 2px solid rgba(0,212,255,0.4);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--ff-ui); font-weight: 700; font-size: 1.8rem;
    color: var(--c-text); overflow: hidden;
}
.ch-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ch-modes { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 6px; }
.ch-mode {
    padding: 13px;
    border-radius: 12px;
    border: 1px solid var(--c-border);
    background: var(--c-surface3);
    color: var(--c-text);
    font-family: var(--ff-ui); font-weight: 700; font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.18s;
}
.ch-mode:hover { background: var(--c-surface); }
.ch-mode-disabled { opacity: 0.45; cursor: not-allowed; }
.ch-stake-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--c-border);
    background: var(--c-surface3);
    color: var(--c-text);
    font-family: var(--ff-ui);
    font-size: 1rem;
    text-align: center;
}
.ch-stake-input:focus { outline: none; border-color: var(--neon-cyan); }
.ch-stake-error { color: var(--neon-red); font-size: 0.75rem; }
.ch-actions { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.ch-accept, .ch-decline {
    flex: 1;
    padding: 13px;
    border-radius: 12px;
    border: none;
    font-family: var(--ff-ui); font-weight: 800; font-size: 0.92rem;
    cursor: pointer;
    transition: filter 0.18s, transform 0.12s;
}
.ch-accept  { background: linear-gradient(135deg, var(--neon-green) 0%, #1fbf6b 100%); color: #04210f; }
.ch-decline { background: var(--c-surface3); color: var(--c-text2); border: 1px solid var(--c-border); }
.ch-accept:active, .ch-decline:active, .ch-cancel:active { transform: scale(0.97); }
.ch-cancel {
    margin-top: 6px;
    padding: 11px 22px;
    border-radius: 12px;
    border: 1px solid var(--c-border);
    background: var(--c-surface3);
    color: var(--c-text2);
    font-family: var(--ff-ui); font-weight: 700; font-size: 0.85rem;
    cursor: pointer;
}
.ch-spinner {
    width: 38px; height: 38px;
    border: 3px solid rgba(0,212,255,0.2);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

/* ELO change panel on result screen */
.rrc-positive {
    color: var(--neon-green) !important;
    text-shadow: var(--glow-green) !important;
}
.rrc-negative {
    color: var(--neon-red) !important;
    text-shadow: var(--glow-red) !important;
}

/* Player hero ELO badge */
.ph-badge .ph-elo {
    font-family: var(--ff-display);
    font-size: 0.68rem;
    font-weight: 800;
    margin-left: 3px;
    vertical-align: middle;
    color: var(--neon-gold);
}

/* =====================================================
   PROFILE SCREEN � ENHANCED
   ===================================================== */

/* Neon purple text */
.neon-purple-text {
    color: var(--neon-purple);
    text-shadow: 0 0 14px rgba(168,85,247,0.6);
}

/* Refresh button in profile header */
#profileRefreshBtn { margin-left: auto; }

/* ── Profile Coin Balance Bar ─────────────────────────── */
.profile-coin-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
    border-color: rgba(255,215,0,0.22);
    background: linear-gradient(135deg, rgba(255,215,0,0.07) 0%, rgba(255,255,255,0.04) 60%);
}
.profile-coin-bar::after {
    content: '';
    position: absolute;
    top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,215,0,0.12), transparent);
    animation: coinBarShimmer 3.5s ease-in-out infinite;
    pointer-events: none;
}
@keyframes coinBarShimmer {
    0%   { left: -60%; }
    100% { left: 120%; }
}
.pcb-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}
.pcb-coin-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 14px rgba(255,215,0,0.75));
    flex-shrink: 0;
    line-height: 1;
}
.pcb-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pcb-label {
    font-family: var(--ff-ui);
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255,215,0,0.55);
    text-transform: uppercase;
}
.pcb-value {
    font-family: var(--ff-display);
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    line-height: 1;
}
.pcb-glow {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,215,0,0.25) 0%, transparent 70%);
    flex-shrink: 0;
    animation: pcbPulse 2.4s ease-in-out infinite;
}
@keyframes pcbPulse {
    0%, 100% { transform: scale(0.75); opacity: 0.45; }
    50%       { transform: scale(1.25); opacity: 1;    }
}
.psk-coin-bar { height: 72px; }

/* Member-since label */
.profile-member-since {
    font-size: 0.64rem;
    color: var(--c-text3);
    margin-top: 4px;
    font-family: var(--ff-ui);
}

/* Rank badge � stacked */
.profile-rank-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.prb-icon { font-size: 1.6rem; filter: drop-shadow(0 0 8px rgba(255,215,0,0.55)); }
.prb-label {
    font-family: var(--ff-ui);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--neon-gold);
    opacity: 0.85;
}

/* ELO Banner */
.elo-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
}
.elo-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,215,0,0.05) 0%, transparent 60%);
    pointer-events: none;
}
.elo-icon { font-size: 2rem; flex-shrink: 0; filter: drop-shadow(0 0 10px rgba(255,215,0,0.6)); }
.elo-info { flex: 1; }
.elo-val {
    font-family: var(--ff-display);
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
}
.elo-lbl {
    font-family: var(--ff-ui);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--c-text3);
    margin-top: 2px;
}
.elo-tier-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: rgba(255,255,255,0.06);
    border-radius: 0 0 14px 14px;
    overflow: hidden;
}
.elo-tier-fill {
    height: 100%;
    background: var(--grad-gold);
    border-radius: 3px;
    transition: width 1.4s var(--ease-out);
    box-shadow: 0 0 8px rgba(255,215,0,0.6);
}

/* 3-column stat grid */
.stats-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* Stat card icon */
.sc-icon {
    font-size: 1.15rem;
    display: block;
    margin-bottom: 2px;
    filter: drop-shadow(0 0 6px currentColor);
}

/* Stat card animate-in */
@keyframes statCardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.sc-anim {
    opacity: 0;
    animation: statCardIn 0.45s var(--ease-spring) forwards;
    animation-delay: var(--sc-delay, 0s);
}
/* Reset when re-entering screen */
.sc-anim.sc-reset { animation: none; opacity: 1; }

/* ELO banner animate-in */
@keyframes eloBannerIn {
    from { opacity: 0; transform: translateX(-18px); }
    to   { opacity: 1; transform: translateX(0); }
}
.elo-banner-anim { animation: eloBannerIn 0.4s var(--ease-out) 0s both; }

/* Profile hero animate-in */
@keyframes profileHeroIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.profile-hero-anim { animation: profileHeroIn 0.35s var(--ease-out) both; }

/* Loading skeleton for profile */
.profile-skeleton { display: flex; flex-direction: column; gap: 12px; }
.psk-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}
.psk-circle {
    width: 62px; height: 62px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    flex-shrink: 0;
}
.psk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.psk-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.psk-line.w60 { width: 60%; }
.psk-line.w40 { width: 40%; }
.psk-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.psk-card {
    height: 90px;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Counter number roll animation */
@keyframes countRoll {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.sc-val-updated { animation: countRoll 0.35s var(--ease-spring) both; }

/* Avatar image vs initials */
.profile-avatar img { display: none; }
.profile-avatar.has-photo img    { display: block; }
.profile-avatar.has-photo span   { display: none; }

/* Responsive tweaks for very small screens */
@media (max-width: 360px) {
    .stats-grid-3  { grid-template-columns: repeat(2, 1fr); }
    .elo-val       { font-size: 1.8rem; }
}
@media (max-width: 400px) {
    .sc-val        { font-size: 1.4rem; }
    .elo-val       { font-size: 2rem; }
}

/* =====================================================
   TOURNAMENT STYLES
   ===================================================== */

/* Create panel */
.trn-create-panel {
    padding: 1rem 1rem 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
}
.trn-create-title {
    font-family: var(--ff-display);
    font-size: .85rem;
    letter-spacing: .1em;
    color: var(--c-text2);
    text-transform: uppercase;
}
.trn-size-row {
    display: flex;
    gap: .5rem;
}
.trn-size-btn {
    flex: 1;
    padding: .55rem .5rem;
    border-radius: 10px;
    border: 1.5px solid var(--c-border2);
    background: var(--c-surface);
    color: var(--c-text2);
    font-family: var(--ff-display);
    font-size: .8rem;
    letter-spacing: .06em;
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
}
.trn-size-btn.active {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    background: rgba(0,212,255,.1);
}

/* Section label */
.trn-section-label {
    font-family: var(--ff-display);
    font-size: .75rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--c-text3);
    padding: .2rem .1rem .5rem;
}

/* Tournament list */
.trn-list { display: flex; flex-direction: column; gap: .6rem; padding-bottom: 2rem; }
.trn-loading { color: var(--c-text3); text-align: center; padding: 1.5rem 0; font-size: .9rem; }
.trn-empty   { color: var(--c-text3); text-align: center; padding: 1.5rem 0; font-size: .9rem; }

/* Tournament card */
.trn-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.trn-card:hover { border-color: var(--c-border2); background: var(--c-surface2); }
.trn-card-info  { display: flex; flex-direction: column; gap: .2rem; }
.trn-card-name  { font-family: var(--ff-display); font-size: .95rem; font-weight: 700; }
.trn-card-meta  { font-size: .78rem; color: var(--c-text2); }
.trn-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }

/* Status badges */
.trn-status-badge {
    display: inline-block;
    font-family: var(--ff-display);
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .22rem .55rem;
    border-radius: 8px;
    font-weight: 700;
}
.trn-status-registration { background: rgba(0,212,255,.15); color: var(--neon-cyan); border: 1px solid rgba(0,212,255,.35); }
.trn-status-registrationclosed { background: rgba(255,152,0,.14); color: #ffbf6b; border: 1px solid rgba(255,152,0,.35); }
.trn-status-inprogress   { background: rgba(255,215,0,.15);  color: var(--neon-gold);  border: 1px solid rgba(255,215,0,.35);  }
.trn-status-finished     { background: rgba(0,255,136,.12);  color: var(--neon-green); border: 1px solid rgba(0,255,136,.35);  }
.trn-status-cancelled    { background: rgba(255,51,102,.12); color: var(--neon-red);   border: 1px solid rgba(255,51,102,.3);  }

/* Tournament detail info bar */
.trn-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem 1rem;
    margin-bottom: .8rem;
}
.trn-size-info {
    font-family: var(--ff-display);
    font-size: .85rem;
    color: var(--c-text2);
}

/* Action row */
.trn-action-row {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.trn-action-row .btn-neon { flex: 1; min-width: 120px; }

/* Bracket */
.trn-bracket {
    display: flex;
    gap: 1rem;
    padding-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.trn-round {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    flex: 0 0 auto;
}
.trn-round-label {
    font-family: var(--ff-display);
    font-size: .7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--neon-cyan);
    margin-bottom: .6rem;
    text-align: center;
}
.trn-round-matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
    gap: .6rem;
}

/* Match slot */
.trn-match-slot {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color .2s;
}
.trn-match-slot.trn-match-ready   { border-color: rgba(0,212,255,.45); }
.trn-match-slot.trn-match-active  { border-color: var(--neon-gold);    }
.trn-match-slot.trn-match-done    { border-color: rgba(0,255,136,.35); }

.trn-match-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .45rem .65rem;
    font-size: .82rem;
    gap: .4rem;
}
.trn-match-player:first-child { border-bottom: 1px solid var(--c-border); }
.trn-match-player-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}
.trn-match-player-name.trn-winner { color: var(--neon-gold); }
.trn-match-player-name.trn-tbd    { color: var(--c-text3); font-style: italic; font-weight: 400; }
.trn-match-player-name.trn-loser  { color: var(--c-text3); }
.trn-match-player-seed {
    font-size: .68rem;
    color: var(--c-text3);
    margin-right: .3rem;
}
.trn-match-player-w { font-size: .8rem; }

/* Score shown next to each player name in finished bracket slots */
.trn-match-score {
    margin-left: auto;
    font-family: var(--ff-display);
    font-size: .78rem;
    font-weight: 700;
    color: var(--c-text3);
    min-width: 1.4rem;
    text-align: right;
    flex-shrink: 0;
}
.trn-match-score.trn-match-score-win {
    color: var(--neon-gold);
    text-shadow: 0 0 6px rgba(255,215,0,.45);
}

/* Match start button inside bracket slot */
.trn-match-start-btn {
    width: 100%;
    background: rgba(0,212,255,.12);
    border: none;
    border-top: 1px solid rgba(0,212,255,.25);
    color: var(--neon-cyan);
    font-family: var(--ff-display);
    font-size: .72rem;
    letter-spacing: .07em;
    padding: .35rem;
    cursor: pointer;
    transition: background .2s;
}
.trn-match-start-btn:hover { background: rgba(0,212,255,.22); }

/* Registration participants */
.trn-participants {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-bottom: 1rem;
}
.trn-participant-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .85rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    font-size: .88rem;
}
.trn-participant-seed {
    font-family: var(--ff-display);
    font-size: .72rem;
    color: var(--c-text3);
    min-width: 1.2rem;
}
.trn-participant-name { flex: 1; font-weight: 600; }
.trn-participant-elo  { font-family: var(--ff-display); font-size: .78rem; color: var(--neon-gold); }

/* Winner banner */
.trn-winner-banner {
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 1rem;
    border: 1px solid rgba(255,215,0,.4);
}
.trn-winner-trophy { font-size: 2.5rem; margin-bottom: .3rem; }
.trn-winner-label  { font-family: var(--ff-display); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--neon-gold); margin-bottom: .4rem; }
.trn-winner-name   { font-family: var(--ff-display); font-size: 1.4rem; font-weight: 800; color: #fff; }


/* =====================================================
   RECONNECT OVERLAY
   ===================================================== */

/* Full-screen modal that blocks interaction during reconnect */
.reconnect-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;           /* shown via JS */
    align-items: center;
    justify-content: center;
    background: rgba(5, 9, 18, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: rc-fadein 200ms var(--ease-out) both;
}

@keyframes rc-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Inner card */
.rc-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: 2.2rem 2.6rem;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,.5);
    max-width: 280px;
}

/* Spinning ring */
.rc-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(0, 212, 255, .2);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: rc-spin 900ms linear infinite;
}

@keyframes rc-spin {
    to { transform: rotate(360deg); }
}

.rc-title {
    font-family: var(--ff-display);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: #fff;
}

.rc-sub {
    font-size: .82rem;
    color: var(--c-text2);
}

/* Tap-to-retry variant */
.reconnect-failed .rc-spinner {
    border-color: rgba(255, 51, 102, .2);
    border-top-color: var(--neon-red);
    animation-play-state: paused;
}

.reconnect-failed .rc-title {
    color: var(--neon-red);
}

.reconnect-failed {
    cursor: pointer;
}

/* =====================================================
   CONNECTION STATUS INDICATOR
   Small floating dot shown only when degraded.
   ===================================================== */
.conn-indicator {
    position: fixed;
    top: 10px;
    right: 12px;
    z-index: 9000;
    display: none;        /* hidden when connected */
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: .65rem;
    font-weight: 700;
    pointer-events: none;
}

.conn-reconnecting {
    background: rgba(255, 165, 0, .18);
    border: 1.5px solid rgba(255, 165, 0, .7);
    color: #ffa500;
    animation: conn-pulse 1.2s ease-in-out infinite;
}

.conn-disconnected {
    background: rgba(255, 51, 102, .18);
    border: 1.5px solid rgba(255, 51, 102, .7);
    color: var(--neon-red);
}

@keyframes conn-pulse {
    0%, 100% { opacity: 1;   transform: scale(1);    }
    50%       { opacity: .55; transform: scale(1.12); }
}

/* =====================================================
   MOBILE PERFORMANCE � Telegram Mini App optimisations
   ===================================================== */

/* Promote canvas to its own compositor layer.
   Prevents the canvas repaint from triggering a full-page re-composite. */
#gameCanvas {
    will-change: contents;
    /* Already has touch-action: none above � repeated here as documentation */
}

/* Scrollable containers: native momentum scrolling on iOS */
.screen-scroll {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;   /* prevent scroll chaining into parent */
}

/* Isolate each non-game screen so off-screen paint doesn't bleed */
.screen {
    contain: layout style;
}
.screen.active {
    contain: none;   /* let active screen participate in normal layout */
}

/* Direction buttons: keep on compositor layer to avoid layout during press animation */
.direction-btn {
    will-change: transform, opacity;
    /* touch-action already set via global * reset; pointer-events managed by JS */
}

/* Score pop animation: compositor-only transform */
.score-pop {
    will-change: transform;
}

/* Neon play button shimmer: GPU-animated layer */
.btn-play-shimmer {
    will-change: transform;
}

/* Matchmaking radar rings: each ring animates independently on the GPU */
.mm-radar-ring {
    will-change: transform, opacity;
}

/* Toast notifications: slide-in/out on GPU */
.toast {
    will-change: transform, opacity;
}

/* Connection indicator pulse: compositor-only */
.conn-reconnecting {
    will-change: opacity, transform;
}

/* Safe-area bottom padding for iPhone X+ notch / Android nav bar */
#app {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Broad reduce-motion reset — covers all animations/transitions site-wide */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* =====================================================
   BOOT SPLASH — shown until assets + core data are loaded
   ===================================================== */
.boot-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grad-hero);
    padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px);
    opacity: 1;
    transition: opacity 0.45s var(--ease-out);
}
.boot-screen.boot-hide {
    opacity: 0;
    pointer-events: none;
}
.boot-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    width: 100%;
    max-width: 320px;
    text-align: center;
}
.boot-title {
    margin: 0;
    font-family: var(--ff-display);
    font-weight: 800;
    font-size: 26px;
    letter-spacing: 2px;
    color: var(--c-text);
    line-height: 1.25;
}
.boot-title span {
    display: block;
    color: var(--neon-cyan);
    text-shadow: 0 0 18px rgba(0, 212, 255, 0.55);
}
.boot-ball {
    font-size: 2.4rem;
    line-height: 1;
    transform-origin: center center;
    animation: boot-spin 1s linear infinite;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.35));
}
.boot-bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}
.boot-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: var(--grad-cyan);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.5);
    transition: width 0.25s var(--ease-out);
}
.boot-label {
    margin: 0;
    font-family: var(--ff-display);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--c-text3);
}
@keyframes boot-spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   DEV MODE BADGE
   ===================================================== */
.dev-mode-badge {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 9999;
    background: rgba(255, 140, 0, 0.18);
    border: 1px solid rgba(255, 140, 0, 0.60);
    color: #ff8c00;
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.25);
}

/* =====================================================
   DEV BOT PANEL  (queue screen)
   ===================================================== */
.dev-bot-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    padding: 12px 16px;
    background: rgba(255, 140, 0, 0.06);
    border: 1px dashed rgba(255, 140, 0, 0.30);
    border-radius: 12px;
}

.dev-bot-btn {
    background: rgba(255, 140, 0, 0.14);
    border: 1px solid rgba(255, 140, 0, 0.55);
    color: #ff8c00;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 9px 22px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.dev-bot-btn:hover {
    background: rgba(255, 140, 0, 0.26);
    box-shadow: 0 0 14px rgba(255, 140, 0, 0.30);
}

.dev-bot-hint {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: rgba(255, 140, 0, 0.55);
    letter-spacing: 0.04em;
}

/* =====================================================
   DEV BOT FLOATING PANEL  (game screen)
   ===================================================== */
.dev-bot-game-panel {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 800;
}

.dev-bot-submit-btn {
    background: rgba(255, 140, 0, 0.16);
    border: 1px solid rgba(255, 140, 0, 0.60);
    color: #ff8c00;
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.dev-bot-submit-btn:hover {
    background: rgba(255, 140, 0, 0.28);
    box-shadow: 0 0 16px rgba(255, 140, 0, 0.35);
}

/* ═══════════════════════════════════════════════════════
   Tournament next-round countdown overlay
   ═══════════════════════════════════════════════════════ */

/* =====================================================
   OPPONENT RECONNECT COUNTDOWN OVERLAY (tournament)
   ===================================================== */

.reconnect-countdown-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    pointer-events: all;
}

.rco-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 22, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.rco-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 36px 32px;
    background: linear-gradient(145deg, rgba(40, 16, 16, 0.97), rgba(20, 8, 8, 0.97));
    border: 1px solid rgba(255, 71, 87, 0.40);
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(255, 71, 87, 0.25), 0 8px 32px rgba(0, 0, 0, 0.65);
    text-align: center;
    animation: rco-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    min-width: 240px;
}

@keyframes rco-pop-in {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.rco-icon {
    font-size: 44px;
    line-height: 1;
    filter: drop-shadow(0 0 12px rgba(255, 120, 0, 0.70));
    animation: rco-warn 1.2s ease-in-out infinite;
}

@keyframes rco-warn {
    0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 12px rgba(255, 120, 0, 0.70)); }
    50%       { transform: scale(1.08); filter: drop-shadow(0 0 20px rgba(255, 71, 87, 0.90)); }
}

.rco-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #ff6b7a;
    margin-top: 4px;
}

.rco-sublabel {
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.rco-timer-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin: 6px 0 2px;
}

.rco-number {
    font-family: 'Rajdhani', sans-serif;
    font-size: 80px;
    font-weight: 700;
    line-height: 1;
    color: #ff4757;
    text-shadow: 0 0 24px rgba(255, 71, 87, 0.80), 0 0 8px rgba(255, 71, 87, 0.40);
    transition: color 0.3s, text-shadow 0.3s;
    min-width: 2ch;
}

.rco-number.rco-urgent {
    color: #ff2233;
    text-shadow: 0 0 30px rgba(255, 34, 51, 1), 0 0 10px rgba(255, 34, 51, 0.60);
    animation: rco-pulse 0.4s ease-in-out infinite alternate;
}

@keyframes rco-pulse {
    from { transform: scale(1);    }
    to   { transform: scale(1.07); }
}

.rco-timer-label {
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(255, 107, 122, 0.65);
    margin-top: -4px;
}

.rco-hint {
    font-family: var(--ff-ui, 'Inter', sans-serif);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.40);
    margin-top: 6px;
    max-width: 200px;
    line-height: 1.4;
}

/* =====================================================
   TOURNAMENT NEXT-ROUND COUNTDOWN OVERLAY
   ===================================================== */

.tournament-countdown-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    pointer-events: all;
}

.tco-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 22, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.tco-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 36px 32px;
    background: linear-gradient(145deg, rgba(22, 26, 50, 0.96), rgba(12, 15, 32, 0.96));
    border: 1px solid rgba(0, 212, 255, 0.30);
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.15), 0 8px 32px rgba(0, 0, 0, 0.60);
    text-align: center;
    animation: tco-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tco-pop-in {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.tco-trophy {
    font-size: 44px;
    line-height: 1;
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.60));
    animation: tco-bounce 1.2s ease-in-out infinite;
}

@keyframes tco-bounce {
    0%, 100% { transform: translateY(0);   }
    50%       { transform: translateY(-6px); }
}

.tco-label {
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(0, 212, 255, 0.85);
}

.tco-number {
    font-family: 'Rajdhani', sans-serif;
    font-size: 80px;
    font-weight: 700;
    line-height: 1;
    color: #ffd700;
    text-shadow: 0 0 24px rgba(255, 215, 0, 0.70), 0 0 8px rgba(255, 215, 0, 0.35);
    transition: color 0.3s, text-shadow 0.3s;
    min-width: 2ch;
}

.tco-number.tco-urgent {
    color: #ff4757;
    text-shadow: 0 0 24px rgba(255, 71, 87, 0.80), 0 0 8px rgba(255, 71, 87, 0.40);
    animation: tco-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes tco-pulse {
    from { transform: scale(1);    }
    to   { transform: scale(1.06); }
}

.tco-sublabel {
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* =====================================================
   ACTIVE GAMES SCREEN
   ===================================================== */

.ag-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px 32px;
}

.ag-loading,
.ag-empty,
.ag-error {
    text-align: center;
    padding: 40px 16px;
    color: var(--c-text3);
    font-family: var(--ff-ui);
    font-size: 15px;
}

.ag-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 14px 14px 14px 16px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.14s var(--ease-spring);
    position: relative;
}
.ag-item:active { transform: scale(0.975); }
.ag-item:hover  { background: var(--c-surface2); border-color: var(--c-border2); }

.ag-item-icon {
    font-size: 26px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-surface2);
    border-radius: 12px;
}

.ag-item-body {
    flex: 1;
    min-width: 0;
}

.ag-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.ag-mode-badge {
    font-family: var(--ff-ui);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}
.ag-mode-Public     { background: rgba(0,212,255,0.15); color: var(--neon-cyan); }
.ag-mode-Private    { background: rgba(255,215,0,0.15);  color: var(--neon-gold); }
.ag-mode-Tournament { background: rgba(168,85,247,0.15); color: var(--neon-purple); }

.ag-item-opponent {
    font-family: var(--ff-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ag-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ag-status {
    font-family: var(--ff-ui);
    font-size: 12px;
    color: var(--c-text3);
}
.ag-status-live   { color: var(--neon-green); }
.ag-status-ready  { color: var(--neon-gold); }

.ag-room-code {
    font-family: var(--ff-display);
    font-size: 11px;
    color: var(--c-text3);
}

.ag-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ag-open-btn {
    background: var(--grad-cyan);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: var(--ff-ui);
    font-size: 12px;
    font-weight: 700;
    padding: 7px 14px;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.ag-open-btn:hover { opacity: 0.85; }

.ag-delete-btn {
    background: rgba(255,51,102,0.12);
    border: 1px solid rgba(255,51,102,0.25);
    border-radius: 10px;
    color: var(--neon-red);
    font-size: 16px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.ag-delete-btn:hover {
    background: rgba(255,51,102,0.22);
    border-color: rgba(255,51,102,0.45);
}

/* =====================================================
   SETTINGS SCREEN
   ===================================================== */

.settings-card {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-title {
    font-family: var(--ff-display);
    font-size: 0.9rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--c-text);
}

.settings-hint {
    font-family: var(--ff-ui);
    font-size: 0.9rem;
    color: var(--c-text3);
    line-height: 1.45;
}

/* Settings navigation row (e.g. "Sounds ›") */
.settings-nav-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px 20px;
    text-align: left;
    cursor: pointer;
    color: var(--c-text);
    transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.settings-nav-row:hover { background: var(--c-surface2); }
.settings-nav-row:active { background: var(--c-surface3); }
.snr-icon { font-size: 1.4rem; line-height: 1; }
.snr-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.snr-title {
    font-family: var(--ff-display);
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.snr-sub { font-family: var(--ff-ui); font-size: 0.82rem; color: var(--c-text3); }
.snr-chevron { color: var(--c-text3); flex-shrink: 0; }

/* Sound settings rows with horizontal toggle switches */
.sound-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
}
.sound-row + .sound-row { border-top: 1px solid var(--c-border); }
.sound-row-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.sound-row-title { font-family: var(--ff-ui); font-size: 0.95rem; color: var(--c-text); }
.sound-row-sub { font-family: var(--ff-ui); font-size: 0.8rem; color: var(--c-text3); }

/* Horizontal toggle switch */
.sound-switch {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 50px;
    height: 28px;
    cursor: pointer;
}
.sound-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}
.sound-switch-track {
    position: absolute;
    inset: 0;
    background: var(--c-surface3);
    border: 1px solid var(--c-border2);
    border-radius: 999px;
    transition: background 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}
.sound-switch-track::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: var(--c-text2);
    transform: translateY(-50%);
    transition: transform 0.25s var(--ease-spring), background 0.25s var(--ease-out);
}
.sound-switch input:checked + .sound-switch-track {
    background: rgba(0,212,255,0.22);
    border-color: var(--neon-cyan);
}
.sound-switch input:checked + .sound-switch-track::before {
    transform: translate(22px, -50%);
    background: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0,212,255,0.8);
}
.sound-switch input:focus-visible + .sound-switch-track {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 2px;
}

/* =========================================================
   COIN BALANCE BAR (home screen)
   ========================================================= */
.coin-balance-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin: 0 0 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--ease-snappy) .15s, transform var(--ease-snappy) .1s;
}
.coin-balance-bar:active { transform: scale(.98); }
.cbb-icon { font-size: 1.2rem; flex-shrink: 0; }
.cbb-label {
    font-family: var(--ff-ui);
    font-size: .85rem;
    color: var(--c-text3);
    flex-shrink: 0;
}
.cbb-value {
    font-family: var(--ff-display);
    font-size: 1rem;
    font-weight: 700;
    flex: 1;
    text-align: right;
}
.cbb-chevron {
    flex-shrink: 0;
    color: var(--c-text3);
    margin-left: 2px;
}

/* =========================================================
   DEPOSIT HISTORY SCREEN
   ========================================================= */

/* Balance card at the top of deposit history */
.deposit-balance-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    margin: 0 0 12px;
    border-radius: 14px;
}
.dbc-icon { font-size: 1.8rem; flex-shrink: 0; }
.dbc-info { display: flex; flex-direction: column; gap: 2px; }
.dbc-label {
    font-family: var(--ff-ui);
    font-size: .78rem;
    color: var(--c-text3);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.dbc-value {
    font-family: var(--ff-display);
    font-size: 1.35rem;
    font-weight: 700;
}

/* Deposit address block */
.deposit-address-block {
    padding: 16px;
    margin: 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dab-title {
    font-family: var(--ff-ui);
    font-size: .8rem;
    color: var(--c-text3);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.dab-address-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dab-address {
    font-family: var(--ff-mono, monospace);
    font-size: .82rem;
    color: var(--c-text1);
    word-break: break-all;
    line-height: 1.45;
    flex: 1;
    min-width: 0;
}
.dab-copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    background: transparent;
    color: var(--c-accent);
    font-size: .78rem;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
    white-space: nowrap;
}
.dab-copy-btn:active { background: var(--c-surface2); }
.dab-warning {
    font-size: .78rem;
    color: var(--c-text3);
    display: flex;
    align-items: center;
    gap: 6px;
}
.dab-skeleton { display: flex; flex-direction: column; gap: 8px; }

/* Exchange rate info strip */
.deposit-rate-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 0 0 16px;
    border-radius: 10px;
    font-family: var(--ff-ui);
    font-size: .88rem;
    color: var(--c-text2);
}
.dri-icon { font-size: 1.1rem; }
.dri-text strong { font-weight: 700; }

/* Section label */
.deposit-section-label {
    font-family: var(--ff-display);
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--c-text3);
    margin: 0 0 8px 4px;
}

/* ── Wallet hub ── */
.wallet-hub-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    padding: 18px 16px;
    margin-bottom: 12px;
    border-radius: 16px;
    cursor: pointer;
    color: inherit;
}
.wallet-hub-card:active { transform: scale(.99); }
.whc-icon { font-size: 26px; flex-shrink: 0; }
.whc-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.whc-title {
    font-family: var(--ff-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--c-text1);
}
.whc-subtitle { font-size: .82rem; color: var(--c-text3); }
.whc-arrow { color: var(--c-text3); flex-shrink: 0; }

/* ── Withdraw form ── */
.withdraw-form {
    display: flex;
    flex-direction: column;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 16px;
}
.withdraw-label {
    font-family: var(--ff-ui);
    font-size: .82rem;
    color: var(--c-text3);
    margin: 10px 0 6px;
}
.withdraw-label:first-child { margin-top: 0; }
.withdraw-input {
    font-family: var(--ff-ui);
    font-size: .95rem;
    color: var(--c-text1);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 11px 12px;
    outline: none;
}
.withdraw-input:focus-visible { border-color: var(--c-cyan, #00d4ff); }
.withdraw-preview {
    font-family: var(--ff-ui);
    font-size: .92rem;
    color: var(--c-text2);
    margin: 12px 0 4px;
}
.withdraw-field-error {
    font-size: .78rem;
    color: #ff3366;
    margin: 6px 0 0;
}
.withdraw-hint { font-size: .78rem; color: var(--c-text3); margin-bottom: 14px; }
.withdraw-submit { width: 100%; }
.withdraw-submit:disabled { opacity: .45; cursor: not-allowed; }

.withdraw-pending-notice {
    font-family: var(--ff-ui);
    font-size: .9rem;
    color: #ffd700;
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    text-align: center;
}

/* Individual withdrawal request row */
.withdraw-row { padding: 12px 14px; border-radius: 12px; }
.wr-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.wr-amount {
    font-family: var(--ff-ui);
    font-size: .95rem;
    font-weight: 600;
}
.wr-meta { font-size: .76rem; color: var(--c-text3); }

/* Deposit list */
.deposit-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 12px;
}

.deposit-loading,
.deposit-empty {
    font-family: var(--ff-ui);
    font-size: .92rem;
    color: var(--c-text3);
    text-align: center;
    padding: 28px 16px;
}

/* Individual deposit transaction row */
.deposit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
}
.dr-num {
    font-family: var(--ff-ui);
    font-size: .85rem;
    color: var(--c-text3);
    flex-shrink: 0;
}
.dr-amount {
    font-family: var(--ff-ui);
    font-size: .88rem;
    font-weight: 600;
    color: var(--c-text1);
    flex-shrink: 0;
}
.dr-sep {
    color: var(--c-text3);
    flex-shrink: 0;
}
.dr-hash {
    font-family: monospace;
    font-size: .78rem;
    color: var(--c-text3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.dr-copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    background: transparent;
    color: var(--c-accent);
    font-size: .74rem;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
    white-space: nowrap;
}
.dr-copy-btn:active { background: var(--c-surface2); }

/* Referral card */
/* =====================================================
   INVITE FRIENDS / REFERRAL — gold "reward" theme
   ===================================================== */
@keyframes refReveal {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes refRingSpin { to { transform: rotate(360deg); } }
@keyframes refHeroFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ── Hero ── */
.ref-hero {
    position: relative;
    overflow: hidden;
    padding: 26px 20px 22px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-color: rgba(255,215,0,0.22);
    animation: refReveal .4s var(--ease-out) both;
}
.ref-hero-glow {
    position: absolute;
    top: -55%; left: 50%;
    width: 280px; height: 280px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(255,215,0,0.20) 0%, rgba(255,140,0,0.06) 40%, transparent 70%);
    pointer-events: none;
}
.ref-hero-badge {
    position: relative;
    width: 76px; height: 76px;
    display: grid; place-items: center;
    margin-bottom: 14px;
    animation: refHeroFloat 4s var(--ease-out) infinite;
}
.ref-hero-emoji { font-size: 2.3rem; filter: drop-shadow(0 0 12px rgba(255,215,0,0.6)); }
.ref-hero-ring {
    position: absolute; inset: 0;
    border-radius: 50%;
    border: 1.5px solid transparent;
}
.ref-hero-ring.r1 {
    border-top-color: rgba(255,215,0,0.75);
    border-right-color: rgba(255,215,0,0.2);
    animation: refRingSpin 5s linear infinite;
}
.ref-hero-ring.r2 {
    inset: 9px;
    border-bottom-color: rgba(255,140,66,0.65);
    border-left-color: rgba(255,140,66,0.15);
    animation: refRingSpin 3.5s linear infinite reverse;
}
.ref-hero-title {
    font-family: var(--ff-display);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: .04em;
    background: var(--grad-gold);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 14px rgba(255,215,0,0.35));
}
.ref-hero-sub {
    margin-top: 8px;
    max-width: 30ch;
    font-family: var(--ff-body);
    font-size: .86rem;
    line-height: 1.5;
    color: var(--c-text2);
}

/* ── Stats ── */
.ref-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.ref-stat-tile {
    position: relative;
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    animation: refReveal .5s var(--ease-out) both;
    animation-delay: var(--d, 0s);
}
.ref-stat-tile.ref-stat-gold {
    border-color: rgba(255,215,0,0.28);
    background: linear-gradient(150deg, rgba(255,215,0,0.10) 0%, rgba(255,255,255,0.04) 55%);
}
.ref-stat-ico { font-size: 1.35rem; line-height: 1; }
.ref-stat-num {
    font-family: var(--ff-display);
    font-weight: 800;
    font-size: 1.7rem;
    color: var(--c-text);
    line-height: 1;
}
.ref-stat-cap {
    font-family: var(--ff-ui);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03em;
    color: var(--c-text3);
    text-align: center;
}

/* ── Invite link ── */
.ref-link-block {
    margin-top: 14px;
    animation: refReveal .5s var(--ease-out) both;
    animation-delay: var(--d, 0s);
}
.ref-link-label {
    display: block;
    font-family: var(--ff-ui);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--c-text3);
    margin-bottom: 7px;
}
.ref-link-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 14px;
    background: rgba(255,215,0,0.05);
    border: 1px solid rgba(255,215,0,0.22);
    border-radius: 14px;
}
.ref-link-text {
    flex: 1; min-width: 0;
    font-family: var(--ff-body);
    font-size: .8rem;
    color: var(--c-text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: rtl;            /* keep the meaningful tail (?startapp=ref_code) visible */
    text-align: left;
}
.ref-link-copy {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: none;
    border-radius: 10px;
    background: var(--grad-gold);
    color: #1a1205;
    cursor: pointer;
    transition: transform .15s var(--ease-spring), box-shadow .2s var(--ease-out);
}
.ref-link-copy:hover  { box-shadow: var(--glow-gold); }
.ref-link-copy:active { transform: scale(0.9); }
.ref-link-copy .ico-check { display: none; }
.ref-link-copy.copied { background: var(--grad-green); }
.ref-link-copy.copied .ico-copy  { display: none; }
.ref-link-copy.copied .ico-check { display: block; color: #03200f; }

/* ── Share CTA ── */
.ref-share-cta {
    position: relative;
    overflow: hidden;
    width: 100%;
    margin-top: 14px;
    padding: 15px;
    border: none;
    border-radius: 16px;
    background: var(--grad-gold);
    color: #1a1205;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(255,160,0,0.3), inset 0 1px 0 rgba(255,255,255,0.35);
    animation: refReveal .5s var(--ease-out) both;
    animation-delay: var(--d, 0s);
    transition: transform .15s var(--ease-spring);
}
.ref-share-cta:active { transform: scale(0.97); }
.ref-share-inner {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: center; gap: 9px;
    font-family: var(--ff-ui);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: .02em;
}
.ref-share-shimmer {
    position: absolute; inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: refShimmer 2.6s ease-in-out infinite;
}
@keyframes refShimmer {
    0%, 60% { transform: translateX(-100%); }
    100%    { transform: translateX(100%); }
}

/* ── How it works ── */
.ref-steps {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    margin-top: 20px;
    animation: refReveal .5s var(--ease-out) both;
    animation-delay: var(--d, 0s);
}
.ref-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
}
.ref-step-n {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 50%;
    font-family: var(--ff-display);
    font-weight: 700;
    font-size: .85rem;
    color: var(--neon-gold);
    background: rgba(255,215,0,0.10);
    border: 1px solid rgba(255,215,0,0.3);
}
.ref-step-t {
    font-family: var(--ff-ui);
    font-size: .72rem;
    font-weight: 500;
    color: var(--c-text3);
    text-align: center;
    line-height: 1.3;
    max-width: 11ch;
}
.ref-step-arrow {
    color: rgba(255,215,0,0.4);
    font-size: 1.3rem;
    line-height: 1;
    margin-top: 4px;
}

.ref-skeleton { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

/* --- Paid Match Economy --- */
.entry-fee-row {
    margin: 12px 0 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.entry-fee-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.entry-fee-label { font-size: 13px; color: var(--c-text-muted, #aaa); }
.entry-fee-balance { font-size: 12px; color: var(--c-text-muted, #aaa); }
.entry-fee-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.entry-fee-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    padding: 8px 12px;
    outline: none;
}
.entry-fee-input:focus { border-color: var(--c-accent, #7c5cbf); }
.entry-fee-unit { font-size: 14px; color: var(--c-text-muted, #aaa); }
.entry-fee-hint { font-size: 11px; color: var(--c-text-muted, #aaa); }
.entry-fee-error { font-size: 12px; color: #f06060; margin-top: 2px; }

.entry-fee-info {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 10px 0 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.entry-fee-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--c-text-muted, #aaa);
}
.entry-fee-accent { color: var(--c-accent, #c07aff); font-weight: 600; }

.ag-fee-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(192,122,255,0.18);
    color: var(--c-accent, #c07aff);
    letter-spacing: 0.02em;
}
.ag-fee-free {
    background: rgba(100,200,100,0.15);
    color: #7ecf7e;
}

.btn-cancel-room {
    background: transparent;
    border: 1px solid rgba(240,96,96,0.5);
    color: #f06060;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
    transition: background 0.2s;
}
.btn-cancel-room:hover { background: rgba(240,96,96,0.12); }

/* =========================================================
   ADMIN PANEL
   ========================================================= */

.admin-hub-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: background 0.18s;
}
.admin-hub-card:active { background: rgba(168,85,247,0.12); }
.admin-hub-card-icon { font-size: 24px; flex-shrink: 0; }
.admin-hub-card-text { flex: 1; }
.admin-hub-card-title { font-family: 'Rajdhani', sans-serif; font-size: 16px; font-weight: 600; color: #fff; }
.admin-hub-card-sub { font-size: 12px; color: rgba(255,255,255,0.45); margin-top: 2px; }
.admin-hub-card-chevron { color: rgba(168,85,247,0.7); font-size: 20px; }

.admin-tab-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.admin-tab-btn {
    padding: 6px 14px;
    border: 1px solid rgba(168,85,247,0.35);
    border-radius: 20px;
    background: transparent;
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    font-family: 'Rajdhani', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
}
.admin-tab-btn.active {
    border-color: #a855f7;
    color: #a855f7;
    background: rgba(168,85,247,0.12);
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-badge-pending  { background: rgba(255,215,0,0.18);  color: #ffd700; }
.status-badge-approved { background: rgba(0,212,255,0.18);  color: #00d4ff; }
.status-badge-success  { background: rgba(0,255,136,0.18);  color: #00ff88; }
.status-badge-rejected { background: rgba(255,51,102,0.18); color: #ff3366; }

.wd-info-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.wd-info-label { font-size: 12px; color: rgba(255,255,255,0.45); }
.wd-info-value { font-size: 14px; color: #fff; font-family: 'Rajdhani', sans-serif; }
.wd-address-copy { font-size: 11px; color: #a855f7; cursor: pointer; margin-left: 8px; }

.audit-timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.audit-entry { display: flex; gap: 10px; align-items: flex-start; }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; background: #a855f7; margin-top: 5px; flex-shrink: 0; }
.audit-body { flex: 1; }
.audit-action { font-size: 13px; font-weight: 600; color: #fff; text-transform: capitalize; }
.audit-meta { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }
.audit-notes { font-size: 12px; color: rgba(255,255,255,0.6); font-style: italic; margin-top: 2px; }

.admin-action-row { display: flex; gap: 10px; margin-top: 16px; }
.admin-action-row .btn-neon-green,
.admin-action-row .btn-ghost-danger,
.admin-action-row .btn-neon-cyan { flex: 1; }

.revenue-metrics { display: flex; flex-direction: column; gap: 10px; }
.revenue-card { padding: 16px 18px; }
.revenue-card-label { font-size: 12px; color: rgba(255,255,255,0.45); margin-bottom: 4px; }
.revenue-card-value { font-size: 28px; font-family: 'Orbitron', monospace; color: #ffd700; text-shadow: 0 0 12px rgba(255,215,0,0.5); }

.admin-field-label {
    display: block;
    font-family: var(--ff-ui);
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--c-text3);
    margin-bottom: 6px;
}
.admin-datetime-row { display: flex; gap: 8px; margin-bottom: 6px; }
/* Native date/time pickers need normal type metrics — the .code-input defaults
   (1.5rem, 8px letter-spacing, centered, uppercase) break their segmented fields. */
.admin-datetime-row input[type="date"],
.admin-datetime-row input[type="time"] {
    font-family: var(--ff-ui);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    text-align: left;
    padding: 12px 14px;
}
.admin-datetime-row #adminTrnDate { flex: 1; min-width: 0; }
.admin-datetime-row #adminTrnTime { flex: 0 0 132px; }
.admin-datetime-row input[type="date"]::-webkit-calendar-picker-indicator,
.admin-datetime-row input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .6; cursor: pointer; }
.admin-field-hint {
    font-family: var(--ff-body);
    font-size: .74rem;
    color: var(--c-text3);
}
.admin-field-hint.admin-hint-error { color: var(--neon-red); }
.admin-split-row { display: flex; gap: 10px; margin-bottom: 6px; }
.admin-split-field { flex: 1; }
.admin-split-field .admin-field-label { margin-bottom: 4px; }

/* Sponsored prize banner on the tournament detail */
.tournament-sponsored-prize {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    border-color: rgba(255,215,0,0.28);
    background: linear-gradient(135deg, rgba(255,215,0,0.10) 0%, rgba(255,255,255,0.03) 60%);
}
.tournament-sponsored-prize .tsp-trophy { font-size: 1.7rem; line-height: 1; }
.tournament-sponsored-prize .tsp-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.tournament-sponsored-prize .tsp-label {
    font-family: var(--ff-ui);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--c-text3);
}
.tournament-sponsored-prize .tsp-amount {
    font-family: var(--ff-display);
    font-weight: 800;
    font-size: 1.3rem;
}
.tournament-sponsored-prize .tsp-split {
    font-family: var(--ff-ui);
    font-size: .76rem;
    font-weight: 600;
    color: var(--neon-gold);
    text-align: right;
    line-height: 1.35;
}
.trn-start-time {
    font-family: var(--ff-ui);
    font-size: .8rem;
    font-weight: 600;
    color: var(--neon-cyan);
    margin-left: auto;
}
.admin-date-row { display: flex; gap: 10px; margin-bottom: 14px; }
.admin-date-row input[type="date"] {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: #fff;
    padding: 10px 12px;
    font-size: 14px;
    font-family: 'Rajdhani', sans-serif;
}

.admin-user-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; }
.admin-user-avatar { width: 44px; height: 44px; border-radius: 50%; background: rgba(168,85,247,0.2); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.admin-user-name { font-size: 15px; font-weight: 600; color: #fff; }
.admin-user-balance { font-size: 13px; color: #ffd700; margin-top: 2px; }

.admin-trn-card { padding: 14px 16px; margin-bottom: 10px; }
.admin-trn-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.admin-trn-name { font-size: 15px; font-weight: 600; color: #fff; }
.admin-trn-meta { font-size: 12px; color: rgba(255,255,255,0.45); }

/* ── Play with Coin lobby ───────────────────────────────────────── */
.btn-play-coin { background: linear-gradient(135deg, #c79a2a, #ffd75e); }

/* Custom Coin currency icon (replaces the 🪙 emoji). Sizes with surrounding text. */
.coin-ico {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    background: url('assets/coin.png') center / contain no-repeat;
    vertical-align: -0.22em;
    flex-shrink: 0;
}

.coin-games-list { display: flex; flex-direction: column; gap: 10px; }

.coin-game-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 16px;
    background: linear-gradient(135deg, rgba(255,215,0,0.05) 0%, rgba(255,255,255,0.03) 60%);
    border: 1px solid var(--c-border);
    transition: border-color .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
    animation: screenIn .3s var(--ease-out) both;
}
.coin-game-row:hover {
    border-color: rgba(255,215,0,0.35);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,215,0,0.08);
}

.coin-game-row .cg-avatar {
    flex: 0 0 auto;
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    font-family: var(--ff-display); font-weight: 700; font-size: 17px;
    color: var(--neon-gold); text-transform: uppercase;
    background: radial-gradient(circle at 32% 28%, rgba(255,215,0,0.28), rgba(255,140,0,0.07));
    border: 1.5px solid rgba(255,215,0,0.42);
    box-shadow: 0 0 12px rgba(255,215,0,0.15), inset 0 0 8px rgba(255,215,0,0.08);
}

.coin-game-row .cg-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.coin-game-row .cg-name {
    font-family: var(--ff-ui); font-weight: 600; font-size: 15px; color: var(--c-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.coin-game-row .cg-meta {
    font-family: var(--ff-ui); font-size: 11px; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase; color: var(--c-text3);
}

.coin-game-row .cg-stake {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px; border-radius: 999px; white-space: nowrap;
    font-family: var(--ff-ui); font-weight: 700; font-size: 15px;
    color: var(--neon-gold);
    background: rgba(255,215,0,0.10);
    border: 1px solid rgba(255,215,0,0.3);
}

.coin-game-row .cg-join {
    flex: 0 0 auto;
    padding: 10px 22px; border-radius: 12px; border: none; cursor: pointer;
    font-family: var(--ff-ui); font-weight: 700; font-size: 14px;
    letter-spacing: .06em; text-transform: uppercase;
    color: #04121f; background: var(--grad-cyan);
    box-shadow: 0 4px 14px rgba(0,140,255,0.32);
    transition: transform .15s var(--ease-out), box-shadow .2s var(--ease-out);
}
.coin-game-row .cg-join:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,140,255,0.48); }
.coin-game-row .cg-join:active { transform: translateY(0); }

.coin-game-row.cg-unaffordable { opacity: .6; }
.coin-game-row.cg-unaffordable .cg-avatar { color: var(--c-text3); border-color: var(--c-border2); background: var(--c-surface2); box-shadow: none; }
.coin-game-row.cg-unaffordable .cg-stake { color: var(--c-text2); background: var(--c-surface2); border-color: var(--c-border2); }
.coin-game-row.cg-unaffordable .cg-join {
    background: var(--c-surface2); color: var(--c-text3);
    box-shadow: none; pointer-events: none; letter-spacing: .02em;
}

.coin-mygame-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; }
.coin-mygame-status { font-size: 13px; opacity: 0.75; }
