:root {
    --bg: #0B1020;
    --bg-2: #131B30;
    --bg-card: rgba(19, 27, 48, 0.78);
    --purple: #8B5CF6;
    --purple-dark: #6D28D9;
    --gold: #F5C76B;
    --red: #EF4444;
    --green: #22C55E;
    --yellow: #FACC15;
    --blue: #3B82F6;
    --text: #F8FAFC;
    --muted: #94A3B8;
    --border: rgba(255, 255, 255, 0.09);
    --radius: 16px;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

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

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body {
    background-image:
        radial-gradient(circle at 15% 10%, rgba(139, 92, 246, 0.16), transparent 40%),
        radial-gradient(circle at 85% 25%, rgba(245, 199, 107, 0.09), transparent 35%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

main { flex: 1; }

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 16, 32, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.brand img { width: 36px; height: 36px; }
.brand span { background: linear-gradient(135deg, #fff, var(--gold)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 22px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.nav-toggle {
    display: none;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
}

@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; align-items: center; }
    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-2);
        border-bottom: 1px solid var(--border);
        padding: 18px 20px;
        gap: 14px;
        align-items: flex-start;
    }
    .nav-links.open { display: flex; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), #EAB308);
    color: #0B1020;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
    color: var(--text);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.4);
    color: #FCA5A5;
}

.btn-sm { padding: 7px 14px; font-size: 0.85rem; border-radius: 9px; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }

/* Cards & Glassmorphism */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }

@media (max-width: 960px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Hero */
.hero {
    padding: 64px 0 48px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: center;
}

@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; text-align: center; }
    .hero-actions { justify-content: center; }
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #DDD6FE;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 18px;
}

.hero h1 {
    font-size: clamp(2.1rem, 4.6vw, 3.5rem);
    line-height: 1.12;
    margin: 0 0 18px;
    letter-spacing: -0.03em;
}

.hero h1 .accent {
    background: linear-gradient(135deg, var(--gold), #FDE68A);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--muted);
    font-size: 1.1rem;
    margin: 0 0 28px;
    max-width: 560px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.hero-board-wrap {
    position: relative;
    padding: 16px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.2), rgba(19, 27, 48, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}

/* Sections */
.section { padding: 56px 0; }
.section-header { text-align: center; max-width: 680px; margin: 0 auto 38px; }
.section-header h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); margin: 0 0 10px; }
.section-header p { color: var(--muted); margin: 0; }

.mode-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.mode-card:hover { transform: translateY(-4px); border-color: rgba(139, 92, 246, 0.5); }

.mode-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.94rem;
}
th { color: var(--muted); font-weight: 600; font-size: 0.84rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.88rem; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0B1020;
    color: var(--text);
    font-size: 0.95rem;
}
.form-control:focus { outline: none; border-color: var(--purple); }

/* Alerts */
.alert {
    padding: 13px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 0.93rem;
}
.alert-error { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.4); color: #FCA5A5; }
.alert-success { background: rgba(34, 197, 94, 0.14); border: 1px solid rgba(34, 197, 94, 0.4); color: #86EFAC; }

/* FAQ */
.faq-list { display: grid; gap: 12px; max-width: 820px; margin: 0 auto; }
.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.faq-q {
    width: 100%;
    background: none;
    border: none;
    color: var(--text);
    padding: 18px 20px;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.faq-a {
    display: none;
    padding: 0 20px 18px;
    color: var(--muted);
    font-size: 0.95rem;
}
.faq-item.open .faq-a { display: block; }

/* Game Arena Layout */
.arena-layout {
    display: grid;
    grid-template-columns: minmax(0, 620px) 340px;
    gap: 24px;
    align-items: start;
    justify-content: center;
    padding: 24px 0 48px;
}

@media (max-width: 980px) {
    .arena-layout { grid-template-columns: 1fr; }
}

.board-shell {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 12px;
    box-shadow: var(--shadow);
}

.ludo-svg {
    width: 100%;
    height: auto;
    border-radius: 12px;
    user-select: none;
    touch-action: manipulation;
}

.token-pulse {
    animation: tokenPulse 1s infinite ease-in-out;
    cursor: pointer;
}

@keyframes tokenPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.14); opacity: 0.88; }
}

/* Dice */
.dice-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(11, 16, 32, 0.75);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.dice-face {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: linear-gradient(145deg, #ffffff, #e2e8f0);
    color: #0B1020;
    display: grid;
    place-items: center;
    font-size: 1.7rem;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.dice-face.rolling {
    animation: diceSpin 0.35s linear infinite;
}

@keyframes diceSpin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.08); }
    100% { transform: rotate(360deg) scale(1); }
}

.player-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(11, 16, 32, 0.65);
    border: 1px solid var(--border);
    margin-bottom: 8px;
}
.player-pill.active-turn {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(245, 199, 107, 0.4);
}

.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-red { background: var(--red); }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-blue { background: var(--blue); }

/* AdSense Container */
.ad-slot-container {
    margin: 18px auto;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    background: rgba(11, 16, 32, 0.95);
    padding: 40px 0 28px;
    margin-top: 40px;
}

.footer-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    color: var(--muted);
    font-size: 0.92rem;
}
.footer-links a:hover { color: var(--text); }

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    display: none;
    place-items: center;
    z-index: 200;
    padding: 20px;
}
.modal-backdrop.open { display: grid; }
.modal-card {
    max-width: 440px;
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--gold);
    border-radius: 20px;
    padding: 28px;
    text-align: center;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-green { background: rgba(34,197,94,0.16); color: #86EFAC; }
.badge-red { background: rgba(239,68,68,0.16); color: #FCA5A5; }
.badge-gold { background: rgba(245,199,107,0.16); color: var(--gold); }
.badge-purple { background: rgba(139,92,246,0.18); color: #DDD6FE; }
