/* ============================================================
   Mobile Swipe Arcade – Standard Portal Theme (Redesign)
   Color Scheme: Purple / Violet
   ============================================================ */

:root {
    --msa-purple:       #7c3aed;
    --msa-purple-light: #8b5cf6;
    --msa-purple-glow:  rgba(124, 58, 237, 0.2);
    --msa-pink:         #ec4899;
    --msa-bg:           #f5f3ff;
    --msa-surface:      #ffffff;
    --msa-card:         #ffffff;
    --msa-border:       #e5e7eb;
    --msa-text:         #1e1b4b;
    --msa-muted:        #6b7280;
    --msa-header-h:     130px;
    --msa-radius:       14px;
    --msa-shadow:       0 2px 12px rgba(124,58,237,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.msa-body {
    font-family: 'Inter', 'Nunito', sans-serif;
    background: var(--msa-bg);
    color: var(--msa-text);
    min-height: 100vh;
    padding-top: var(--msa-header-h);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Header ──────────────────────────────────────────── */
.msa-header {
    position: fixed;
    top: 0; left: 0; width: 100%;
    z-index: 1000;
    background: var(--msa-surface);
    border-bottom: 1px solid var(--msa-border);
    box-shadow: 0 2px 16px rgba(124,58,237,.06);
    display: flex;
    flex-direction: column;
}

.msa-header-top {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: 68px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 10;
}

.msa-logo {
    display: flex; align-items: center; gap: 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 1.5rem; font-weight: 900;
    color: var(--msa-purple); white-space: nowrap;
}
.msa-logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--msa-purple), var(--msa-pink));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1rem;
    box-shadow: 0 4px 10px var(--msa-purple-glow);
}

.msa-search {
    flex: 1; max-width: 480px;
    display: flex; align-items: center; gap: 10px;
    background: var(--msa-bg);
    border: 2px solid var(--msa-border);
    border-radius: 50px; padding: 0 16px;
    transition: border-color .2s, background .2s;
}
.msa-search:focus-within { border-color: var(--msa-purple); background: #fff; }
.msa-search i { color: var(--msa-muted); font-size: .9rem; }
.msa-search input {
    flex: 1; border: none; background: transparent;
    font-family: inherit; font-size: .9rem; color: var(--msa-text);
    padding: 10px 0; outline: none;
}
.msa-search input::placeholder { color: var(--msa-muted); }

.msa-user-area { margin-left: auto; display: flex; align-items: center; }

.msa-btn-login {
    padding: 8px 18px; background: var(--msa-purple); color: #fff;
    border-radius: 50px; font-weight: 700; font-size: .85rem;
    transition: opacity .2s;
}
.msa-btn-login:hover { opacity: .88; }

.msa-xp-pill {
    display: flex; align-items: center; gap: 4px;
    background: rgba(124,58,237,.1); color: var(--msa-purple);
    padding: 5px 12px; border-radius: 50px;
    font-size: .82rem; font-weight: 800; font-family: 'Nunito', sans-serif;
}

.msa-bell-btn {
    position: relative; background: none; border: none;
    cursor: pointer; color: var(--msa-text);
    padding: 8px; border-radius: 8px;
    transition: background .2s;
    display: flex; align-items: center;
}
.msa-bell-btn:hover { background: var(--msa-bg); }
.msa-bell-count {
    position: absolute; top: 2px; right: 2px;
    background: #ef4444; color: #fff;
    border-radius: 50%; width: 16px; height: 16px;
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

.msa-avatar-wrap { display: block; }
.msa-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; border: 2px solid var(--msa-purple);
}

.msa-logout-btn {
    background: none; border: none; cursor: pointer;
    color: var(--msa-muted); padding: 6px; border-radius: 6px;
    font-size: .95rem; transition: color .2s;
}
.msa-logout-btn:hover { color: var(--msa-text); }

/* Nav Pills Row */
.msa-nav {
    border-top: 1px solid var(--msa-border);
    background: #fff; overflow-x: auto; scrollbar-width: none;
}
.msa-nav::-webkit-scrollbar { display: none; }
.msa-nav-inner {
    display: flex; gap: 6px; padding: 8px 24px;
    max-width: 1400px; margin: 0 auto; width: max-content;
}
.msa-pill {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 16px; border-radius: 50px;
    font-size: .88rem; font-weight: 700; color: var(--msa-muted);
    white-space: nowrap; transition: background .15s, color .15s;
}
.msa-pill:hover { background: rgba(124,58,237,.1); color: var(--msa-purple); }
.msa-pill.active { background: var(--msa-purple); color: #fff; }

/* ── Notification Dropdown ───────────────────────────── */
#notifDropdown {
    position: fixed;
    top: 136px; right: 16px;
    z-index: 99999;
    width: 320px;
    background: #fff;
    border: 1px solid var(--msa-border);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.15);
    overflow: hidden;
}
.msa-notif-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--msa-border);
}
.msa-notif-header span { font-size: 14px; font-weight: 700; font-family: 'Nunito', sans-serif; color: var(--msa-text); }
.msa-notif-header button { font-size: 12px; background: none; border: none; cursor: pointer; color: var(--msa-purple); font-weight: 600; }
.msa-notif-list { max-height: 320px; overflow-y: auto; }
.msa-notif-empty { padding: 24px; text-align: center; color: var(--msa-muted); font-size: 14px; }

/* ── Main ────────────────────────────────────────────── */
.msa-main {
    max-width: 1400px; margin: 0 auto;
    padding: 28px 24px 48px;
    min-height: calc(100vh - var(--msa-header-h));
}

/* ── Hero ────────────────────────────────────────────── */
.msa-hero {
    border-radius: 20px; overflow: hidden; margin-bottom: 36px;
    min-height: 260px;
    background: linear-gradient(135deg, var(--msa-purple), var(--msa-pink));
    background-size: cover; background-position: center;
    position: relative; display: flex; align-items: flex-end;
}
.msa-hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.7) 0%, rgba(0,0,0,.1) 60%);
}
.msa-hero-content { position: relative; z-index: 1; padding: 28px 32px; color: #fff; }
.msa-hero-badge {
    display: inline-block; background: rgba(255,255,255,.2);
    backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.3);
    padding: 3px 12px; border-radius: 20px;
    font-size: .75rem; font-weight: 700; letter-spacing: .5px; margin-bottom: 10px;
}
.msa-hero-title {
    font-family: 'Nunito', sans-serif; font-size: 1.8rem; font-weight: 900;
    margin: 0 0 8px; text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.msa-hero-desc { font-size: .9rem; opacity: .85; margin: 0 0 16px; max-width: 480px; }
.msa-hero-btn {
    display: inline-block; background: #fff; color: var(--msa-purple);
    padding: 10px 24px; border-radius: 50px;
    font-weight: 800; font-size: .95rem;
    box-shadow: 0 4px 15px rgba(0,0,0,.2); transition: transform .2s;
}
.msa-hero-btn:hover { transform: scale(1.05); }

/* ── Sections ────────────────────────────────────────── */
.msa-section { margin-bottom: 40px; }
.msa-section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px;
}
.msa-section-head h2 {
    font-family: 'Nunito', sans-serif; font-size: 1.15rem; font-weight: 900;
    color: var(--msa-text); display: flex; align-items: center; gap: 8px;
}
.msa-section-head h2 i { color: var(--msa-purple); }
.msa-view-all { font-size: .82rem; font-weight: 700; color: var(--msa-purple); }
.msa-view-all:hover { text-decoration: underline; }

/* Game Grid */
.msa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}
@media (max-width: 600px) {
    .msa-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
}

/* Scroll Row */
.msa-scroll-row {
    display: flex; gap: 14px;
    overflow-x: auto; padding-bottom: 8px;
    scroll-snap-type: x mandatory; scrollbar-width: none;
}
.msa-scroll-row::-webkit-scrollbar { display: none; }
.msa-scroll-row .msa-card { flex: 0 0 160px; scroll-snap-align: start; }

/* Game Card */
.msa-card {
    background: var(--msa-card); border-radius: var(--msa-radius);
    overflow: hidden; box-shadow: var(--msa-shadow);
    transition: transform .2s, box-shadow .2s;
    text-decoration: none; display: block; color: var(--msa-text);
}
.msa-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px var(--msa-purple-glow); }
.msa-card-thumb { position: relative; aspect-ratio: 4/3; background: #f0eeff; overflow: hidden; }
.msa-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.msa-card:hover .msa-card-thumb img { transform: scale(1.05); }
.msa-card-thumb-fallback {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; background: #f0eeff;
}
.msa-card-body { padding: 10px 12px 12px; }
.msa-card-title {
    font-family: 'Nunito', sans-serif; font-size: .85rem; font-weight: 800;
    color: var(--msa-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msa-card-cat { font-size: .72rem; color: var(--msa-muted); margin-top: 3px; }

.msa-badge {
    position: absolute; top: 7px; left: 7px;
    padding: 2px 8px; border-radius: 10px;
    font-size: .65rem; font-weight: 800; z-index: 1; letter-spacing: .3px;
}
.msa-badge-new { background: var(--msa-purple); color: #fff; }
.msa-badge-hot { background: #ef4444; color: #fff; }

/* ── Footer ──────────────────────────────────────────── */
.msa-footer { background: var(--msa-text); color: rgba(255,255,255,.8); margin-top: 48px; }
.msa-footer-grid {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px;
    max-width: 1400px; margin: 0 auto; padding: 48px 24px 32px;
}
.msa-footer-brand h3 {
    font-family: 'Nunito', sans-serif; font-size: 1.2rem; font-weight: 900;
    color: #fff; margin-bottom: 8px;
}
.msa-footer-brand p { font-size: .85rem; color: rgba(255,255,255,.55); line-height: 1.6; }
.msa-footer-col h4 {
    font-size: .78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: #fff; margin-bottom: 14px;
}
.msa-footer-col a { display: block; color: rgba(255,255,255,.55); font-size: .85rem; margin-bottom: 8px; transition: color .2s; }
.msa-footer-col a:hover { color: #fff; }
.msa-footer-bottom {
    border-top: 1px solid rgba(255,255,255,.08); text-align: center;
    padding: 20px 24px; font-size: .82rem; color: rgba(255,255,255,.35);
}
@media (max-width: 768px) { .msa-footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .msa-footer-grid { grid-template-columns: 1fr; } }

/* ── Toast ───────────────────────────────────────────── */
.msa-toast-container {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 99998; display: flex; flex-direction: column; gap: 10px;
}
.toast { padding: 12px 20px; border-radius: 10px; color: #fff; font-size: .88rem; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.2); animation: msaToastIn .3s ease; }
.toast-success { background: #10b981; }
.toast-error   { background: #ef4444; }
.toast-info    { background: var(--msa-purple); }
@keyframes msaToastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ── Legacy Class Compatibility (old templates) ─────── */
.swipe-section { margin-bottom: 40px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-title { font-family: 'Nunito', sans-serif; font-size: 1.15rem; font-weight: 900; color: var(--msa-text); display: flex; align-items: center; gap: 8px; }
.section-link { font-size: .82rem; font-weight: 700; color: var(--msa-purple); }
.section-link:hover { text-decoration: underline; }

.swipe-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.swipe-row::-webkit-scrollbar { display: none; }

.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
@media (max-width: 600px) { .games-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; } }

.game-card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--msa-shadow); transition: transform .2s, box-shadow .2s; text-decoration: none; display: block; color: var(--msa-text); flex: 0 0 160px; scroll-snap-align: start; }
.game-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px var(--msa-purple-glow); }
.game-card-thumb { position: relative; aspect-ratio: 4/3; background: #f0eeff; overflow: hidden; }
.game-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.game-card:hover .game-card-thumb img { transform: scale(1.05); }
.game-card-info { padding: 8px 10px 10px; }
.game-card-title { font-family: 'Nunito', sans-serif; font-size: .85rem; font-weight: 800; color: var(--msa-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card-meta { font-size: .72rem; color: var(--msa-muted); margin-top: 3px; }
.game-badge { position: absolute; top: 7px; left: 7px; padding: 2px 8px; border-radius: 10px; font-size: .65rem; font-weight: 800; z-index: 1; }
.game-badge-featured { background: var(--msa-purple); color: #fff; }
.game-badge-new { background: #10b981; color: #fff; }
.game-badge-hot { background: #ef4444; color: #fff; }

.featured-swiper { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.featured-swiper::-webkit-scrollbar { display: none; }
.featured-slide { flex: 0 0 85%; max-width: 340px; border-radius: 16px; overflow: hidden; position: relative; aspect-ratio: 16/9; scroll-snap-align: start; display: block; }
.featured-slide img { width: 100%; height: 100%; object-fit: cover; }
.featured-slide-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.7), transparent); display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; }
.featured-slide-title { font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 800; color: #fff; }
.featured-slide-play { font-size: .8rem; color: rgba(255,255,255,.8); margin-top: 4px; }

.category-chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 12px; scrollbar-width: none; margin-bottom: 20px; }
.category-chips::-webkit-scrollbar { display: none; }
.chip { padding: 7px 16px; border-radius: 50px; font-size: .85rem; font-weight: 700; color: var(--msa-muted); background: #fff; border: 1px solid var(--msa-border); white-space: nowrap; transition: background .15s, color .15s; }
.chip:hover, .chip.active { background: var(--msa-purple); color: #fff; border-color: var(--msa-purple); }

.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pagination a { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: #fff; border: 1px solid var(--msa-border); font-weight: 700; font-size: .88rem; color: var(--msa-text); transition: background .15s; }
.pagination a.active, .pagination a:hover { background: var(--msa-purple); color: #fff; border-color: var(--msa-purple); }

.ad-block { margin: 16px 0; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .msa-search { max-width: 200px; }
    .msa-header-top { padding: 0 16px; }
    .msa-main { padding: 20px 16px 40px; }
    .msa-nav-inner { padding: 8px 16px; }
}
@media (max-width: 480px) {
    .msa-search { display: none; }
    .msa-header-top { height: 56px; padding: 0 12px; }
    :root { --msa-header-h: 108px; }
}
