/* --- 1. VARIABLES & RESET --- */
:root {
    /* По-модерна, топла палитра */
    --primary-color: #8B7355;
    --primary-dark: #6d5a44;
    --primary-light: #a68f73;
    --accent-color: #FFB74D; /* Свежо оранжево за акценти */
    
    --bg-color: #F7F5F2; /* Топъл бял фон */
    --card-bg: #FFFFFF;
    
    --success-color: #66BB6A;
    --danger-color: #EF5350;
    --info-color: #42A5F5;
    
    --text-main: #2D2D2D;
    --text-muted: #757575;
    
    --border-radius: 16px; /* По-заоблени ъгли */
    --nav-height: 70px;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --font-family: 'Nunito', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Премахва синьото при клик на мобилни */
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* --- 2. TYPOGRAPHY & LAYOUT --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.2;
}

/* --- 3. NAVBAR (APP STYLE) --- */
.navbar {
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.85); /* Полупрозрачен */
    backdrop-filter: blur(12px); /* Glassmorphism ефект */
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i { font-size: 1.8rem; }

/* Меню за десктоп */
.navbar-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.navbar-menu a {
    font-weight: 700;
    color: var(--text-main);
    transition: 0.3s;
    font-size: 1.05rem;
    padding: 8px 12px;
    border-radius: 12px;
}

.navbar-menu a:hover, 
.navbar-menu a.active {
    color: var(--primary-color);
    background: rgba(139, 115, 85, 0.1);
}

/* Мобилен бутон */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-main);
    cursor: pointer;
}

/* --- 4. BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.7rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn:active { transform: scale(0.95); }

.btn-login {
    background-color: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    box-shadow: none;
}

.btn-register, .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-register:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(139, 115, 85, 0.3);
}

.btn-logout {
    background: rgba(239, 83, 80, 0.1);
    color: var(--danger-color);
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Кръгъл бутон */
}

/* --- 5. CARDS & SECTIONS --- */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Карти (Уроци, Профил и др.) */
.card, .feature-card, .lesson-card, .auth-card {
    background: var(--card-bg);
    border-radius: 24px; /* Силно заоблени */
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0,0,0,0.02);
}

.feature-card:hover, .lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

/* --- 6. CHESS BOARD & GAME UI --- */
.game-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    align-items: start;
}

.game-board-wrapper {
    background: white;
    padding: 1rem;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
}

.chess-board {
    width: 100%;
    aspect-ratio: 1/1; /* Прави го идеален квадрат */
    border-radius: 8px;
    overflow: hidden;
    touch-action: none; /* Важно за drag & drop на мобилни */
}

/* Сайдбар на играта */
.game-sidebar {
    background: white;
    padding: 1.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: var(--bg-color);
    border-radius: 16px;
}

.timer-display {
    font-family: 'Courier New', monospace;
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--text-main);
}

/* --- 7. FORMS --- */
input, select {
    width: 100%;
    padding: 1rem;
    border: 2px solid #eee;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: 0.3s;
    background: #fbfbfb;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(139, 115, 85, 0.1);
}

/* --- 8. TOAST ALERTS --- */
.messages-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    background: white;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    font-weight: 600;
}

.toast-success { border-left: 5px solid var(--success-color); color: #2e7d32; }
.toast-error { border-left: 5px solid var(--danger-color); color: #c62828; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- 9. RESPONSIVE / MOBILE --- */
@media (max-width: 768px) {
    .nav-container { padding: 0 15px; }
    
    .mobile-menu-btn { display: block; }

    /* Мобилно меню - падащо */
    .navbar-menu {
        position: absolute;
        top: var(--nav-height);
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); /* Скрито */
        transition: 0.4s ease-in-out;
    }

    .navbar-menu.active {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); /* Показано */
    }

    .navbar-menu li { width: 100%; }
    .navbar-menu a { 
        display: block; 
        padding: 1rem; 
        background: var(--bg-color); 
        margin-bottom: 8px;
    }
    
    .auth-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .btn { width: 100%; }

    /* Game Layout за мобилни */
    .game-container {
        grid-template-columns: 1fr;
    }
    
    .game-board-wrapper { padding: 5px; }
    
    .hero h1 { font-size: 2.2rem; }
}
/* --- HERO SECTION STYLES --- */
.hero-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    padding: 3rem 0 5rem;
    min-height: 80vh;
}

.hero-text {
    max-width: 600px;
}

.badge-pill {
    background-color: rgba(139, 115, 85, 0.1);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
    display: inline-block;
}

.hero-text h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: #2c2c2c;
}

.highlight {
    color: var(--primary-color);
    position: relative;
    white-space: nowrap;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 100%;
    height: 12px;
    background-color: #ffe0b2; /* Светло оранжево */
    z-index: -1;
    border-radius: 4px;
    opacity: 0.6;
}

.hero-description {
    font-size: 1.25rem;
    color: #555;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 16px; /* App-like rounded */
}

/* Ефект на отблясък за главния бутон */
.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 40%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 60%);
    transform: rotate(30deg);
    transition: transform 0.5s;
    opacity: 0;
}

.shine-effect:hover::after {
    opacity: 1;
    transform: rotate(30deg) translate(20%, 20%);
    transition: 0.7s;
}

.trust-indicators {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.text-success { color: var(--success-color); }

/* --- VISUAL BOARD (Right Side) --- */
.hero-visual {
    display: flex;
    justify-content: center;
    position: relative;
}

.floating-board-container {
    position: relative;
    width: 320px;
    height: 320px;
}

.floating-board {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f0d9b5 0%, #b58863 100%);
    border-radius: 30px;
    transform: rotate(-10deg) skew(5deg);
    box-shadow: -20px 20px 40px rgba(0,0,0,0.15);
    position: relative;
    animation: float 6s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 8px solid white;
}

.board-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 60%;
    height: 60%;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

.square { width: 100%; height: 100%; }
.square.white { background-color: rgba(255,255,255,0.6); }
.square.black { background-color: rgba(0,0,0,0.1); }

/* Летящи фигури */
.piece-knight, .piece-king, .piece-pawn {
    position: absolute;
    font-size: 3rem;
    color: #3e2723;
    text-shadow: 2px 2px 0px rgba(255,255,255,0.5);
    filter: drop-shadow(5px 10px 4px rgba(0,0,0,0.2));
}

.piece-knight { top: -20px; right: 20px; transform: rotate(15deg); font-size: 4rem; }
.piece-king { bottom: 30px; left: 30px; transform: rotate(-10deg); font-size: 3.5rem; color: #fff; text-shadow: 2px 2px 0 #333; }
.piece-pawn { top: 40px; left: -10px; transform: rotate(-25deg); }

/* Малка карта "Победа" */
.floating-card {
    position: absolute;
    bottom: -20px;
    right: -30px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    animation: float 6s ease-in-out infinite reverse; /* Обратна анимация */
}

.text-warning { color: #ffc107; font-size: 1.5rem; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-10deg); }
    50% { transform: translateY(-20px) rotate(-8deg); }
}

/* --- FEATURES SECTION --- */
.features-section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3rem;
}

.section-header h2 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.section-header p { color: #777; font-size: 1.1rem; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* Автоматична решетка */
    gap: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: left;
    border: 1px solid #f0f0f0;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

/* Цветове за иконите */
.icon-blue { background: #e3f2fd; color: #2196f3; }
.icon-orange { background: #fff3e0; color: #ff9800; }
.icon-green { background: #e8f5e9; color: #4caf50; }
.icon-red { background: #ffebee; color: #f44336; }

.feature-card h3 { font-size: 1.3rem; margin-bottom: 0.8rem; }
.feature-card p { color: #666; font-size: 0.95rem; line-height: 1.5; }

/* --- CTA SECTION --- */
.cta-section {
    margin: 4rem 0;
}

.cta-container {
    background: linear-gradient(120deg, var(--primary-color), var(--primary-dark));
    border-radius: 30px;
    padding: 4rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    box-shadow: 0 20px 40px rgba(139, 115, 85, 0.25);
    position: relative;
    overflow: hidden;
}

/* Декорация за фона на CTA */
.cta-container::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.cta-content { max-width: 600px; position: relative; z-index: 2; }
.cta-content h2 { color: white; margin-bottom: 1rem; }
.cta-content p { color: rgba(255,255,255,0.9); font-size: 1.1rem; }

.btn-white {
    background: white;
    color: var(--primary-color);
    border: none;
    font-weight: 800;
}

.btn-white:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

/* --- MOBILE ADJUSTMENTS --- */
@media (max-width: 992px) {
    .hero-section {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
        padding-top: 2rem;
    }

    .hero-text { margin: 0 auto; }
    .hero-buttons { justify-content: center; }
    .trust-indicators { justify-content: center; }
    
    .floating-board-container {
        width: 280px;
        height: 280px;
    }
}

@media (max-width: 768px) {
    .hero-text h1 { font-size: 2.5rem; }
    
    .cta-container {
        padding: 2rem;
        flex-direction: column;
        text-align: center;
    }
    
    .btn-lg { width: 100%; }
}
/* --- LESSONS PAGE --- */
.lessons-page {
    padding: 3rem 0;
}

/* Решетката за картите */
.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

/* Основен стил на картата */
.lesson-card {
    background: white;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

/* Hover ефект - картата отскача нагоре */
.lesson-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--card-color);
}

/* Цветови теми за картите (използваме CSS variables) */
.color-blue   { --card-color: #42A5F5; --bg-light: #E3F2FD; }
.color-green  { --card-color: #66BB6A; --bg-light: #E8F5E9; }
.color-orange { --card-color: #FFA726; --bg-light: #FFF3E0; }
.color-purple { --card-color: #AB47BC; --bg-light: #F3E5F5; }
.color-red    { --card-color: #EF5350; --bg-light: #FFEBEE; }
.color-gold   { --card-color: #FFCA28; --bg-light: #FFF8E1; }

/* Горна част на картата */
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.lesson-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--bg-light); /* Много светъл цвят за номера */
    line-height: 1;
    font-family: 'Nunito', sans-serif;
    filter: saturate(0.8) darken(10%); /* Малко по-тъмен от фона */
}

.lesson-tag {
    background: var(--bg-light);
    color: var(--card-color);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Икона */
.card-icon {
    width: 70px;
    height: 70px;
    background: var(--bg-light);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--card-color);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.lesson-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    background: var(--card-color);
    color: white;
}

/* Текст */
.card-content {
    flex-grow: 1; /* Избутва бутона най-долу */
    margin-bottom: 1.5rem;
}

.card-content h3 {
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-size: 1.4rem;
}

.card-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Бутон най-долу */
.btn-lesson {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.8rem 1.2rem;
    background: var(--bg-light);
    color: var(--card-color);
    border-radius: 12px;
    font-weight: 700;
    transition: 0.2s;
}

.btn-lesson:hover {
    background: var(--card-color);
    color: white;
}

/* Анимация за стрелката */
.btn-lesson:hover i {
    transform: translateX(5px);
}

.btn-lesson i { transition: transform 0.2s; }
/* --- ABOUT PAGE STYLES --- */

/* Hero Section */
.about-hero {
    text-align: center;
    padding: 3rem 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.about-badge {
    display: inline-block;
    background: #FFEBEE;
    color: #D32F2F;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.lead-text {
    font-size: 1.2rem;
    color: var(--text-muted);
    line-height: 1.8;
}

/* Creators Section (Tathe & Sin) */
.creators-section {
    padding: 2rem 0 4rem;
}

.creators-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.creator-card {
    background: white;
    border-radius: 24px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-soft);
    width: 300px;
    position: relative;
    border-top: 5px solid transparent;
}

/* Аватари */
.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 4px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.parent-avatar { background: #5D4037; color: #FFF; } /* Тъмно кафяво за таткото */
.kid-avatar { background: #FFB74D; color: #FFF; }    /* Оранжево за сина */

.creator-card h3 { margin-bottom: 0.2rem; }
.role { 
    color: var(--primary-color); 
    font-weight: 700; 
    font-size: 0.9rem; 
    text-transform: uppercase; 
    margin-bottom: 1rem; 
}

.desc { font-size: 0.95rem; color: #666; }

.connector {
    font-size: 2rem;
    color: #ddd;
}

/* Info Grid (Features & Tech) */
.tech-section {
    padding: 2rem 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.info-card {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid #f9f9f9;
}

.icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.icon-yellow { background: #FFF8E1; color: #FFC107; }
.icon-blue   { background: #E3F2FD; color: #2196F3; }
.icon-green  { background: #E8F5E9; color: #4CAF50; }

/* Tech Tags (Flask, Python badges) */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.tag {
    background: #f0f2f5;
    color: #333;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag i { color: var(--primary-color); }

/* Responsive */
@media (max-width: 768px) {
    .connector { display: none; } /* Скрий плюса на мобилни */
    .creators-grid { flex-direction: column; }
    .creator-card { width: 100%; }
}
/* --- AUTH PAGES (LOGIN & REGISTER) --- */

/* 1. Wrapper и Анимиран Фон */
.auth-wrapper {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 1rem;
}

/* Летящи фигури във фона */
.bg-shape {
    position: absolute;
    font-size: 15rem;
    color: rgba(139, 115, 85, 0.05); /* Много прозрачно */
    z-index: -1;
    animation: floatBackground 10s ease-in-out infinite;
}

.shape-1 { top: 10%; left: 5%; animation-delay: 0s; }
.shape-2 { bottom: 10%; right: 5%; animation-delay: 5s; font-size: 12rem; }

@keyframes floatBackground {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(10deg); }
}

/* 2. Картата (The Card) */
.auth-card {
    background: white;
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    border-radius: 30px; /* Силно заоблени ъгли */
    box-shadow: 0 20px 60px rgba(0,0,0,0.1); /* Дълбока сянка */
    text-align: center;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
}

/* Анимация при появяване на картата */
.animated-entry {
    animation: slideUpFade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 3. Хедър на картата */
.auth-header { margin-bottom: 2rem; }

.icon-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 10px 20px rgba(139, 115, 85, 0.3);
    animation: bounceIn 1s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.auth-header h1 { font-size: 1.8rem; margin-bottom: 0.5rem; color: var(--text-main); }
.auth-header p { color: var(--text-muted); font-size: 0.95rem; }

/* 4. Форми и Input полета (App Style) */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 1.1rem;
    transition: color 0.3s;
    z-index: 2;
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem; /* Място за иконата */
    border: 2px solid #eee;
    background: #f9f9f9;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Ефект при клик в полето */
.input-group input:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(139, 115, 85, 0.15);
    transform: translateY(-2px);
}

.input-group input:focus + .input-icon,
.input-group:focus-within .input-icon {
    color: var(--primary-color);
}

/* 5. Бутон */
.btn-animate {
    margin-top: 1rem;
    padding: 1rem;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

/* Блясък върху бутона */
.btn-animate::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: 0.5s;
}

.btn-animate:hover::after {
    left: 100%;
}

/* 6. Футър (Линк за регистрация) */
.auth-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    font-size: 0.95rem;
    color: #666;
}

.link-highlight {
    color: var(--primary-color);
    font-weight: 800;
    position: relative;
}

.link-highlight::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.link-highlight:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* --- REGISTRATION SPECIFIC STYLES --- */

/* Различен цвят на аватара за регистрация */
.register-avatar {
    background: linear-gradient(135deg, #66BB6A, #43A047); /* Зелен градиент */
}

/* Етикет над групата с теми */
.group-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    margin-left: 0.5rem;
}

/* Решетка за темите */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1.5rem;
}

/* Скриваме стандартния радио бутон */
.theme-option input[type="radio"] {
    display: none;
}

/* Картичката за тема */
.theme-card {
    background: #f5f5f5;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 0.8rem 0.5rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.theme-card span {
    font-size: 0.85rem;
    font-weight: 700;
    color: #666;
}

/* Превю на цветовете (кръгчето) */
.color-preview {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 2px solid white;
}

.classic-preview { background: linear-gradient(135deg, #f0d9b5 50%, #b58863 50%); }
.green-preview   { background: linear-gradient(135deg, #eeeed2 50%, #769656 50%); }
.bw-preview      { background: linear-gradient(135deg, #ffffff 50%, #666666 50%); }

/* Икона за отметка (скрита по подразбиране) */
.check-icon {
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    color: var(--primary-color);
    border-radius: 50%;
    font-size: 1.2rem;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* --- СЪСТОЯНИЕ: ИЗБРАНО (CHECKED) --- */
.theme-option input[type="radio"]:checked + .theme-card {
    border-color: var(--primary-color);
    background: rgba(139, 115, 85, 0.05);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(139, 115, 85, 0.2);
}

.theme-option input[type="radio"]:checked + .theme-card span {
    color: var(--primary-color);
}

.theme-option input[type="radio"]:checked + .theme-card .check-icon {
    opacity: 1;
    transform: scale(1);
}

/* --- Responsive fixes --- */
@media (max-width: 380px) {
    .theme-grid {
        grid-template-columns: 1fr; /* Една колона на много малки екрани */
    }
    .theme-card {
        flex-direction: row; /* Хоризонтално */
        justify-content: center;
    }
    .check-icon {
        top: 50%;
        transform: translateY(-50%) scale(0);
        right: 15px;
    }
    .theme-option input[type="radio"]:checked + .theme-card .check-icon {
        transform: translateY(-50%) scale(1);
    }
}
/* --- PROFILE PAGE STYLES --- */

/* Header */
.profile-header {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: var(--shadow-soft);
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    box-shadow: 0 10px 20px rgba(139, 115, 85, 0.3);
}

.profile-info h1 { margin-bottom: 0.2rem; }
.join-date { color: #888; margin-bottom: 1rem; }

.profile-badges span {
    background: #f0f0f0;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 0.5rem;
}
.badge-level { background: #E3F2FD; color: #1976D2; }

/* TABS Navigation */
.profile-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 5px; /* За скролбара ако е нужен */
}

.tab-btn {
    background: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tab-btn:hover { background: #f9f9f9; transform: translateY(-2px); }
.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 5px 15px rgba(139, 115, 85, 0.3);
}

/* Tab Content Animation */
.tab-content { display: none; animation: fadeIn 0.4s ease; }
.active-tab { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* STATS DASHBOARD */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.stat-box .number { font-size: 2.5rem; font-weight: 800; line-height: 1.2; }
.stat-box .label { font-size: 0.9rem; font-weight: 600; opacity: 0.8; }
.stat-box .icon { font-size: 1.5rem; margin-bottom: 0.5rem; opacity: 0.8; }

.win-box { color: #2E7D32; background: #E8F5E9; }
.loss-box { color: #C62828; background: #FFEBEE; }
.draw-box { color: #F57F17; background: #FFFDE7; }
.time-box { color: #1565C0; background: #E3F2FD; }

/* HISTORY CARDS (Not Table) */
.games-list { display: flex; flex-direction: column; gap: 1rem; }

.game-card {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.game-card:hover { transform: scale(1.01); }

.game-status-stripe {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 6px;
}
.result-win .game-status-stripe { background: #4CAF50; }
.result-loss .game-status-stripe { background: #F44336; }
.result-draw .game-status-stripe { background: #FFC107; }

.game-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.result-win .game-icon { background: #E8F5E9; color: #4CAF50; }
.result-loss .game-icon { background: #FFEBEE; color: #F44336; }
.result-draw .game-icon { background: #FFFDE7; color: #FFC107; }

.game-details { flex: 1; }
.game-details h4 { margin: 0 0 0.3rem 0; color: var(--text-main); }
.game-meta { display: flex; gap: 1rem; font-size: 0.85rem; color: #777; }
.game-meta i { margin-right: 4px; }

/* SOCIAL TAB */
.friends-grid-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.friend-card {
    display: flex;
    align-items: center;
    background: white;
    padding: 0.8rem;
    border-radius: 12px;
    margin-bottom: 0.8rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.friend-avatar {
    width: 40px;
    height: 40px;
    background: #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.friend-info { flex: 1; }
.add-friend-form { display: flex; gap: 0.5rem; margin-top: 1rem; }
.search-input {
    flex: 1;
    position: relative;
}
.search-input i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #aaa; }
.search-input input { padding-left: 35px; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .profile-header { flex-direction: column; text-align: center; }
    .friends-grid-layout { grid-template-columns: 1fr; }
    .game-card { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .game-actions { width: 100%; display: flex; justify-content: flex-end; }
}
/* --- MISSION CONTROL V2 (FUTURE STYLE) --- */

.mission-control-wrapper {
    min-height: 90vh;
    position: relative;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    /* Текстура на мрежа (Grid) за 3D усещане */
    background-color: #f0f2f5;
    background-image: 
        linear-gradient(rgba(139, 115, 85, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 115, 85, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    overflow: hidden;
}

/* --- 1. ЛЕТЯЩИТЕ ФИГУРИ (ANIMATION) --- */
.space-background {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; /* Да не пречат на кликането */
    z-index: 0;
}

.floating-piece {
    position: absolute;
    color: rgba(0, 0, 0, 0.03); /* Много бледи */
    z-index: -1;
}

/* Кон (Ляво) */
.piece-1 {
    font-size: 25rem;
    top: 10%;
    left: -100px;
    transform: rotate(15deg);
    animation: floatRotate 20s infinite alternate ease-in-out;
    color: rgba(139, 115, 85, 0.08); /* Кафяв нюанс */
    filter: blur(4px);
}

/* Топ (Дясно) */
.piece-2 {
    font-size: 20rem;
    bottom: 5%;
    right: -50px;
    transform: rotate(-15deg);
    animation: floatUp 15s infinite alternate ease-in-out;
    color: rgba(0, 0, 0, 0.05);
}

/* Пешка (Среда) */
.piece-3 {
    font-size: 8rem;
    top: 15%;
    right: 20%;
    animation: floatRotate 25s infinite linear;
    opacity: 0.5;
}

/* Царица (Малка) */
.piece-4 {
    font-size: 5rem;
    bottom: 20%;
    left: 20%;
    filter: blur(2px);
    animation: floatUp 12s infinite alternate;
}

@keyframes floatRotate {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-50px) rotate(20deg); }
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-30px) scale(1.1); }
}

/* --- 2. КАРТАТА (CONTAINER) --- */
.setup-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    width: 100%;
    max-width: 550px;
    border-radius: 32px;
    padding: 2.5rem;
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.1),
        0 0 0 1px rgba(255,255,255,0.8) inset;
    position: relative;
    z-index: 10;
}

.setup-header { text-align: center; margin-bottom: 2rem; }
.eyebrow {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: 3px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}
.setup-header h1 { margin: 0; font-size: 2.2rem; line-height: 1.1; }

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #666;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- 3. ИЗБОР НА ОТБОР (HIGH CONTRAST) --- */
.color-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.color-card {
    position: relative;
    cursor: pointer;
    height: 180px; /* Фиксирана височина */
    perspective: 1000px;
}

.color-card input { display: none; }

.card-inner {
    height: 100%;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 4px solid transparent;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.card-visual { font-size: 4rem; margin-bottom: 0.5rem; transition: 0.3s; }
.card-label { font-size: 1.4rem; font-weight: 800; }
.card-sub { font-size: 0.8rem; opacity: 0.7; }

/* === БЕЛИТЕ (GOLD STYLE) === */
.white-team .card-inner {
    background: linear-gradient(135deg, #ffffff 0%, #f3e7c8 100%);
    color: #8B7355;
    border-color: white;
}
.white-team:hover .card-inner { transform: translateY(-5px); }

/* Активно състояние Бели */
.white-team input:checked + .card-inner {
    border-color: #FFC107; /* Златна рамка */
    background: #fff;
    box-shadow: 0 15px 30px rgba(255, 193, 7, 0.3);
    transform: scale(1.05);
}
.white-team input:checked + .card-inner .card-visual {
    color: #FFC107;
    text-shadow: 0 2px 10px rgba(255, 193, 7, 0.5);
    transform: scale(1.1);
}

/* === ЧЕРНИТЕ (DARK NEON STYLE) === */
.black-team .card-inner {
    background: linear-gradient(135deg, #2c3e50 0%, #000000 100%);
    color: #90a4ae;
}
.black-team:hover .card-inner { transform: translateY(-5px); }

/* Активно състояние Черни */
.black-team input:checked + .card-inner {
    border-color: #2196F3; /* Неоново синьо */
    background: #111;
    color: white;
    box-shadow: 0 15px 30px rgba(33, 150, 243, 0.4); /* Синьо сияние */
    transform: scale(1.05);
}
.black-team input:checked + .card-inner .card-visual {
    color: #2196F3;
    text-shadow: 0 0 15px #2196F3; /* Свети */
    transform: scale(1.1);
}

/* --- 4. НИВО НА ТРУДНОСТ (ПО-ЯСНО) --- */
.diff-card {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    border: 2px solid #eee;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: 0.2s;
}
.diff-card input { display: none; }

.diff-icon {
    font-size: 1.8rem;
    width: 50px;
    text-align: center;
    color: #ccc;
    transition: 0.3s;
}

.check-circle {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #eee;
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    transition: 0.3s;
}

/* Активно състояние Трудност */
.diff-card:has(input:checked) {
    border-color: var(--primary-color);
    background: #fffcf5; /* Леко жълтеникаво */
    transform: translateX(10px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.diff-card:has(input:checked) .check-circle {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* Оцветяване на иконите при избор */
.easy:has(input:checked) .diff-icon { color: #4CAF50; animation: bounce 0.5s; }
.medium:has(input:checked) .diff-icon { color: #FF9800; animation: bounce 0.5s; }
.hard:has(input:checked) .diff-icon { color: #F44336; animation: shake 0.5s; }

@keyframes bounce { 0%, 100% {transform: scale(1);} 50% {transform: scale(1.3);} }
@keyframes shake { 0%, 100% {transform: rotate(0);} 25% {transform: rotate(10deg);} 75% {transform: rotate(-10deg);} }


/* --- 5. TIME CAPSULES --- */
.time-scroller {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}
.time-capsule input { display: none; }

.capsule-body {
    background: #f5f5f5;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-weight: 700;
    color: #777;
    white-space: nowrap;
    transition: 0.3s;
    border: 2px solid transparent;
}

.time-capsule input:checked + .capsule-body {
    background: var(--text-main);
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

/* --- 6. ПРИЯТЕЛ & БУТОН --- */
.input-modern-wrapper {
    position: relative;
    background: white;
    border: 2px solid #eee;
    border-radius: 16px;
    padding: 0.2rem;
}
.input-lead-icon {
    position: absolute;
    left: 15px; top: 50%; transform: translateY(-50%);
    color: #aaa;
}
.input-modern-wrapper input {
    border: none;
    background: transparent;
    padding-left: 40px;
    box-shadow: none;
}
.input-modern-wrapper:focus-within {
    border-color: var(--primary-color);
}

.btn-mega {
    width: 100%;
    padding: 1.2rem;
    border-radius: 20px;
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 1px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, var(--primary-color), #5d4037);
    box-shadow: 0 10px 30px rgba(139, 115, 85, 0.4);
    transition: 0.3s;
}

.pulse-glow { animation: pulseGlow 2s infinite; }
@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(139, 115, 85, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(139, 115, 85, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 115, 85, 0); }
}

.btn-mega:hover {
    transform: translateY(-3px) scale(1.02);
}
/* --- GAME ARENA (MOBILE FIRST) --- */

/* Скриваме хедъра и футъра на сайта докато играем, за да има място */
/* (Забележка: Можеш да добавиш клас .game-mode на body чрез JS ако искаш да скриеш навигацията напълно, но тук ще направим арената върху всичко) */

.game-arena {
    display: flex;
    flex-direction: column;
    min-height: 70vh;
    max-width: 600px;
    width: min(600px, 100%);
    margin: 0 auto;
    padding: 10px 0 40px;
    gap: 12px;
    position: relative;
    background: #f4f7f6;
    overflow: visible;
}

/* 1. PLAYER ZONES */
.player-zone {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 16px;
    margin: 5px 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: 0.3s;
    border: 2px solid transparent;
}

/* Активната зона свети */
.active-turn {
    border-color: var(--primary-color);
    background: #fffcf5;
    box-shadow: 0 0 15px rgba(139, 115, 85, 0.2);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.opponent-avatar { background: #546E7A; }
.player-avatar { background: var(--primary-color); }

.details .name {
    font-weight: 700;
    font-size: 0.95rem;
    display: block;
    line-height: 1.2;
}

.captured-pieces {
    height: 20px;
    display: flex;
    font-size: 12px;
    color: #666;
}

/* TIMERS */
.timer-display {
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: 900;
    background: #263238;
    color: #00E676; /* Дигитално зелено */
    padding: 2px 10px;
    border-radius: 6px;
    min-width: 80px;
    text-align: center;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.low-time { color: #FF5252; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.5; } }

/* 2. BOARD CONTAINER */
.board-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 5px;
    background: #e0e0e0;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

.game-meta-bar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}

.game-meta-bar span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6d6d6d;
    display: block;
}

.game-meta-bar strong {
    font-size: 0.95rem;
    color: #2b2b2b;
    font-weight: 700;
}
.chess-canvas {
    width: 100%;
    max-width: 95vw; /* Почти цялата ширина на екрана */
    aspect-ratio: 1/1; /* Винаги квадрат */
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    background-color: white; /* Fallback */
    touch-action: none; /* Важно: спира скролирането докато местиш фигури */
}

/* Overlay (Game Over) */
.game-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: 0.5s;
}

.game-overlay.visible { opacity: 1; pointer-events: auto; }

.overlay-content {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    text-align: center;
    animation: zoomIn 0.5s;
    width: 80%;
}

.trophy-icon { font-size: 4rem; color: #FFC107; margin-bottom: 1rem; }
.hidden { display: none; }

@keyframes zoomIn { from {transform: scale(0.5);} to {transform: scale(1);} }


/* 3. CONTROL DOCK (BOTTOM) */
.game-controls-dock {
    background: white;
    padding: 10px 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
}

.game-controls-dock .control-btn {
    transition: transform 0.2s;
}

.game-controls-dock .control-btn:active {
    transform: scale(0.95);
}

.control-btn {
    width: 45px; height: 45px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: #555;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
}

.control-btn:hover { background: #e0e0e0; }

.big-action {
    width: 55px; height: 55px;
    background: var(--primary-color);
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(139, 115, 85, 0.4);
}

.move-indicator-pill {
    background: #eee;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #777;
    transition: 0.3s;
}

/* Когато е твой ред */
.my-turn .move-indicator-pill {
    background: #4CAF50;
    color: white;
    box-shadow: 0 0 10px #4CAF50;
}


/* --- BOTTOM SHEETS (MODALS) --- */
.bottom-sheet {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2000;
    visibility: hidden;
    transition: 0.3s;
}

.bottom-sheet.active { visibility: visible; }

.sheet-backdrop {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: 0.3s;
}

.bottom-sheet.active .sheet-backdrop { opacity: 1; }

.sheet-content {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: white;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bottom-sheet.active .sheet-content { transform: translateY(0); }

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-sheet {
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
}

.menu-grid {
    display: grid;
    gap: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 12px;
    font-weight: 600;
    color: #333;
    border: none;
    width: 100%;
    cursor: pointer;
    text-decoration: none;
}

.menu-item i { margin-right: 10px; width: 20px; text-align: center; }

.menu-item.danger { color: #F44336; background: #FFEBEE; }
.menu-item.warning { color: #FF9800; background: #FFF3E0; }

.move-history-list {
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.move-row {
    padding: 5px;
    background: #f0f0f0;
    margin-bottom: 2px;
}

@media (max-width: 640px) {
    .game-arena {
        height: auto;
        min-height: calc(100vh - 60px);
        padding: 8px;
    }

    .player-zone {
        margin: 6px 6px;
    }

    .board-container {
        padding: 4px;
    }

    .game-controls-dock {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding-bottom: 16px;
    }

    .move-indicator-pill {
        order: 3;
        flex: 1 1 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .game-controls-dock .control-btn {
        width: 42px;
        height: 42px;
    }

    .timer-display {
        font-size: 1.1rem;
    }
}
