:root {
    --bg-dark: #0f172a;
    --sidebar-bg: rgba(30, 41, 59, 0.7);
    --card-bg: rgba(30, 41, 59, 0.8);
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --success: #10b981;
    --error: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-main: 'Inter', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background: linear-gradient(135deg, #0f172a 0%, #1e1e2f 100%);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 260px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2.5rem;
    background: -webkit-linear-gradient(45deg, #0ea5e9, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-grow: 1;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-align: left;
    padding: 1rem 1.2rem;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateX(5px);
}

.nav-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.stats-panel {
    border-radius: 16px;
    padding: 1.2rem;
    margin-top: auto;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    flex-grow: 1;
    height: 100%;
    padding: 2rem;
    overflow-y: auto;
    position: relative;
}

.page {
    display: none;
    height: 100%;
    animation: fadeIn 0.4s ease forwards;
}

.page.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card {
    width: 100%;
    max-width: 700px;
    min-height: 500px;
    border-radius: 24px;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 2.5rem;
    text-align: center;
}

.subtitle {
    color: var(--text-muted);
}

/* Learn Buttons */
.category-list,
.choice-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
    overflow-y: auto;
    max-height: 60vh;
}

.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 1.2rem;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-text {
    background: none;
    color: var(--text-muted);
    padding: 0.5rem;
}

.btn-text:hover {
    color: var(--text-main);
    background: none;
    transform: none;
    box-shadow: none;
    text-decoration: underline;
}

/* Back Button */
.back-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem 2rem;
    border-radius: 40px;
    font-size: 15px;
    font-weight: 600;
    margin-top: 2.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateX(-6px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.2);
}

/* Input */
.text-input {
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 1.2rem;
    border-radius: 12px;
    font-size: 20px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s;
}

.text-input:focus {
    outline: none;
    border-color: var(--accent);
}

.result-message {
    font-size: 20px;
    font-weight: 600;
    margin-top: 1.5rem;
    min-height: 30px;
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stats Page */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    width: 100%;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
}

/* Translator */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.translation-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--accent);
}

.word-mo {
    font-weight: bold;
    font-size: 18px;
    color: var(--accent);
}

.word-ru {
    color: var(--text-main);
    font-size: 16px;
}

/* Responsive Mobile Layout */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 75px;
        padding: 0.5rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        position: fixed;
        bottom: 0;
        left: 0;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-right: none;
        z-index: 1000;
    }

    .logo {
        display: none;
    }

    .navigation {
        flex-direction: row;
        gap: 0.4rem;
        width: 100%;
        justify-content: space-between;
        margin: 0;
    }

    .nav-btn {
        padding: 0.5rem;
        font-size: 12px;
        text-align: center;
        flex: 1;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        white-space: nowrap;
    }

    .nav-btn.active {
        background: rgba(14, 165, 233, 0.2);
        color: var(--accent);
        box-shadow: none;
    }

    .stats-panel {
        display: none;
    }

    .main-content {
        padding: 1rem;
        padding-bottom: 95px;
        justify-content: flex-start;
    }

    .card {
        padding: 1.5rem;
        min-height: 400px;
        justify-content: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 22px;
        margin-bottom: 1.5rem;
    }

    .btn {
        padding: 1rem;
        font-size: 16px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    margin-bottom: 2rem;
}

.game-tile {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 1rem;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    user-select: none;
}

.game-tile:hover {
    background: rgba(255, 255, 255, 0.1);
}

.game-tile.selected {
    border-color: var(--accent);
    background: rgba(14, 165, 233, 0.2);
}

.game-tile.matched {
    opacity: 0;
    pointer-events: none;
}

.game-tile.wrong {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.2);
    animation: shake 0.4s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}