/* ==========================================================================
   MakeGamesWithAI · Shared components (v6)
   Load after reset/variables/header/footer/buttons/forms/loading on every page.
   Page stylesheets add only what is specific to that page.
   ========================================================================== */

/* ---------- Layout ---------- */
.page { min-height: calc(100vh - 62px); display: flex; flex-direction: column; }
.page-container, .section-container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.page-container.narrow { max-width: 760px; }
.page-container.medium { max-width: 920px; }
.page-main { padding: 48px 0 96px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.page-header h1 { margin-bottom: .35rem; }
.page-subtitle, .page-header p { color: var(--ink-2); font-size: 1.02rem; max-width: 60ch; }
.page-header .page-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-header h2 { font-size: 1.25rem; }
.kicker { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--blue-ink); margin-bottom: .5rem; }
.kicker.k-mint { color: var(--mint-ink); } .kicker.k-coral { color: var(--coral-ink); } .kicker.k-violet { color: var(--violet-ink); } .kicker.k-amber { color: var(--amber-ink); }
.title-gradient { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Tinted hero band for list pages */
.page-hero { position: relative; overflow: hidden; padding: 56px 0 40px; background: linear-gradient(180deg, var(--sky), #fff); }
.page-hero.lav { background: linear-gradient(180deg, var(--lav), #fff); }
.page-hero.mint { background: linear-gradient(180deg, var(--mintT), #fff); }
.page-hero.peach { background: linear-gradient(180deg, var(--peach), #fff); }
.page-hero h1 { margin-bottom: .5rem; }
.page-hero p { color: var(--ink-2); max-width: 58ch; font-size: 1.05rem; }
.page-hero .wash { position: absolute; inset: 0; pointer-events: none; }
.page-hero .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .22; }

/* ---------- Cards ---------- */
.card, .account-section, .upload-card, .help-card, .login-box, .stat-card, .growth-chart-section { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card { padding: 1.5rem; }
.card-hover { transition: transform .22s var(--ease), box-shadow .22s var(--ease); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card-soft { background: var(--bg-soft); border: 0; box-shadow: none; }
.card-title { font-size: 1.05rem; margin-bottom: .25rem; }
.card-sub { color: var(--ink-2); font-size: .92rem; }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-tile { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem 1.2rem; display: grid; gap: .2rem; }
.stat-tile .stat-value, .stat-value { font-family: var(--display); font-weight: 600; font-size: 1.6rem; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-tile .stat-label, .stat-label { font-size: .82rem; color: var(--ink-3); font-weight: 500; }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--sky); color: var(--blue-ink); margin-bottom: .4rem; }
.stat-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat-icon.mint { background: var(--mintT); color: var(--mint-ink); } .stat-icon.coral { background: var(--peach); color: var(--coral-ink); } .stat-icon.violet { background: var(--lav); color: var(--violet-ink); } .stat-icon.amber { background: var(--sun); color: var(--amber-ink); }

/* ---------- Icon tokens (inline SVG, stroke = currentColor) ---------- */
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon-circle { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--sky); color: var(--blue-ink); }
.icon-circle svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-circle.mint { background: var(--mintT); color: var(--mint-ink); }
.icon-circle.coral { background: var(--peach); color: var(--coral-ink); }
.icon-circle.violet { background: var(--lav); color: var(--violet-ink); }
.icon-circle.amber { background: var(--sun); color: var(--amber-ink); }

/* ---------- Badges & pills ---------- */
.badge, .subscription-badge, .staff-pick-badge, .leaderboard-card-badge, .upgrade-plan-badge {
    display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 700; letter-spacing: .02em;
    padding: .3rem .6rem; border-radius: 7px; background: var(--sky); color: var(--blue-ink); line-height: 1; white-space: nowrap;
}
.badge-mint { background: var(--mintT); color: var(--mint-ink); }
.badge-coral { background: var(--peach); color: var(--coral-ink); }
.badge-violet { background: var(--lav); color: var(--violet-ink); }
.badge-amber { background: var(--sun); color: var(--amber-ink); }
.badge-ink { background: var(--ink); color: #fff; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Segmented control / range pills */
.segmented, .growth-range-pills { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: .25rem; gap: .15rem; }
.seg, .range-pill { font-family: var(--body); font-weight: 600; font-size: .86rem; color: var(--ink-2); background: transparent; border: 0; border-radius: 8px; padding: .45rem .8rem; cursor: pointer; transition: background .18s var(--ease), color .18s var(--ease); }
.seg.active, .range-pill.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* Chips */
.chip { font-weight: 600; font-size: .84rem; color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .4rem .7rem; cursor: pointer; white-space: nowrap; transition: border-color .18s var(--ease), color .18s var(--ease); }
.chip:hover, .chip.active { border-color: var(--blue); color: var(--blue-ink); }

/* ---------- Empty, error, denied ---------- */
.empty-state, .error-state, .access-denied, .result-section, .error-section {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem;
    padding: 3.5rem 1.5rem; border: 1px dashed var(--line-2); border-radius: var(--r-lg); background: var(--bg-soft);
}
.empty-state h3, .error-state .error-title, .access-denied h2, .result-section h3, .error-section h3 { font-size: 1.15rem; margin-top: .25rem; }
.empty-state p, .error-state .error-message, .access-denied p, .result-section p, .error-section p { color: var(--ink-2); max-width: 46ch; }
.empty-state .btn, .error-state .btn, .access-denied .btn, .result-actions { margin-top: .75rem; }
.empty-icon, .error-icon, .denied-icon, .result-icon, .modal-icon, .login-modal-icon, .info-icon, .dropzone-icon {
    display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--sky); color: var(--blue-ink); font-size: 0;
}
.empty-icon svg, .error-icon svg, .denied-icon svg, .result-icon svg, .modal-icon svg, .login-modal-icon svg, .info-icon svg, .dropzone-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.error-icon, .denied-icon, .error-section .error-icon { background: var(--rose); color: var(--coral-ink); }
.result-icon { background: var(--mintT); color: var(--mint-ink); }
.error-state { display: none; }
.error-state.show { display: flex; }

/* ---------- Modals ---------- */
.modal-overlay, .modal, .login-modal, .asset-modal, .upgrade-modal-overlay {
    position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 1rem;
    background: rgba(15, 18, 34, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal-overlay.active, .modal.active, .login-modal.active, .modal-overlay.show, .modal.show { display: flex; }
.modal-box, .modal-content, .login-modal-content, .asset-modal-content, .mp-lobby-content {
    position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 2rem); overflow: auto;
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 1.75rem;
}
.modal-content.modal-large, .asset-modal-content { max-width: 860px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: -.25rem 0 1rem; }
.modal-header h2, .modal-header h3 { font-size: 1.15rem; }
.modal-body { color: var(--ink-2); }
.modal-footer { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }
.modal-box h2, .login-modal-title { font-size: 1.3rem; margin: .75rem 0 .5rem; }
.modal-box p, .login-modal-text { color: var(--ink-2); margin-bottom: .75rem; }
.modal-box .submit-btn { margin-top: .75rem; }
.login-modal-content { text-align: center; }
.login-modal-actions { display: flex; gap: .6rem; justify-content: center; margin: 1rem 0 .5rem; flex-wrap: wrap; }
.login-modal-backdrop { display: none; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 1100; display: flex; align-items: center; gap: .6rem; background: var(--ink); color: #fff; border-radius: 12px; padding: .8rem 1.1rem; font-size: .92rem; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease); max-width: calc(100vw - 32px); }
.toast.show, .toast.visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--mint); color: #fff; font-size: .7rem; font-weight: 700; }
.toast.error .toast-icon { background: var(--coral); }

/* ---------- Tables ---------- */
.table-wrap, .review-table-wrap, .leaderboard-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; }
table.data-table, .review-table, .leaderboard-table, .admin-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.data-table th, .review-table th, .leaderboard-table th, .admin-table th { text-align: left; font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); background: var(--bg-soft); padding: .75rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td, .review-table td, .leaderboard-table td, .admin-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink); }
.data-table tr:last-child td, .review-table tr:last-child td, .leaderboard-table tr:last-child td, .admin-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover, .review-table tbody tr:hover, .leaderboard-table tbody tr:hover, .admin-table tbody tr:hover { background: var(--bg-soft); }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .88em; }

/* Pagination & load more */
.pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }
.pagination button, .page-btn { min-width: 36px; height: 36px; padding: 0 .6rem; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); font-weight: 600; font-size: .88rem; cursor: pointer; }
.pagination button.active, .page-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }
.load-more-container { display: flex; justify-content: center; margin-top: 2rem; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--ink-3); margin-bottom: 1rem; flex-wrap: wrap; }
.breadcrumb-item { color: var(--ink-3); cursor: pointer; }
.breadcrumb-item:hover { color: var(--ink); }
.breadcrumb-item.active { color: var(--ink); font-weight: 600; cursor: default; }
.breadcrumb-item + .breadcrumb-item::before { content: "/"; color: var(--line-2); margin-right: .5rem; }
.back-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink-2); font-weight: 600; font-size: .9rem; text-decoration: none; margin-bottom: 1rem; }
.back-link:hover { color: var(--ink); }

/* Avatar */
.avatar, .profile-avatar, .profile-avatar-large { border-radius: 50%; object-fit: cover; background: var(--bg-soft); border: 1px solid var(--line-2); }

/* Game cards (shared by dashboard, explore, leaderboards) */
.game-card { display: block; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .22s var(--ease), box-shadow .22s var(--ease); }
.game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.game-card-thumb, .game-preview { aspect-ratio: 16 / 10; width: 100%; object-fit: cover; background: var(--bg-soft); display: block; }
.game-card-body { padding: .9rem 1rem 1rem; display: grid; gap: .25rem; }
.game-card-title { font-family: var(--display); font-weight: 600; font-size: .98rem; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-card-meta { font-size: .82rem; color: var(--ink-3); display: flex; gap: .75rem; flex-wrap: wrap; }
.game-card-actions { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }
.cover-fallback { display: grid; place-items: center; aspect-ratio: 16 / 10; width: 100%; background: linear-gradient(135deg, var(--sky), var(--lav)); color: var(--ink-2); font-family: var(--display); font-weight: 600; padding: 1rem; text-align: center; }
.cover-fallback svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Utilities ---------- */
.muted { color: var(--ink-3); }
.text-center { text-align: center; }
.stack { display: grid; gap: 1rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

@media (max-width: 760px) {
    .page-main { padding: 32px 0 72px; }
    .page-container, .section-container { padding: 0 16px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
    .page-hero { padding: 40px 0 28px; }
    .modal-box, .modal-content, .login-modal-content, .asset-modal-content { padding: 1.35rem; border-radius: var(--r-lg); }
}
