/* ============================================================
   MG APP Store — Poki-style Modern Theme  v5.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --blue:        #18A0FB;
    --blue-dark:   #0d7fd4;
    --blue-deep:   #0a5fa0;
    --green:       #19CE60;
    --green-dark:  #13a84d;
    --red:         #FF4757;
    --gold:        #FFD700;
    --purple:      #a78bfa;

    --bg:          #18A0FB;
    --nav-bg:      rgba(0, 50, 100, 0.45);
    --card-bg:     #ffffff;
    --card-hover-shadow: 0 20px 50px rgba(0,0,0,0.28);

    --lb-bg:       rgba(255,255,255,0.15);
    --lb-hover:    rgba(255,255,255,0.22);

    --text-dark:   #1a1a2e;
    --text-mid:    #444;
    --text-dim:    #888;
    --text-blue:   #18A0FB;
    --text-white:  #ffffff;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    background: var(--blue);
    min-height: 100vh;
    color: var(--text-white);
    overflow-x: hidden;
    position: relative;
}

/* ── Decorative background blobs ──────────────────────────── */
body::before {
    content: '';
    position: fixed;
    top: -150px; right: -100px;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.13) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    bottom: -120px; left: -80px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(0,40,100,0.22) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* Stars canvas hidden */
#stars-canvas { display: none; }
#orbs-canvas {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 1;
}

nav, main, section, aside, .filter-bar,
.page-layout, .modal-overlay, .hero { position: relative; z-index: 1; }

/* ── Decorative background shapes ──────────────────────── */
.bg-deco {
    position: fixed; inset: 0;
    z-index: 0; pointer-events: none; overflow: hidden;
}
.bg-shape {
    position: absolute; border-radius: 50%;
    opacity: 0.08; background: #fff;
}
.bg-shape:nth-child(1) { width: 320px; height: 320px; top: 8%;  left: 4%; }
.bg-shape:nth-child(2) { width: 200px; height: 200px; top: 50%; right: 6%; opacity: 0.06; }
.bg-shape:nth-child(3) { width: 140px; height: 140px; top: 28%; right: 22%; opacity: 0.09; }
.bg-shape:nth-child(4) { width: 240px; height: 240px; bottom: 12%; left: 28%; opacity: 0.05; }

.bg-cross { position: absolute; opacity: 0.12; width: 22px; height: 22px; }
.bg-cross::before, .bg-cross::after {
    content: ''; position: absolute; background: #fff; border-radius: 3px;
}
.bg-cross::before { width: 4px; height: 22px; left: 9px; top: 0; }
.bg-cross::after  { width: 22px; height: 4px; left: 0; top: 9px; }
.bg-cross:nth-of-type(1) { top: 12%; left: 16%; transform: rotate(15deg); }
.bg-cross:nth-of-type(2) { top: 44%; right: 13%; transform: rotate(-20deg); opacity: 0.08; }
.bg-cross:nth-of-type(3) { bottom: 22%; left: 9%; transform: rotate(35deg); opacity: 0.1; }

.bg-dot {
    position: absolute; border-radius: 50%; background: #fff;
    width: 10px; height: 10px; opacity: 0.15;
}
.bg-dot:nth-of-type(1) { top: 20%; right: 17%; }
.bg-dot:nth-of-type(2) { top: 60%; left: 11%; width: 7px; height: 7px; }
.bg-dot:nth-of-type(3) { bottom: 28%; right: 24%; width: 9px; height: 9px; }
.bg-dot:nth-of-type(4) { top: 36%; left: 42%; width: 6px; height: 6px; opacity: 0.2; }

.bg-ring {
    position: absolute; border: 3px solid rgba(255,255,255,0.12);
    border-radius: 50%;
}
.bg-ring:nth-of-type(1) { width: 48px; height: 48px; top: 26%; right: 36%; }
.bg-ring:nth-of-type(2) { width: 30px; height: 30px; bottom: 26%; left: 22%; }

.bg-star {
    position: absolute; background: #fff;
    width: 16px; height: 16px; opacity: 0.12;
    transform: rotate(45deg); border-radius: 2px;
}
.bg-star:nth-of-type(1) { top: 8%;  right: 26%; }
.bg-star:nth-of-type(2) { bottom: 20%; right: 42%; width: 11px; height: 11px; }

/* ── Top Nav ───────────────────────────────────────────────── */
.top-nav {
    position: sticky; top: 0; z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding: 0 2rem;
    height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
}

.nav-brand {
    font-size: 1.55rem;
    font-weight: 900;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
    white-space: nowrap;
}
.nav-brand span { color: var(--gold); }

.nav-right { display: flex; align-items: center; gap: 0.75rem; }

/* ── Buttons (global) ──────────────────────────────────────── */
.btn-primary {
    padding: 0.55rem 1.4rem;
    background: var(--green);
    color: #002B50;
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}
.btn-primary:hover {
    background: var(--green-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(25,206,96,0.4);
}
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
    padding: 0.45rem 1rem;
    background: transparent;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    color: rgba(255,255,255,0.85);
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}
.btn-ghost:hover {
    border-color: rgba(255,255,255,0.7);
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 2.2rem 1rem 1.8rem;
}
.hero h1 {
    font-size: clamp(1.5rem, 4vw, 2.4rem);
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 16px rgba(0,0,0,0.2);
}
.hero h1 span { color: var(--gold); }
.hero p {
    color: rgba(255,255,255,0.75);
    font-size: 1rem;
    font-weight: 700;
}

/* ── Page Layout ───────────────────────────────────────────── */
.page-layout {
    display: flex;
    align-items: flex-start;
    gap: 2.5rem; /* Increased gap for more breathing room */
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem; /* Increased horizontal padding */
}

/* ══════════════════════════════════════════════════════════
   LEADERBOARD SIDEBAR
   ══════════════════════════════════════════════════════════ */

/* Statistics Overview Cards */
.stats-overview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.stat-box {
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 1.2rem 1rem;
    text-align: center;
    transition: all 0.3s;
    min-height: 140px; /* Fixed height to prevent shaking */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-box:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    margin-bottom: 0.4rem;
    font-family: 'Nunito', monospace;
    min-width: 80px; /* Fixed minimum width to prevent layout shift */
    display: inline-block;
}

.stat-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}

/* Number scroll animation */
.stat-number.animating {
    animation: numberScroll 0.8s ease-out forwards;
}

@keyframes numberScroll {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.leaderboard-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 76px;
    align-self: flex-start;
}

.leaderboard-panel {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.25);
    overflow: hidden;
}

.leaderboard-header {
    padding: 1rem 1.1rem 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.leaderboard-title {
    font-size: 1rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.3px;
}

.leaderboard-list { padding: 0.3rem 0; }

/* Normal rank rows */
.lb-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 1rem; /* Reduced padding */
    border-bottom: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: #fff;
}
.lb-item:last-child { border-bottom: none; }
.lb-item:hover { background: var(--lb-hover); }

/* TOP 3 — bigger & highlighted */
.lb-item.lb-top3 {
    padding: 0.55rem 1rem; /* Reduced padding */
    background: rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.lb-item.lb-top3:hover { background: rgba(255,255,255,0.2); }

.lb-rank {
    font-size: 1rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
    font-weight: 900;
}
.lb-rank-1 { font-size: 1.35rem; }
.lb-rank-2 { font-size: 1.15rem; }
.lb-rank-3 { font-size: 1rem; }
.lb-rank-n { font-size: 0.82rem; color: rgba(255,255,255,0.55); font-weight: 800; }

/* Thumbnail */
.lb-thumb {
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: none;
}
.lb-item.lb-top3 .lb-thumb { width: 46px; height: 46px; }
.lb-item:not(.lb-top3) .lb-thumb { width: 34px; height: 34px; }

.lb-thumb-ph {
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    flex-shrink: 0;
}
.lb-item.lb-top3 .lb-thumb-ph { width: 46px; height: 46px; font-size: 1.3rem; }
.lb-item:not(.lb-top3) .lb-thumb-ph { width: 34px; height: 34px; font-size: 0.95rem; }

.lb-info { flex: 1; min-width: 0; }
.lb-name {
    font-weight: 800;
    color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 0.15rem;
}
.lb-item.lb-top3 .lb-name { font-size: 0.9rem; }
.lb-item:not(.lb-top3) .lb-name { font-size: 0.78rem; }

.lb-meta {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
}

.lb-author {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px; /* Limit width */
    flex-shrink: 1;
}

.lb-dot {
    font-size: 0.5rem;
    color: rgba(255,255,255,0.4);
}

.lb-views {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.6);
    font-weight: 700;
    flex-shrink: 0; /* Don't shrink views */
}
    font-weight: 700;
    color: rgba(255,255,255,0.65);
}
.lb-item.lb-top3 .lb-views { font-size: 0.78rem; }
.lb-item:not(.lb-top3) .lb-views { font-size: 0.7rem; }

/* ── Main Content ──────────────────────────────────────────── */
.main-content { flex: 1; min-width: 0; }

/* ── Filter & Sort Bar ─────────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 0;
    margin-bottom: 0.8rem;
}

.search-box {
    flex: 1; min-width: 150px; max-width: 210px;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.2);
    border: 1.5px solid rgba(255,255,255,0.35);
    border-radius: 50px;
    color: #fff;
    font-size: 0.85rem; font-family: inherit; font-weight: 700;
    outline: none;
    transition: background 0.15s, border-color 0.15s;
    backdrop-filter: blur(8px);
}
.search-box::placeholder { color: rgba(255,255,255,0.55); }
.search-box:focus {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.7);
}

.tag-filter-btn, .sort-btn {
    padding: 0.42rem 0.9rem;
    background: rgba(255,255,255,0.15);
    border: 1.5px solid rgba(255,255,255,0.25);
    border-radius: 50px;
    color: rgba(255,255,255,0.85);
    font-size: 0.8rem; font-family: inherit; font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    backdrop-filter: blur(6px);
}
.tag-filter-btn:hover, .sort-btn:hover {
    background: rgba(255,255,255,0.28);
    color: #fff;
    transform: translateY(-1px);
}
.tag-filter-btn.active {
    background: #fff;
    border-color: #fff;
    color: var(--blue);
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.sort-btn.active {
    background: var(--green);
    border-color: var(--green);
    color: #002B50;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(25,206,96,0.35);
}

.sort-divider {
    width: 1px; height: 20px;
    background: rgba(255,255,255,0.25);
    margin: 0 0.1rem;
}

/* ── App Grid ──────────────────────────────────────────────── */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
}

/* ── App Card ──────────────────────────────────────────────── */
.app-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.14);
    position: relative;
    display: flex;
    flex-direction: column;
    border: none;
}
.app-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-hover-shadow);
    z-index: 2;
}

/* Hot glow */
.app-card.card-hot-glow {
    box-shadow: 0 4px 16px rgba(0,0,0,0.14), 0 0 0 2px #FFD700, 0 0 20px rgba(255,215,0,0.4);
    animation: cardGlow 2s ease-in-out infinite alternate;
}
@keyframes cardGlow {
    from { box-shadow: 0 4px 16px rgba(0,0,0,0.14), 0 0 0 2px #FFD700, 0 0 12px rgba(255,215,0,0.35); }
    to   { box-shadow: 0 4px 16px rgba(0,0,0,0.14), 0 0 0 2px #FFD700, 0 0 28px rgba(255,215,0,0.65); }
}

/* Warm */
.app-card.card-warm {
    box-shadow: 0 4px 16px rgba(0,0,0,0.14), 0 0 0 2px rgba(25,206,96,0.6);
}

/* ── Card Thumbnail ────────────────────────────────────────── */
.card-thumb-wrap {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: linear-gradient(135deg, #1580c7, #0e6aad);
    flex-shrink: 0;
}
.card-thumb {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.app-card:hover .card-thumb { transform: scale(1.06); }
.card-thumb-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, #1580c7 0%, #0a5fa0 100%);
}

/* Hover overlay with play circle */
.card-thumb-wrap::after {
    content: '▶';
    position: absolute; inset: 0;
    background: rgba(10,80,150,0.55);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.app-card:hover .card-thumb-wrap::after { opacity: 1; }

/* ── Card Badges ───────────────────────────────────────────── */
.card-tag {
    position: absolute; top: 8px; right: 8px;
    padding: 0.2rem 0.6rem;
    font-size: 0.68rem; font-weight: 800; color: #fff;
    border-radius: 50px;
    backdrop-filter: blur(6px);
    text-shadow: none;
    letter-spacing: 0.3px;
}
.card-hot-badge {
    position: absolute; top: 8px; left: 8px;
    background: var(--gold);
    color: #6B4A00;
    font-size: 0.66rem; font-weight: 900;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    animation: pulseBadge 1.6s ease-in-out infinite;
}
@keyframes pulseBadge { 0%,100%{opacity:1} 50%{opacity:0.75} }
.card-warm-badge {
    position: absolute; top: 8px; left: 8px;
    background: var(--green);
    color: #003820;
    font-size: 0.66rem; font-weight: 900;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
}
.card-cold-badge {
    position: absolute; top: 8px; left: 8px;
    background: rgba(255,255,255,0.85);
    color: #444;
    font-size: 0.66rem; font-weight: 900;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
}

/* ── Card Body ─────────────────────────────────────────────── */
.card-body {
    padding: 0.8rem 1rem 0.9rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.3rem;
}

.card-title {
    font-size: 0.95rem; font-weight: 800;
    color: var(--text-dark);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-author {
    font-size: 0.76rem; color: var(--blue);
    display: flex; align-items: center; gap: 0.3rem;
    flex-wrap: wrap; font-weight: 700;
}
.author-badge { font-size: 0.78rem; }
.card-time { font-size: 0.66rem; color: var(--text-dim); margin-left: auto; }
.card-desc {
    font-size: 0.76rem; color: var(--text-mid);
    display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2em; line-height: 1.5;
    flex: 1;
}
.card-footer {
    display: flex; align-items: center;
    justify-content: space-between; gap: 0.35rem;
    margin-top: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
}
.card-views {
    font-size: 0.72rem; color: var(--text-dim); font-weight: 700;
    display: flex; align-items: center; gap: 0.2rem;
}
.card-actions { display: flex; align-items: center; gap: 0.3rem; }

/* ── Card Buttons ──────────────────────────────────────────── */
.btn-play {
    padding: 0.35rem 0.95rem;
    background: var(--green);
    color: #002B50;
    border: none;
    border-radius: 50px;
    font-size: 0.78rem; font-weight: 800;
    font-family: inherit; cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    display: inline-flex; align-items: center;
}
.btn-play:hover {
    background: var(--green-dark);
    transform: scale(1.06);
}
.btn-play:active { transform: scale(0.97); }

.btn-download-card {
    padding: 0.35rem 0.55rem;
    background: #f4f4f4;
    border: 1.5px solid #e0e0e0;
    border-radius: 50px;
    color: #666; font-size: 0.78rem;
    cursor: pointer; transition: all 0.15s;
    text-decoration: none; display: inline-flex; align-items: center;
}
.btn-download-card:hover {
    background: #e8e8e8;
    color: var(--text-dark);
}

.btn-share-card {
    padding: 0.35rem 0.55rem;
    background: #f8f8f8;
    border: 1.5px solid #d8d8d8;
    border-radius: 50px;
    color: #888; font-size: 0.82rem;
    cursor: pointer; transition: all 0.15s;
    display: inline-flex; align-items: center;
}
.btn-share-card:hover {
    background: #e8e8e8;
    color: #666;
    border-color: #c8c8c8;
}

.btn-edit-card {
    padding: 0.32rem 0.55rem;
    background: #fff0f8;
    border: 1.5px solid #f0c0e0;
    border-radius: 50px;
    color: #c050a0; font-size: 0.72rem; font-weight: 700;
    display: none; align-items: center;
    cursor: pointer; text-decoration: none;
    transition: all 0.15s;
}
.btn-edit-card:hover { background: #ffe0f4; }

.btn-ai-card {
    position: absolute; bottom: 0.55rem; right: 0.55rem;
    padding: 0.22rem 0.6rem;
    background: rgba(167,139,250,0.15);
    border: 1.5px solid rgba(167,139,250,0.5);
    border-radius: 50px;
    color: #7c5fe6; font-size: 0.65rem; font-weight: 800;
    cursor: pointer; transition: all 0.15s;
    display: none;
}
.btn-ai-card:hover {
    background: var(--purple);
    color: #fff;
    border-color: var(--purple);
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 5rem 1rem;
    color: rgba(255,255,255,0.5); font-size: 1rem; font-weight: 700;
}

/* ── Modals ────────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(5,40,90,0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 500; align-items: center; justify-content: center;
    padding: 1rem;
}
.modal-overlay.active { display: flex; }

.modal-box {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.3);
    padding: 2rem; width: 100%; max-width: 520px;
    max-height: 92vh; overflow-y: auto;
    position: relative;
    animation: modalIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
    color: var(--text-dark);
}
@keyframes modalIn {
    from { opacity:0; transform: scale(0.92) translateY(12px); }
    to   { opacity:1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    background: #f4f4f4;
    border: none;
    border-radius: 50%;
    color: #888; font-size: 1rem;
    cursor: pointer; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; transition: all 0.15s; line-height: 1;
}
.modal-close:hover { background: #e0e0e0; color: var(--text-dark); }

.modal-title {
    font-size: 1.25rem; font-weight: 900;
    color: var(--text-dark); margin-bottom: 1.4rem;
    padding-right: 2.5rem;
}

/* Preview modal */
.preview-modal-box {
    background: #1a1a2e;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    width: 100%; max-width: 940px; height: 90vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.preview-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1.2rem;
    background: rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    gap: 0.8rem; flex-shrink: 0;
}
.preview-title {
    font-weight: 800; font-size: 0.95rem; color: #fff;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.preview-iframe { flex: 1; width: 100%; border: none; background: #fff; }

.btn-fullscreen {
    padding: 0.35rem 0.8rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    color: rgba(255,255,255,0.8); font-size: 0.78rem;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
    white-space: nowrap; font-weight: 700;
}
.btn-fullscreen:hover { background: rgba(255,255,255,0.22); color: #fff; }

/* Form elements */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; font-size: 0.8rem; font-weight: 800;
    color: var(--text-mid); margin-bottom: 0.38rem;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.form-group input[type="text"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    width: 100%; padding: 0.65rem 0.95rem;
    background: #f8f9fa;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    color: var(--text-dark); font-size: 0.9rem; font-family: inherit;
    outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(24,160,251,0.15);
    background: #fff;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.28rem; }
.char-count { font-size: 0.72rem; color: var(--text-dim); text-align: right; margin-top: 0.2rem; }

.btn-submit-form {
    width: 100%; padding: 0.8rem;
    background: var(--green);
    color: #002B50;
    border: none;
    border-radius: 12px;
    font-size: 1rem; font-weight: 800;
    font-family: inherit; cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.15s, transform 0.15s;
    box-shadow: 0 4px 16px rgba(25,206,96,0.35);
}
.btn-submit-form:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(25,206,96,0.45);
}
.btn-submit-form:active { transform: translateY(0); }

/* Alerts */
.alert {
    padding: 0.75rem 1rem; font-size: 0.85rem; font-weight: 700;
    border-radius: 12px;
}
.alert-success {
    background: #e8faf0; border: 1.5px solid #a0e8c0; color: #0a6a30;
}
.alert-error {
    background: #ffeaea; border: 1.5px solid #ffb0b0; color: #c02020;
}

/* Celebrate */
.celebrate-box { text-align: center; }
.celebrate-emoji { font-size: 3.5rem; margin-bottom: 0.6rem; display: block; }
.celebrate-title {
    font-size: 1.3rem; font-weight: 900;
    color: var(--text-dark); margin-bottom: 0.4rem;
}
.celebrate-sub {
    color: var(--green-dark); margin-bottom: 0.4rem;
    font-size: 0.95rem; font-weight: 700;
}
.celebrate-edit-hint { font-size: 0.78rem; color: var(--text-dim); margin-bottom: 1.3rem; }

/* Hot badge modal */
.hot-badge-modal { text-align: center; }
.hot-badge-modal .plays-count {
    font-size: 3rem; font-weight: 900;
    color: var(--blue);
    margin: 0.5rem 0; display: block; line-height: 1.3;
}
.hot-badge-modal .tip-text {
    white-space: pre-line; text-align: left;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1.5px solid #e8e8e8;
    padding: 0.9rem 1rem; font-size: 0.83rem;
    color: var(--text-mid); margin: 1rem 0; line-height: 1.75;
}
.hot-badge-actions {
    display: flex; gap: 0.8rem;
    justify-content: center; flex-wrap: wrap; margin-top: 1rem;
}
.hot-badge-actions .btn-ghost {
    color: var(--blue); border-color: rgba(24,160,251,0.4);
    background: rgba(24,160,251,0.08);
}
.hot-badge-actions .btn-ghost:hover {
    background: rgba(24,160,251,0.15);
    border-color: var(--blue);
}

/* AI modal */
.ai-body-text {
    white-space: pre-line;
    background: #f3f0ff;
    border-radius: 12px;
    border: 1.5px solid rgba(167,139,250,0.35);
    padding: 1rem; font-size: 0.85rem;
    color: var(--text-mid); margin: 1rem 0; line-height: 1.75;
}

/* Confetti & stars canvases */
#confetti-canvas {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 999;
}

/* ── Click ripple feedback ──────────────────────────────────── */
.mc-click-ripple {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: rippleUp 0.65s ease-out forwards;
    white-space: nowrap;
}
@keyframes rippleUp {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-44px) scale(0.75); }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 960px) {
    .page-layout {
        flex-direction: column;
        padding: 0 0.8rem 2rem;
        gap: 0.8rem;
    }
    .leaderboard-sidebar {
        width: 100%; position: static;
    }
    .leaderboard-panel { border-radius: 16px; }
    .leaderboard-list {
        display: flex; flex-wrap: nowrap;
        overflow-x: auto; gap: 0;
        scrollbar-width: none;
    }
    .leaderboard-list::-webkit-scrollbar { display: none; }
    .lb-item {
        border-bottom: none;
        border-right: 1px solid rgba(255,255,255,0.1);
        min-width: 160px; flex-shrink: 0;
    }
    .lb-item:last-child { border-right: none; }
    .lb-item.lb-top3 { min-width: 185px; }
    .filter-bar { padding: 0.7rem 0 0.5rem; }
    .app-grid {
        gap: 0.75rem;
        grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    }
}

@media (max-width: 600px) {
    /* 导航栏改为垂直布局 */
    .top-nav {
        flex-direction: column;
        height: auto;
        padding: 0.8rem 1rem;
        gap: 0.5rem;
    }
    .nav-brand {
        font-size: 1.2rem;
        width: 100%;
    }
    .nav-right {
        width: 100%;
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.2rem;
    }
    .nav-right::-webkit-scrollbar {
        display: none;
    }
    /* 按钮在移动端适当缩小 */
    .nav-right .btn-ghost,
    .nav-right .btn-primary {
        flex-shrink: 0;
        font-size: 0.82rem;
        padding: 0.4rem 0.9rem;
    }

    .hero { padding: 1.5rem 1rem 1.2rem; }
    .hero h1 { font-size: 1.4rem; }
    .app-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
    .app-card { border-radius: 12px; }
    .card-thumb-wrap { aspect-ratio: 4/3; }
    /* 移动端隐藏下载按钮 */
    .btn-download-card { display: none; }
    /* 移动端开始按钮只显示图标 */
    .btn-play {
        padding: 0.35rem 0.65rem;
        font-size: 0; /* 隐藏文字 */
    }
    .btn-play::before {
        content: '▶';
        font-size: 0.9rem;
    }
}
