/* ============================================
   WOJAK ARCADE - HUB STYLES
   Mini App feel — no footer, compact
   ============================================ */

:root {
    --bg-darkest: #04080f;
    --bg-dark: #0a1422;
    --bg-card: #0c1a2e;
    --bg-card-hover: #122440;
    --ton-blue: #0098EA;
    --ton-blue-dim: rgba(0, 152, 234, 0.15);
    --ton-blue-glow: rgba(0, 152, 234, 0.4);
    --ton-dark: #0b1929;
    --ton-light: #2AABEE;
    --neon-cyan: #2AABEE;
    --neon-yellow: #ffd600;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-muted: rgba(255, 255, 255, 0.3);
    --glass: rgba(0, 152, 234, 0.04);
    --glass-border: rgba(0, 152, 234, 0.12);
    --card-radius: 16px;
    --font-pixel: 'Press Start 2P', monospace;
    --font-ui: 'Inter', -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-darkest);
    color: var(--text-primary);
    font-family: var(--font-ui);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* ============================================
   BACKGROUND CANVAS
   ============================================ */
#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
}

#app {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */
#main-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(5, 5, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    filter: drop-shadow(0 0 8px var(--ton-blue-glow));
    animation: logoPulse 3s ease-in-out infinite;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: var(--font-pixel);
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-accent {
    color: var(--ton-blue);
    text-shadow: 0 0 15px var(--ton-blue-glow);
}

.logo-sub {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.chip-icon { font-size: 14px; }

.chip-value {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--neon-yellow);
}

/* ============================================
   HERO BANNER
   ============================================ */
#hero {
    padding: 0;
}

.hero-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 0.65;
    overflow: hidden;
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
    display: block;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(5, 5, 15, 0.1) 0%,
        rgba(5, 5, 15, 0.3) 50%,
        rgba(5, 5, 15, 0.95) 90%,
        var(--bg-darkest) 100%
    );
}

.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px;
    text-align: center;
}

.hero-tagline {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--ton-blue);
    text-shadow: 0 0 20px var(--ton-blue-glow);
    letter-spacing: 1px;
}

/* ============================================
   GAMES SECTION
   ============================================ */
#games-section {
    padding: 16px 16px 30px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title {
    font-family: var(--font-pixel);
    font-size: 14px;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-icon { font-size: 20px; }

/* ============================================
   GAME CARDS — 2 column grid
   ============================================ */
.games-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    position: relative;
}

.game-card:hover,
.game-card:active {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--ton-blue);
    box-shadow: 0 8px 30px rgba(0, 152, 234, 0.15), 0 0 0 1px var(--ton-blue);
}

.game-card.coming-soon {
    cursor: default;
    opacity: 0.5;
}

.game-card.coming-soon:hover {
    transform: none;
    border-color: var(--glass-border);
    box-shadow: none;
    opacity: 0.6;
}

/* All cards full width with same image ratio */
.card-image-wrapper {
    aspect-ratio: 16 / 9;
}

.card-image-wrapper {
    position: relative;
    overflow: hidden;
    background: var(--bg-dark);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.game-card:hover .card-image {
    transform: scale(1.08);
}

.card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-card));
}

.placeholder-emoji {
    font-size: 48px;
    opacity: 0.35;
    filter: grayscale(0.5);
}

.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    border-radius: 8px;
    font-family: var(--font-pixel);
    font-size: 8px;
    letter-spacing: 1px;
    font-weight: 700;
}

.card-badge.live {
    background: rgba(0, 152, 234, 0.2);
    color: var(--ton-blue);
    border: 1px solid rgba(0, 152, 234, 0.3);
    animation: livePulse 2s ease-in-out infinite;
}

.card-badge.soon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-play-icon {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    background: var(--ton-blue);
    color: var(--bg-darkest);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 900;
    box-shadow: 0 4px 15px var(--ton-blue-glow);
    transition: transform 0.2s ease;
}

.game-card:hover .card-play-icon {
    transform: scale(1.15);
}

.card-info {
    padding: 12px;
}

.card-title {
    font-family: var(--font-pixel);
    font-size: 10px;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

.card-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.meta-tag {
    font-size: 9px;
    padding: 3px 8px;
    background: var(--ton-blue-dim);
    color: var(--ton-blue);
    border-radius: 6px;
    font-weight: 600;
}

.meta-tag.locked {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 15, 35, 0.95);
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    z-index: 100;
    opacity: 0;
    transition: all 0.3s ease;
    font-family: var(--font-ui);
    white-space: nowrap;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes logoPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 152, 234, 0.3); }
    50% { box-shadow: 0 0 8px 2px rgba(0, 152, 234, 0.2); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-card {
    animation: fadeInUp 0.5s ease backwards;
}

.game-card:nth-child(1) { animation-delay: 0.1s; }
.game-card:nth-child(2) { animation-delay: 0.2s; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 380px) {
    .logo-title { font-size: 12px; }
    .card-title { font-size: 9px; }
    .card-desc { font-size: 10px; }
}

@media (min-width: 520px) {
    #app {
        border-left: 1px solid var(--glass-border);
        border-right: 1px solid var(--glass-border);
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-darkest); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* ============================================
   FLOATING DOCK (unified sidebar)
   ============================================ */
.floating-dock {
    position: fixed;
    right: 12px;
    bottom: 24px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 4px;
    border-radius: 20px;
    background: linear-gradient(165deg, rgba(12, 26, 46, 0.92), rgba(4, 8, 15, 0.96));
    border: 1px solid rgba(0, 152, 234, 0.18);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 0 60px -10px rgba(0, 152, 234, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: dockAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s backwards;
}

@keyframes dockAppear {
    from { opacity: 0; transform: translateX(20px) scale(0.9); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.dock-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 52px;
    padding: 10px 4px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

.dock-btn:active {
    transform: scale(0.9);
    background: rgba(0, 152, 234, 0.12);
}

.dock-svg {
    width: 22px;
    height: 22px;
    transition: all 0.3s ease;
}

.trophy-svg {
    color: #ffd700;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.3));
}

.info-svg {
    color: rgba(255, 255, 255, 0.55);
}

.dock-btn:active .trophy-svg {
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
    transform: scale(1.05);
}

.dock-btn:active .info-svg {
    color: var(--ton-blue);
    filter: drop-shadow(0 0 8px rgba(0, 152, 234, 0.4));
}

.dock-label {
    font-family: var(--font-ui);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.3s ease;
}

.dock-btn:active .dock-label {
    color: rgba(255, 255, 255, 0.7);
}

.dock-divider {
    width: 28px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    margin: 1px 0;
}

/* Ambient glow on trophy */
.dock-glow {
    position: absolute;
    inset: -3px;
    border-radius: 18px;
    pointer-events: none;
}

.trophy-glow {
    background: radial-gradient(circle, rgba(255, 215, 0, 0.08), transparent 70%);
    animation: ambientPulse 3s ease-in-out infinite;
}

@keyframes ambientPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ============================================
   LEADERBOARD PANEL (Slide-in from right)
   ============================================ */
.lb-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.3s ease; }
.lb-backdrop.show { opacity: 1; }

.lb-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(380px, 92vw); background: var(--bg-darkest); border-left: 1px solid var(--glass-border); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: -10px 0 40px rgba(0,0,0,0.5); }
.lb-panel.show { transform: translateX(0); }

.lb-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; border-bottom: 1px solid var(--glass-border); flex-shrink: 0; }
.lb-panel-title { font-family: var(--font-pixel); font-size: 14px; letter-spacing: 2px; color: var(--text-primary); }
.lb-close { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.05); color: var(--text-secondary); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; }
.lb-close:active { background: rgba(255,255,255,0.1); }

/* Tabs */
.lb-tabs { display: flex; gap: 4px; margin: 12px 16px; background: rgba(255,255,255,0.03); border-radius: 10px; padding: 3px; border: 1px solid var(--glass-border); flex-shrink: 0; }
.lb-tab { flex: 1; padding: 9px 6px; border: none; background: transparent; color: var(--text-secondary); font-family: var(--font-ui); font-size: 12px; font-weight: 700; border-radius: 8px; cursor: pointer; transition: all 0.25s ease; display: flex; align-items: center; justify-content: center; gap: 4px; }
.lb-tab.active { background: var(--ton-blue); color: #fff; box-shadow: 0 3px 12px rgba(0,152,234,0.35); }
.tab-emoji { font-size: 13px; }

/* Podium */
.lb-podium { display: flex; align-items: flex-end; justify-content: center; gap: 6px; padding: 8px 12px 0; min-height: 160px; flex-shrink: 0; }
.podium-slot { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; max-width: 100px; animation: podiumRise 0.5s ease-out backwards; }
.podium-slot.first { animation-delay: 0.15s; }
.podium-slot.second { animation-delay: 0.3s; }
.podium-slot.third { animation-delay: 0.4s; }
@keyframes podiumRise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.podium-crown { font-size: 18px; animation: crownBounce 2.5s ease-in-out infinite; filter: drop-shadow(0 0 5px rgba(255,215,0,0.4)); }
@keyframes crownBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.podium-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--bg-card); border: 2px solid var(--glass-border); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.podium-avatar.gold { width: 50px; height: 50px; border-color: #ffd600; box-shadow: 0 0 15px rgba(255,214,0,0.2); }
.podium-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-letter { font-family: var(--font-ui); font-size: 16px; font-weight: 800; color: var(--text-secondary); }
.podium-medal { font-size: 14px; }
.podium-name { font-size: 9px; font-weight: 700; color: var(--text-primary); max-width: 80px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-score { font-family: var(--font-pixel); font-size: 10px; color: var(--ton-blue); text-shadow: 0 0 8px var(--ton-blue-glow); }
.podium-bar { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, rgba(0,152,234,0.12), rgba(0,152,234,0.04)); border: 1px solid rgba(0,152,234,0.1); border-bottom: none; }
.podium-slot.first .podium-bar { height: 50px; background: linear-gradient(180deg, rgba(255,214,0,0.12), rgba(255,214,0,0.03)); border-color: rgba(255,214,0,0.12); }
.podium-slot.second .podium-bar { height: 36px; }
.podium-slot.third .podium-bar { height: 24px; background: linear-gradient(180deg, rgba(205,127,50,0.1), rgba(205,127,50,0.03)); border-color: rgba(205,127,50,0.1); }

/* Scrollable list */
.lb-scroll { flex: 1; overflow-y: auto; padding: 8px 12px; -webkit-overflow-scrolling: touch; }
.lb-list { display: flex; flex-direction: column; gap: 4px; }
.lb-row { display: flex; align-items: center; gap: 8px; padding: 9px 10px; background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: 10px; animation: fadeInUp 0.25s ease backwards; }
.lb-row.is-me { border-color: var(--ton-blue); background: rgba(0,152,234,0.06); box-shadow: 0 0 12px rgba(0,152,234,0.08); }
.lb-rank { font-family: var(--font-pixel); font-size: 9px; color: var(--text-muted); min-width: 26px; text-align: center; }
.lb-rank.top { color: var(--neon-yellow); }
.lb-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-dark); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; border: 1px solid var(--glass-border); }
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lb-avatar-letter { font-size: 12px; font-weight: 800; color: var(--text-secondary); }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-username { font-size: 9px; color: var(--text-muted); }
.lb-score { font-family: var(--font-pixel); font-size: 11px; color: var(--ton-blue); text-shadow: 0 0 6px var(--ton-blue-glow); text-align: right; }

/* Skeleton */
.lb-loading { display: flex; flex-direction: column; gap: 4px; }
.lb-skeleton { height: 48px; border-radius: 10px; background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.04) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.lb-empty { text-align: center; padding: 24px 16px; color: var(--text-muted); font-size: 12px; }
.lb-empty-emoji { font-size: 28px; margin-bottom: 6px; display: block; }

/* Your rank */
.lb-my-rank { flex-shrink: 0; border-top: 1px solid var(--ton-blue); padding: 8px 16px 12px; background: rgba(5,5,15,0.95); }
.my-rank-label { font-family: var(--font-pixel); font-size: 7px; color: var(--ton-blue); letter-spacing: 2px; margin-bottom: 3px; }
.my-rank-row { display: flex; align-items: center; gap: 8px; }
.my-rank-pos { font-family: var(--font-pixel); font-size: 13px; color: var(--neon-yellow); min-width: 36px; }
.my-rank-name { flex: 1; font-size: 13px; font-weight: 700; }
.my-rank-score { font-family: var(--font-pixel); font-size: 13px; color: var(--ton-blue); text-shadow: 0 0 8px var(--ton-blue-glow); }

.hidden { display: none !important; }

/* Info FAB is now part of floating dock — styles above */

/* ============================================
   INFO PANEL (Slide-in from right)
   ============================================ */
.info-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.3s ease; }
.info-backdrop.show { opacity: 1; }

.info-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(380px, 92vw); background: var(--bg-darkest); border-left: 1px solid var(--glass-border); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: -10px 0 40px rgba(0,0,0,0.5); }
.info-panel.show { transform: translateX(0); }

.info-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; border-bottom: 1px solid var(--glass-border); flex-shrink: 0; }
.info-panel-title { font-family: var(--font-pixel); font-size: 12px; letter-spacing: 2px; color: var(--text-primary); }

.info-content { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }

.info-block {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
    animation: fadeInUp 0.3s ease backwards;
}
.info-block:nth-child(1) { animation-delay: 0.05s; }
.info-block:nth-child(2) { animation-delay: 0.1s; }
.info-block:nth-child(3) { animation-delay: 0.15s; }
.info-block:nth-child(4) { animation-delay: 0.2s; }
.info-block:nth-child(5) { animation-delay: 0.25s; }

.info-block-icon { font-size: 24px; margin-bottom: 6px; }

.info-block h3 {
    font-family: var(--font-pixel);
    font-size: 10px;
    margin-bottom: 6px;
    color: var(--ton-blue);
    letter-spacing: 1px;
}

.info-block p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.info-block p strong {
    color: var(--text-primary);
}
