/* ============================================================
   GAMES ON WEB — App CSS
   Game Portal Showcase Design
   ============================================================ */

/* ── Google Fonts already loaded via <link> ── */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #13141a;
    --bg2:         #1a1b24;
    --bg3:         #222430;
    --border:      #2e3044;
    --border2:     #3a3d55;
    --primary:     #10b981;
    --primary-d:   #059669;
    --sky:         #0ea5e9;
    --purple:      #a855f7;
    --amber:       #f59e0b;
    --rose:        #f43f5e;
    --text:        #e2e8f0;
    --text-muted:  #6b7280;
    --text-dim:    #4b5563;
    --radius-sm:   8px;
    --radius:      12px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --shadow:      0 4px 24px rgba(0,0,0,.5);
    --shadow-lg:   0 8px 48px rgba(0,0,0,.7);
    --transition:  0.2s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
.hidden { display: none !important; }

/* ── Container ── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ============================================================
   SITE HEADER
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(19,20,26,0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 20px rgba(0,0,0,.4);
}

.site-header__inner {
    display: flex;
    align-items: center;
    height: 60px;
    gap: 1.5rem;
}

/* Logo */
.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.site-logo__icon {
    font-size: 1.6rem;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(16,185,129,.6));
}
.site-logo__name {
    display: block;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: .06em;
}
.site-logo__tag {
    display: block;
    font-size: 0.62rem;
    color: var(--text-muted);
    letter-spacing: .04em;
}

/* Site nav */
.site-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.site-nav__link {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}
.site-nav__link:hover { color: #fff; background: var(--bg3); }

/* Auth */
.site-header__auth {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.avatar-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--sky));
    color: #000;
    font-size: 0.78rem;
    font-weight: 800;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
}
.btn--primary {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 16px rgba(16,185,129,.25);
}
.btn--primary:hover { background: var(--primary-d); box-shadow: 0 0 24px rgba(16,185,129,.4); }
.btn--ghost {
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text-muted);
}
.btn--ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn--admin {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
}
.btn--admin:hover { filter: brightness(1.15); }
.btn--sm { padding: 6px 14px; font-size: 0.78rem; }
.btn--full { width: 100%; justify-content: center; }

/* ============================================================
   CATEGORY BAR
   ============================================================ */
.cat-bar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 60px;
    z-index: 40;
    box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.cat-bar__inner {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.cat-bar__inner::-webkit-scrollbar { display: none; }

.cat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-muted);
    white-space: nowrap;
    transition: var(--transition);
    flex-shrink: 0;
}
.cat-btn:hover { background: var(--bg3); color: var(--text); }
.cat-btn--active { background: var(--primary); color: #000; }
.cat-btn__icon { font-size: 1rem; }

.cat-bar__search { margin-left: auto; flex-shrink: 0; }
.cat-bar__search input {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 7px 16px;
    color: var(--text);
    font-size: 0.82rem;
    width: 200px;
    outline: none;
    transition: var(--transition);
}
.cat-bar__search input::placeholder { color: var(--text-dim); }
.cat-bar__search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,185,129,.1); }

/* ============================================================
   SHOWCASE WRAPPER & SECTIONS
   ============================================================ */
.showcase-wrap { padding: 2rem 1.25rem; }

.showcase-section { margin-bottom: 2.5rem; }

.showcase-section__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--border);
}
.showcase-section__icon { font-size: 1.4rem; }
.showcase-section__title {
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: .1em;
    color: #fff;
}

/* ============================================================
   SHOWCASE GRID — image-based cards
   ============================================================ */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 900px)  { .showcase-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px)  { .showcase-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px)  { .showcase-grid { grid-template-columns: 1fr; } }

/* ── Individual showcase card ── */
.showcase-card {
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg2);
    border: 1px solid var(--border);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    cursor: pointer;
}
.showcase-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0,0,0,.6);
    border-color: var(--primary);
}
.showcase-card--disabled { pointer-events: none; opacity: 0.5; filter: grayscale(.6); }

/* Thumbnail area — 1:1 */
.showcase-card__thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--bg3);
}
.showcase-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}
.showcase-card:hover .showcase-card__thumb img { transform: scale(1.08); }

/* Fallback icon when no image */
.showcase-card__thumb-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    filter: drop-shadow(0 0 20px rgba(255,255,255,.2));
}

/* Play overlay on hover */
.showcase-card__play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.22s ease;
    backdrop-filter: blur(2px);
}
.showcase-card:hover .showcase-card__play-overlay { opacity: 1; }
.showcase-card__play-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #000;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(16,185,129,.6);
    transform: scale(0.8);
    transition: transform 0.22s ease;
}
.showcase-card:hover .showcase-card__play-btn { transform: scale(1); }

/* Badges overlay (top-left) */
.showcase-card__badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Category pill (bottom-right) */
.showcase-card__cat {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,.1);
}

/* Info row below thumb */
.showcase-card__info {
    padding: 8px 10px 10px;
}
.showcase-card__name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    transition: color var(--transition);
    text-align: center;
}
.showcase-card:hover .showcase-card__name { color: var(--primary); }

/* ── Score / badge variants ── */
.sc-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 20px;
    line-height: 1.6;
}
.sc-badge--popular      { background: #f59e0b; color: #000; }
.sc-badge--classic      { background: #3b82f6; color: #fff; }
.sc-badge--action       { background: #a855f7; color: #fff; }
.sc-badge--strategy     { background: #ef4444; color: #fff; }
.sc-badge--addictive    { background: #06b6d4; color: #000; }
.sc-badge--vs-ai---2p   { background: #f43f5e; color: #fff; }
.sc-badge--card-game    { background: #6366f1; color: #fff; }
.sc-badge--brain-teaser { background: #8b5cf6; color: #fff; }
.sc-badge--maintenance  { background: rgba(255,255,255,.15); color: #fbbf24; backdrop-filter: blur(4px); }

/* ============================================================
   STATS STRIP
   ============================================================ */
.stats-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 2rem;
    margin-top: 1rem;
}
.stats-strip__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.stats-strip__num {
    font-family: 'Nunito', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}
.stats-strip__lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
    margin-top: auto;
    background: #0d0e13;
    border-top: 1px solid var(--border);
    padding: 2rem 0 1.25rem;
}
.site-footer__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}
.site-footer__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}
.site-footer__brand {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    color: #fff;
    letter-spacing: .08em;
}
.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
}
.site-footer__links a {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    transition: color var(--transition);
}
.site-footer__links a:hover { color: var(--primary); }
.site-footer__copy {
    font-size: 0.72rem;
    color: var(--text-dim);
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}
.auth-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}
.auth-card__title {
    font-family: 'Nunito', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 0.25rem;
}
.auth-card__sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.75rem; }

/* Form */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.form-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,185,129,.12); }
.form-input::placeholder { color: var(--text-dim); }
.form-error { font-size: 0.75rem; color: #ef4444; margin-top: 4px; }
.form-footer { font-size: 0.82rem; color: var(--text-muted); margin-top: 1.25rem; text-align: center; }
.form-footer a { color: var(--primary); font-weight: 700; }

/* Checkbox */
.form-check { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.form-check input { accent-color: var(--primary); }

/* ============================================================
   GAME PAGE
   ============================================================ */
.game-page { padding: 1rem 0 2rem; }
.game-page__back { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); transition: color var(--transition); }
.game-page__back:hover { color: var(--primary); }

/* Game Toolbar */
.game-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.game-toolbar__btn {
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}
.game-toolbar__btn:hover, .game-toolbar__btn.active {
    background: var(--bg3);
    border-color: var(--primary);
    color: var(--primary);
}

/* Mobile Score Header (hidden on desktop) */
.game-mobile-score {
    display: none;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 16px;
    margin-bottom: 1rem;
    justify-content: space-around;
    align-items: center;
}
.game-mobile-score__item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.game-mobile-score__label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
}
.game-mobile-score__val {
    font-family: 'Nunito', sans-serif;
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--primary);
}
.game-mobile-score__val--best {
    color: var(--amber);
}

.game-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.5rem; align-items: start; }

.game-main-area { width: 100%; min-width: 0; }

.game-title-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.game-title-bar__icon { font-size: 1.8rem; line-height: 1; }
.game-title-bar__heading {
    font-family: 'Nunito', sans-serif;
    font-size: 1.3rem;
    font-weight: 900;
    color: #fff;
    line-height: 1.2;
}
.game-title-bar__meta {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
}

.game-viewport {
    background: #050508;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    max-height: 80vh;
    position: relative;
    box-shadow: var(--shadow);
    touch-action: none; /* prevent drag scroll on canvas touch */
    width: 100%;
}
#phaser-game, #game-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Fullscreen mode styling */
.game-viewport:fullscreen,
.game-viewport:-webkit-full-screen,
.game-viewport.game-viewport--fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    border: none !important;
    background: #000 !important;
}
body.body-fullscreen-active {
    overflow: hidden !important;
}

/* Description */
.game-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.85rem;
    line-height: 1.6;
}

/* Touch Controls Wrapper */
.touch-controls-wrap {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    user-select: none;
    -webkit-user-select: none;
}
.touch-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

/* Virtual D-Pad */
.virtual-dpad {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(3, 56px);
    gap: 6px;
    justify-content: center;
}
.mini-dpad {
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(3, 48px);
    gap: 4px;
}
.dpad-btn {
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 900;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.1s ease, transform 0.1s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.dpad-btn:active, .dpad-btn.active {
    background: var(--primary);
    color: #000;
    transform: scale(0.95);
}
.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

/* Touch controls row & Action buttons */
.touch-controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    flex-wrap: wrap;
}
.action-btn {
    background: linear-gradient(135deg, var(--bg3), var(--border));
    border: 1px solid var(--border2);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    touch-action: manipulation;
    transition: var(--transition);
}
.action-btn:active {
    transform: scale(0.95);
    background: var(--primary);
    color: #000;
}
.action-fire {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    box-shadow: 0 0 12px rgba(244,63,94,0.4);
}
.mode-toggle-btn {
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text-muted);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}
.mode-toggle-btn.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

/* Sidebar & Cards */
.game-sidebar { display: flex; flex-direction: column; gap: 1rem; }

.sidebar-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.sidebar-card__title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: .75rem;
}

.score-display { text-align: center; }
.score-display__current {
    font-family: 'Nunito', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.score-display__best-val {
    font-family: 'Nunito', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--amber);
    text-align: center;
}
.score-display__label { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

.controls-list { list-style: none; }
.controls-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}
.controls-list li:last-child { border-bottom: none; }
.key-badge {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-size: 0.72rem;
    color: var(--sky);
    flex-shrink: 0;
}

/* Mobile Breakpoint Adjustments (<768px) */
@media (max-width: 768px) {
    .container { padding: 0 0.75rem; }
    .game-page { padding: 0.5rem 0 1.5rem; }
    .game-layout { grid-template-columns: 1fr; gap: 1rem; }
    .game-mobile-score { display: flex; }
    .game-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .game-sidebar .score-display { display: none; } /* handled by mobile top score bar */
    .game-sidebar > a { grid-column: 1 / -1; }
    .game-viewport {
        min-height: 300px;
        max-height: 65vh;
        border-radius: var(--radius);
    }
}


/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard-page { padding: 2rem 0; }
.page-heading { margin-bottom: 1.5rem; }
.page-heading__title { font-family: 'Nunito', sans-serif; font-size: 1.8rem; font-weight: 900; color: #fff; }
.page-heading__sub { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }

.game-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 1.5rem; }
.game-tab {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text-muted);
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}
.game-tab:hover, .game-tab--active { background: var(--primary); color: #000; border-color: transparent; }

.lb-table-wrap {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
    font-weight: 800;
}
.lb-table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr:hover td { background: rgba(255,255,255,.02); }

.rank-num { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 1rem; }
.rank-gold   { color: var(--amber); }
.rank-silver { color: #9ca3af; }
.rank-bronze { color: #b45309; }

.player-cell { display: flex; align-items: center; gap: 8px; }
.flag { font-size: 1.2rem; }
.badge-guest {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 800;
    background: rgba(245,158,11,.1);
    color: var(--amber);
    border: 1px solid rgba(245,158,11,.25);
    border-radius: 20px;
    padding: 1px 6px;
    letter-spacing: .04em;
}
.badge-member {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 800;
    background: rgba(16,185,129,.1);
    color: var(--primary);
    border: 1px solid rgba(16,185,129,.25);
    border-radius: 20px;
    padding: 1px 6px;
}
.score-val { font-family: 'Nunito', sans-serif; font-weight: 800; color: var(--text); }
.date-val { font-size: 0.75rem; color: var(--text-dim); }

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-page { padding: 2rem 0; }
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--sky));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    color: #000;
    flex-shrink: 0;
}
.profile-name { font-family: 'Nunito', sans-serif; font-size: 1.4rem; font-weight: 900; color: #fff; }
.profile-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

.stats-grid-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.stat-card-sm {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}
.stat-card-sm__val { font-family: 'Nunito', sans-serif; font-size: 1.6rem; font-weight: 900; color: var(--primary); }
.stat-card-sm__lbl { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }

.section-heading { font-family: 'Nunito', sans-serif; font-size: 1.1rem; font-weight: 900; color: #fff; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }

.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.achievement-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.achievement-card--locked { opacity: .35; filter: grayscale(1); }
.achievement-card__icon { font-size: 1.8rem; flex-shrink: 0; }
.achievement-card__title { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.achievement-card__desc { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.achievement-card__date { font-size: 0.68rem; color: var(--primary); margin-top: 4px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.8);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-backdrop.active { display: flex; }
.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    animation: fadeInScale .25s ease;
}
.modal__icon { font-size: 2.5rem; margin-bottom: .75rem; }
.modal__title { font-family: 'Nunito', sans-serif; font-size: 1.4rem; font-weight: 900; color: #fff; margin-bottom: .25rem; }
.modal__desc { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.modal__actions { display: flex; gap: .75rem; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(17,17,28,.95);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 12px 16px;
    min-width: 280px;
    max-width: 340px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight .3s ease;
    pointer-events: all;
}
.toast--achievement { border-color: rgba(245,158,11,.5); }
.toast--success     { border-color: rgba(16,185,129,.5); }
.toast__icon        { font-size: 1.5rem; flex-shrink: 0; }
.toast__title       { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.toast__desc        { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn       { from { opacity: 0 } to { opacity: 1 } }
@keyframes fadeInUp     { from { opacity: 0; transform: translateY(16px) } to { opacity: 1; transform: translateY(0) } }
@keyframes fadeInScale  { from { opacity: 0; transform: scale(.92) } to { opacity: 1; transform: scale(1) } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(60px) } to { opacity: 1; transform: translateX(0) } }

.animate-fade-up { animation: fadeInUp .4s ease both; }
