/* ==========================================================
   BilimG'alaba — asosiy uslub fayli
   ========================================================== */

:root {
    --navy: #0d1642;
    --navy-light: #16205a;
    --purple-1: #6d3ff5;
    --purple-2: #4c1fb8;
    --purple-text: #5b3df0;
    --gold: #f5b400;
    --orange: #f97316;
    --green: #22c55e;
    --blue: #3b82f6;
    --teal: #14b8a6;
    --pink: #ec4899;
    --yellow: #eab308;
    --gray: #64748b;
    --bg: #f4f5fb;
    --card-bg: #ffffff;
    --text-dark: #1a1f36;
    --text-mid: #667085;
    --radius-lg: 20px;
    --radius-md: 14px;
    --shadow: 0 2px 10px rgba(20, 20, 60, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', 'Nunito', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-dark);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Layout shell ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--navy);
    color: #cdd3ee;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px;
}
.sidebar-logo .logo-icon { font-size: 28px; }
.logo-title { color: #fff; font-weight: 800; font-size: 17px; }
.logo-sub { font-size: 11px; color: #8f97c9; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; border-radius: 10px;
    font-size: 14.5px; font-weight: 600; color: #b8bee3;
    transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-item.active { background: var(--purple-1); color: #fff; }
.nav-icon { width: 20px; text-align: center; }

.sidebar-cta {
    margin-top: auto;
    background: var(--navy-light);
    border-radius: var(--radius-md);
    padding: 18px 14px;
    text-align: center;
}
.sidebar-cta-emoji { font-size: 30px; margin-bottom: 8px; }
.sidebar-cta p { font-size: 12.5px; color: #b8bee3; line-height: 1.4; margin: 0; }

.main-content { flex: 1; min-width: 0; padding: 22px 28px 60px; }

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 22px;
}
.topbar-search {
    flex: 1; max-width: 420px; display: flex; align-items: center; gap: 10px;
    background: #fff; border-radius: 12px; padding: 11px 16px; box-shadow: var(--shadow);
}
.topbar-search input { border: none; outline: none; flex: 1; font-size: 14px; background: transparent; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.streak-pill, .bell-pill, .user-pill {
    background: #fff; border-radius: 12px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 8px; padding: 8px 14px;
}
.streak-pill div { display: flex; flex-direction: column; line-height: 1.15; }
.streak-pill strong { font-size: 14px; }
.streak-pill span { font-size: 10.5px; color: var(--text-mid); }
.bell-pill { font-size: 16px; padding: 10px 13px; }
.user-pill { display: flex; }
.user-pill .user-avatar { font-size: 22px; }
.user-pill div { display: flex; flex-direction: column; line-height: 1.2; }
.user-pill strong { font-size: 13.5px; }
.user-pill span { font-size: 11px; color: var(--text-mid); }

/* ---------- Grid layout ---------- */
.content-grid { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.content-single { max-width: 980px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---------- Hero banner ---------- */
.hero-banner {
    background: linear-gradient(120deg, var(--purple-1), var(--purple-2));
    border-radius: var(--radius-lg);
    padding: 34px 36px;
    color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    position: relative; overflow: hidden; margin-bottom: 22px;
}
.hero-text h1 { font-size: 26px; margin: 0 0 8px; line-height: 1.25; }
.hero-text p { margin: 0 0 18px; opacity: .9; font-size: 14.5px; }
.hero-actions { display: flex; gap: 12px; }
.hero-trophy { font-size: 90px; filter: drop-shadow(0 8px 12px rgba(0,0,0,.25)); }

.btn-white, .btn-outline-white {
    padding: 12px 18px; border-radius: 10px; font-weight: 700; font-size: 12.5px; letter-spacing: .3px;
}
.btn-white { background: #fff; color: var(--purple-2); }
.btn-outline-white { border: 1.5px solid rgba(255,255,255,.7); color: #fff; }

/* ---------- Panels ---------- */
.panel { background: var(--card-bg); border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-header h2, .panel h2 { font-size: 16.5px; margin: 0; }
.panel-link { font-size: 12.5px; font-weight: 700; color: var(--purple-1); }

/* ---------- Subject cards ---------- */
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.subject-card { border: 1px solid #eef0f7; border-radius: var(--radius-md); padding: 16px; }
.subject-icon {
    width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px; color: #fff; margin-bottom: 10px;
}
.subject-name { font-weight: 700; font-size: 14.5px; margin-bottom: 3px; }
.subject-desc { font-size: 11.5px; color: var(--text-mid); margin-bottom: 10px; min-height: 30px; }
.subject-progress-label { font-size: 11.5px; color: var(--text-mid); margin-bottom: 6px; }

.progress-track { background: #eef0f7; height: 6px; border-radius: 6px; overflow: hidden; }
.progress-track.big { height: 10px; }
.progress-fill { height: 100%; border-radius: 6px; }

/* color helpers */
.color-green { background: #22c55e; } .color-green.progress-fill{background:#22c55e;}
.color-blue { background: #3b82f6; } .color-blue.progress-fill{background:#3b82f6;}
.color-purple { background: #8b5cf6; } .color-purple.progress-fill{background:#8b5cf6;}
.color-orange { background: #f97316; } .color-orange.progress-fill{background:#f97316;}
.color-teal { background: #14b8a6; } .color-teal.progress-fill{background:#14b8a6;}
.color-pink { background: #ec4899; } .color-pink.progress-fill{background:#ec4899;}
.color-yellow { background: #eab308; } .color-yellow.progress-fill{background:#eab308;}
.color-gray { background: #64748b; } .color-gray.progress-fill{background:#64748b;}

/* ---------- Games grid ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.game-card { border: 1px solid #eef0f7; border-radius: var(--radius-md); padding: 16px; text-align: left; }
.game-icon {
    width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 19px; margin-bottom: 10px;
}
.game-name { font-weight: 700; font-size: 14.5px; margin-bottom: 3px; }
.game-desc { font-size: 11.5px; color: var(--text-mid); margin-bottom: 14px; min-height: 30px; }
.btn-play {
    display: block; text-align: center; background: var(--purple-1); color: #fff;
    padding: 10px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
}
.btn-play-disabled { background: #cbd0e6; cursor: not-allowed; }

/* ---------- Activity list ---------- */
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.activity-list li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.activity-icon { font-size: 17px; }
.activity-text { flex: 1; color: var(--text-dark); }
.activity-points { color: var(--green); font-weight: 700; }
.activity-empty { color: var(--text-mid); font-size: 13px; }

/* ---------- Level card ---------- */
.level-sub { font-size: 12.5px; color: var(--text-mid); margin: 0 0 4px; }
.level-big { font-size: 20px; font-weight: 800; margin-bottom: 14px; }
.level-next { font-size: 12.5px; color: var(--text-mid); margin-bottom: 8px; }
.level-numbers { text-align: right; font-size: 11.5px; color: var(--text-mid); margin-top: 6px; }

/* ---------- Profile mini card (sidebar right) ---------- */
.profile-mini { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.profile-avatar { font-size: 40px; }
.profile-avatar.big { font-size: 60px; }
.online-dot { font-size: 11px; color: var(--green); }
.profile-stat { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-top: 1px solid #eef0f7; font-size: 13px; }
.profile-stat span { color: var(--text-mid); }

/* ---------- Rating ---------- */
.tab-row { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-mid); background: #f4f5fb; }
.tab.active { background: var(--purple-1); color: #fff; }

.rating-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rating-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.rating-list li.is-me { background: #f2edff; border-radius: 10px; padding: 6px 8px; }
.rank { width: 22px; height: 22px; border-radius: 50%; background: #eef0f7; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 800; }
.rank-1 { background: #ffd76a; } .rank-2 { background: #d7dbe8; } .rank-3 { background: #e6b27a; }
.rating-avatar { font-size: 22px; }
.rating-name { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.rating-name span { font-size: 10.5px; color: var(--text-mid); }
.rating-points { color: var(--purple-text); }

.rating-table { width: 100%; border-collapse: collapse; }
.rating-table th { text-align: left; font-size: 12px; color: var(--text-mid); padding: 8px 10px; border-bottom: 1px solid #eef0f7; }
.rating-table td { padding: 10px; border-bottom: 1px solid #f4f5fb; font-size: 13.5px; }
.rating-table-name { display: flex; align-items: center; gap: 8px; }
.rating-table tr.is-me { background: #f2edff; }

/* ---------- Buttons ---------- */
.btn-primary { display: inline-block; background: var(--purple-1); color: #fff; padding: 12px 16px; border-radius: 10px; font-weight: 700; font-size: 13px; border: none; text-align: center; }
.btn-outline { display: inline-block; background: #fff; color: var(--purple-1); border: 1.5px solid var(--purple-1); padding: 11px 16px; border-radius: 10px; font-weight: 700; font-size: 13px; text-align: center; }
.btn-full { display: block; width: 100%; margin-top: 10px; }

/* ---------- Profile page ---------- */
.profile-hero { display: flex; align-items: center; gap: 18px; }
.profile-hero span.profile-avatar { font-size: 56px; }
.profile-hero h2 { margin: 0 0 4px; }
.profile-hero p { margin: 0; color: var(--text-mid); font-size: 13px; }
.profile-hero .btn-outline { margin-left: auto; }

.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: var(--radius-md); padding: 18px; text-align: center; box-shadow: var(--shadow); }
.stat-card span { font-size: 26px; }
.stat-card strong { display: block; font-size: 18px; margin: 6px 0 2px; }
.stat-card p { margin: 0; font-size: 12px; color: var(--text-mid); }

/* ---------- Auth pages ---------- */
.auth-body { background: linear-gradient(135deg, var(--purple-2), var(--navy)); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: #fff; border-radius: var(--radius-lg); padding: 34px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.auth-sub { color: var(--text-mid); font-size: 13px; margin: 0 0 22px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { font-size: 12.5px; font-weight: 600; color: var(--text-mid); display: flex; flex-direction: column; gap: 6px; }
.auth-form input, .auth-form select {
    padding: 11px 13px; border-radius: 9px; border: 1.5px solid #e5e7f2; font-size: 14px; font-family: inherit; color: var(--text-dark);
}
.auth-form input:focus, .auth-form select:focus { outline: none; border-color: var(--purple-1); }
.avatar-choice { display: flex; gap: 14px; }
.avatar-radio { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 13px !important; }
.auth-link { text-align: center; font-size: 13px; color: var(--text-mid); margin-top: 18px; }
.auth-link a { color: var(--purple-1); font-weight: 700; }
.alert-error { background: #fee2e2; color: #b91c1c; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* ---------- Game pages ---------- */
.back-link { display: inline-block; margin-bottom: 14px; color: var(--purple-1); font-weight: 700; font-size: 13.5px; }
.game-panel { text-align: center; padding: 40px 24px; }
.game-panel-header { display: flex; align-items: center; justify-content: space-between; text-align: left; margin-bottom: 30px; }
.game-hud { display: flex; gap: 18px; font-size: 13px; color: var(--text-mid); }
.hint-text { color: var(--text-mid); font-size: 14px; margin-bottom: 10px; }
.math-question { font-size: 42px; font-weight: 800; margin-bottom: 26px; }
.scramble-letters { font-size: 34px; font-weight: 800; letter-spacing: 8px; margin-bottom: 26px; color: var(--purple-text); }
.answer-form { display: flex; gap: 10px; justify-content: center; max-width: 360px; margin: 0 auto; }
.answer-form input { flex: 1; padding: 13px 16px; border-radius: 10px; border: 1.5px solid #e5e7f2; font-size: 16px; text-align: center; }
.answer-form input:focus { outline: none; border-color: var(--purple-1); }
.feedback { margin-top: 16px; font-weight: 700; font-size: 14px; min-height: 20px; }
.feedback-good { color: var(--green); }
.feedback-bad { color: #dc2626; }
.result-area { padding: 20px; }
.result-emoji { font-size: 60px; margin-bottom: 10px; }
.result-area h3 { margin: 0 0 10px; font-size: 20px; }
.result-area p { color: var(--text-mid); margin: 4px 0; }
.result-area .btn-primary, .result-area .btn-outline { margin: 16px 8px 0; padding: 12px 24px; }

/* ---------- Game switcher (cross-game navigation) ---------- */
.game-switcher-list { display: flex; flex-wrap: wrap; gap: 10px; }
.game-chip {
    display: flex; align-items: center; gap: 8px;
    border: 1.5px solid #eef0f7; border-radius: 10px; padding: 9px 14px;
    font-size: 13px; font-weight: 600; color: var(--text-dark);
    transition: border-color .15s, background .15s;
}
.game-chip:hover { border-color: var(--purple-1); background: #f8f6ff; }
.game-chip-icon {
    width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: #fff;
}

/* ---------- Sentence building game (Gap tuzish) ---------- */
.sentence-answer {
    min-height: 60px; border: 2px dashed #dcdff0; border-radius: 12px;
    padding: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    max-width: 620px; margin: 0 auto 20px;
}
.sentence-placeholder { color: var(--text-mid); font-size: 13.5px; }
.sentence-pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 620px; margin: 0 auto 24px; }
.word-chip {
    background: #f4f5fb; border: 1.5px solid #e5e7f2; border-radius: 9px;
    padding: 9px 16px; font-size: 15px; font-weight: 700; color: var(--text-dark);
}
.word-chip:hover { border-color: var(--purple-1); background: #f2edff; }
.word-chip-used { background: var(--purple-1); color: #fff; border-color: var(--purple-1); }
.sentence-actions { display: flex; gap: 12px; justify-content: center; }

/* ---------- Crossword game (Krossvord) ---------- */
.crossword-panel { text-align: left; }
.clues-list { display: flex; flex-direction: column; gap: 22px; max-width: 620px; margin: 0 auto; }
.clue-text { font-size: 14px; margin-bottom: 10px; }
.clue-boxes { display: flex; gap: 6px; flex-wrap: wrap; }
.letter-box {
    width: 38px; height: 42px; text-align: center; font-size: 18px; font-weight: 800;
    border: 1.5px solid #e5e7f2; border-radius: 8px; text-transform: uppercase;
}
.letter-box:focus { outline: none; border-color: var(--purple-1); }
.letter-box.box-correct { border-color: var(--green); background: #eafcef; color: var(--green); }
.letter-box.box-wrong { border-color: #dc2626; background: #fef2f2; color: #dc2626; }

/* ---------- Quiz game (Savol-javob) ---------- */
.quiz-panel { text-align: center; }
.quiz-subject {
    display: inline-block; background: #f2edff; color: var(--purple-1);
    font-size: 11.5px; font-weight: 700; padding: 5px 12px; border-radius: 20px; margin-bottom: 14px;
}
.quiz-question { font-size: 21px; font-weight: 800; margin-bottom: 24px; max-width: 560px; margin-left: auto; margin-right: auto; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 560px; margin: 0 auto; }
.quiz-option {
    background: #fff; border: 1.5px solid #e5e7f2; border-radius: 12px;
    padding: 14px; font-size: 14.5px; font-weight: 600; color: var(--text-dark); text-align: left;
}
.quiz-option:hover:not(:disabled) { border-color: var(--purple-1); background: #f8f6ff; }
.quiz-option:disabled { cursor: default; }
.option-correct { border-color: var(--green) !important; background: #eafcef !important; color: var(--green) !important; }
.option-wrong { border-color: #dc2626 !important; background: #fef2f2 !important; color: #dc2626 !important; }
@media (max-width: 600px) { .quiz-options { grid-template-columns: 1fr; } }

/* ---------- Find-the-mistake game (Top-to'g'rila) ---------- */
.mistake-sentence {
    display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
    max-width: 620px; margin: 0 auto 10px;
}
.mistake-word {
    background: #f4f5fb; border: 1.5px solid #e5e7f2; border-radius: 10px;
    padding: 12px 18px; font-size: 18px; font-weight: 700; color: var(--text-dark);
}
.mistake-word:hover:not(:disabled) { border-color: var(--purple-1); background: #f2edff; }
.mistake-word:disabled { cursor: default; }
.mistake-correct { border-color: var(--green) !important; background: #eafcef !important; color: var(--green) !important; }
.mistake-wrong { border-color: #dc2626 !important; background: #fef2f2 !important; color: #dc2626 !important; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .content-grid { grid-template-columns: 1fr; }
    .two-col { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { padding: 16px; }
    .stat-cards { grid-template-columns: 1fr; }
}
