
:root {
    --primary: #6750e8;
    --primary-dark: #513bc9;
    --primary-light: #eeeaff;
    --text: #25233a;
    --muted: #858397;
    --background: #faf9ff;
    --surface: #ffffff;
    --border: #eeedf4;
    --green: #28a879;
    --orange: #f3a342;
    --blue: #4698db;
    --radius: 20px;
    --shadow: 0 12px 35px rgba(48, 37, 100, 0.07);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: "Vazirmatn", sans-serif;
    line-height: 1.7;
    direction: rtl;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    width: min(1180px, calc(100% - 40px));
    margin: auto;
}

.topbar {
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 800;
    white-space: nowrap;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: white;
    background: var(--primary);
    font-size: 22px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 34px;
    color: var(--muted);
    font-size: 14px;
}

.main-nav a {
    transition: color .2s;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary);
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.streak-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 13px;
    border-radius: 30px;
    background: #fff3e5;
    color: #c67b21;
    font-weight: 700;
}

.button {
    border: 0;
    border-radius: 12px;
    padding: 11px 20px;
    font-weight: 700;
    font-size: 14px;
    transition: transform .2s, background .2s, box-shadow .2s;
}

.button:hover:not(:disabled) {
    transform: translateY(-2px);
}

.button-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 6px 15px rgba(103, 80, 232, .18);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-outline {
    color: var(--primary);
    background: transparent;
    border: 1px solid #dcd5ff;
}

.button-muted {
    color: #aaa7b7;
    background: #f0eff4;
    cursor: not-allowed;
}

.button-full {
    width: 100%;
}

.menu-toggle {
    display: none;
    border: 0;
    background: transparent;
    font-size: 25px;
}

.hero {
    min-height: 440px;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    align-items: center;
    gap: 50px;
    padding: 65px 20px;
}

.eyebrow {
    display: inline-block;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 12px;
}

.hero h1 {
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.45;
    letter-spacing: -1px;
    margin: 0 0 17px;
}

.hero h1 span {
    color: var(--primary);
}

.hero-copy > p {
    max-width: 510px;
    color: var(--muted);
    font-size: 16px;
    margin-bottom: 28px;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 25px;
}

.text-link {
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
}

.text-link:hover {
    text-decoration: underline;
}

.hero-trust {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 32px;
    color: var(--muted);
    font-size: 12px;
}

.avatar-stack {
    display: flex;
    direction: ltr;
}

.avatar-stack span {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    margin-left: -7px;
    border: 2px solid white;
    border-radius: 50%;
    background: #e7ddff;
    color: var(--primary);
    font-weight: 800;
}

.avatar-stack span:nth-child(2) {
    background: #ffe4d5;
}

.avatar-stack span:nth-child(3) {
    background: #d8f3e7;
}

.hero-art {
    min-height: 330px;
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 35px;
    background: linear-gradient(140deg, #eeeaff, #f8edff 60%, #fff4e9);
}

.orbit {
    position: absolute;
    border: 1px dashed rgba(103, 80, 232, .25);
    border-radius: 50%;
}

.orbit-one {
    width: 260px;
    height: 260px;
}

.orbit-two {
    width: 350px;
    height: 350px;
}

.mascot {
    z-index: 1;
    width: 160px;
    height: 160px;
    display: grid;
    place-items: center;
    border-radius: 48% 52% 43% 57%;
    background: var(--primary);
    color: white;
    font-size: 35px;
    font-weight: 800;
    transform: rotate(-7deg);
    box-shadow: 0 20px 35px rgba(103, 80, 232, .3);
}

.language-card {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 17px;
    border-radius: 15px;
    background: white;
    box-shadow: var(--shadow);
}

.card-italian {
    top: 45px;
    right: 12px;
}

.flag {
    font-size: 28px;
}

.language-card strong,
.language-card small {
    display: block;
}

.language-card strong {
    font-size: 14px;
    direction: ltr;
}

.language-card small {
    color: var(--muted);
    font-size: 11px;
}

.sound-icon {
    color: var(--primary);
    font-size: 22px;
}

.floating-note {
    position: absolute;
    z-index: 2;
    padding: 10px 15px;
    border-radius: 12px;
    background: white;
    box-shadow: var(--shadow);
    font-size: 12px;
    font-weight: 700;
}

.note-top {
    left: 18px;
    top: 70px;
    color: #d18a28;
}

.note-bottom {
    bottom: 40px;
    right: 30px;
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 10px 0 75px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 21px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 5px 20px rgba(48, 37, 100, .025);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    font-size: 23px;
}

.stat-icon.purple {
    background: #eeeaff;
}

.stat-icon.orange {
    background: #fff1df;
}

.stat-icon.green {
    background: #e3f7ef;
}

.stat-icon.blue {
    background: #e5f2ff;
}

.stat-card strong,
.stat-card div span {
    display: block;
}

.stat-card strong {
    font-size: 22px;
    line-height: 1.4;
}

.stat-card div span {
    color: var(--muted);
    font-size: 12px;
}

.content-section {
    margin-bottom: 85px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.section-heading .eyebrow {
    margin-bottom: 3px;
}

.section-heading h2 {
    margin: 0;
    font-size: 28px;
}

.section-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 17px;
}

.level-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    transition: transform .2s, box-shadow .2s;
}

.level-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.level-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.level-tag {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.level-symbol {
    font-size: 27px;
}

.level-a1 .level-tag {
    background: #e5f7ed;
    color: #23956b;
}

.level-a2 .level-tag {
    background: #e7f2ff;
    color: #448dd0;
}

.level-b1 .level-tag {
    background: #fff0df;
    color: #ce8836;
}

.level-b2 .level-tag {
    background: #f0eaff;
    color: #7754d9;
}

.level-card h3 {
    margin: 13px 0 5px;
    font-size: 22px;
}

.level-card p {
    min-height: 75px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin: 18px 0 8px;
    color: var(--muted);
    font-size: 11px;
}

.progress-label strong {
    color: var(--text);
}

.progress-track {
    height: 7px;
    margin-bottom: 19px;
    overflow: hidden;
    border-radius: 10px;
    background: #efedf5;
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.game-section {
    padding: 35px;
    border-radius: 28px;
    background: #f1eeff;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
    background: white;
    box-shadow: 0 5px 15px rgba(48, 37, 100, .03);
}

.game-emoji {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    font-size: 25px;
}

.game-purple {
    background: #eeeaff;
}

.game-orange {
    background: #fff0df;
}

.game-green {
    background: #e4f6ed;
}

.game-info {
    flex: 1;
}

.game-info h3 {
    margin: 0;
    font-size: 14px;
}

.game-info p {
    margin: 3px 0;
    color: var(--muted);
    font-size: 11px;
}

.game-meta {
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
}

.round-arrow {
    flex-shrink: 0;
    width: 35px;
    height: 35px;
    border: 0;
    border-radius: 50%;
    color: var(--primary);
    background: var(--primary-light);
    font-size: 19px;
    transition: .2s;
}

.round-arrow:hover {
    color: white;
    background: var(--primary);
}

.period-tabs {
    display: flex;
    gap: 5px;
    padding: 5px;
    border-radius: 12px;
    background: #f0eef7;
}

.period-tab {
    padding: 8px 15px;
    border: 0;
    border-radius: 9px;
    color: var(--muted);
    background: transparent;
    font-size: 12px;
}

.period-tab.active {
    color: var(--primary);
    background: white;
    font-weight: 800;
    box-shadow: 0 2px 7px rgba(48, 37, 100, .07);
}

.leaderboard-placeholder {
    min-height: 210px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
}

.leaderboard-empty {
    text-align: center;
}

.leaderboard-empty > span {
    display: block;
    font-size: 40px;
}

.leaderboard-empty strong {
    display: block;
    margin-top: 8px;
}

.leaderboard-empty p {
    margin: 5px 0;
    color: var(--muted);
    font-size: 12px;
}

.privacy-note {
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 25px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}

.footer .brand {
    color: var(--text);
    font-size: 15px;
}

.footer .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 17px;
}

.auth-dialog {
    width: min(430px, calc(100% - 30px));
    padding: 30px;
    border: 0;
    border-radius: 24px;
    color: var(--text);
    box-shadow: 0 20px 80px rgba(30, 20, 70, .2);
}

.auth-dialog::backdrop {
    background: rgba(25, 20, 50, .55);
    backdrop-filter: blur(4px);
}

.dialog-close-form {
    display: flex;
    justify-content: flex-start;
}

.dialog-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f1eff7;
    color: var(--muted);
    font-size: 23px;
}

.auth-heading {
    text-align: center;
}

.auth-heading .brand-mark {
    margin: 0 auto 12px;
}

.auth-heading h2 {
    margin: 0;
    font-size: 21px;
}

.auth-heading p {
    color: var(--muted);
    font-size: 12px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin: 25px 0;
    padding: 5px;
    border-radius: 12px;
    background: #f2f0f8;
}

.auth-tab {
    padding: 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}

.auth-tab.active {
    color: var(--primary);
    background: white;
}

#auth-form {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

#auth-form label {
    margin-top: 7px;
    font-size: 12px;
    font-weight: 700;
}

#auth-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    direction: ltr;
    text-align: left;
}

#auth-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(103, 80, 232, .1);
}

.form-message {
    min-height: 18px;
    margin: 0;
    color: #d64c4c;
    font-size: 11px;
}

.auth-disclaimer {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 10px;
    text-align: center;
}

.toast {
    position: fixed;
    z-index: 100;
    right: 50%;
    bottom: 25px;
    transform: translate(50%, 20px);
    padding: 12px 22px;
    border-radius: 12px;
    color: white;
    background: #29243f;
    opacity: 0;
    pointer-events: none;
    transition: .25s;
    box-shadow: var(--shadow);
}

.toast.show {
    opacity: 1;
    transform: translate(50%, 0);
}

/* Responsive layout */

@media (max-width: 950px) {
    .level-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .game-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        gap: 25px;
    }
}

@media (max-width: 700px) {
    .app-shell {
        width: min(100% - 28px, 550px);
    }

    .topbar {
        height: 72px;
    }

    .main-nav {
        display: none;
        position: absolute;
        z-index: 10;
        top: 72px;
        right: 14px;
        left: 14px;
        padding: 18px;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        border: 1px solid var(--border);
        border-radius: 15px;
        background: white;
        box-shadow: var(--shadow);
    }

    .main-nav.open {
        display: flex;
    }

    .menu-toggle {
        display: block;
    }

    .topbar-actions {
        gap: 8px;
    }

    .topbar-actions .button {
        padding: 8px 10px;
        font-size: 11px;
    }

    .streak-pill {
        padding: 7px 9px;
    }

    .hero {
        grid-template-columns: 1fr;
        padding: 45px 5px;
        gap: 30px;
    }

    .hero h1 {
        font-size: 35px;
    }

    .hero-art {
        min-height: 290px;
    }

    .stats-grid {
        gap: 10px;
        margin-bottom: 55px;
    }

    .stat-card {
        padding: 13px;
        gap: 10px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 19px;
    }

    .stat-card strong {
        font-size: 18px;
    }

    .stat-card div span {
        font-size: 10px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-heading h2 {
        font-size: 24px;
    }

    .level-grid {
        gap: 10px;
    }

    .level-card {
        padding: 15px;
    }

    .level-card h3 {
        font-size: 19px;
    }

    .level-card p {
        min-height: 95px;
        font-size: 11px;
    }

    .game-section {
        padding: 22px 15px;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 380px) {
    .brand {
        font-size: 15px;
    }

    .topbar-actions .button {
        font-size: 10px;
    }

    .hero h1 {
        font-size: 29px;
    }

    .level-grid {
        grid-template-columns: 1fr;
    }

    .level-card p {
        min-height: auto;
    }
}
