*, *::before, *::after {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f4f6f8;
    color: #333;
}

.top-panel {
    position: fixed;   
    top: 0; left: 0;           
    width: 100%;       
    height: 70px;   
    background-color: #fff;
    z-index: 1000;
    display: flex;
    justify-content: space-between; 
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);     
}

.logo {
    color: #333; 
    font-weight: 800;
    font-size: 24px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.input-div {
    border: 2px solid #e67e22;
    border-radius: 8px; 
    display: flex;
    align-items: center; 
    overflow: hidden;
    background-color: #fff;
    min-width: 250px;
    transition: all 0.3s ease;
}

.top-panel-input {
    border: none;
    outline: none;
    background: transparent;
    height: 40px;            
    flex-grow: 1;
    padding-left: 15px;
    font-size: 16px;         
}

.search-btn {
    border: none;
    outline: none;
    background-color: #e67e22;
    color: white;
    height: 40px;
    width: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-link, .profile-container {
    width: 120px;
    height: 44px;
    min-width: 120px;
    max-width: 120px;
    padding: 0;
    background-color: transparent;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    border: 2px solid #e67e22;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.login-link:hover {
    background-color: #e67e22;
    color: white;
}

.btn-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.profile-name, .profile-id {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    white-space: nowrap;
}

.profile-name { opacity: 1; transform: translateY(0); }
.profile-id { opacity: 0; transform: translateY(100%); color: #e67e22; }

.profile-container:hover .profile-name { opacity: 0; transform: translateY(-100%); }
.profile-container:hover .profile-id { opacity: 1; transform: translateY(0); }

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 100px; 
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 40px;
}

.action-buttons {
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn { 
    display: inline-block;
    padding: 14px 28px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    color: white;
    border-radius: 8px; 
    font-weight: bold;
    min-width: 200px;
    text-align: center;
    transition: background 0.2s;
}

.btn-create { background-color: #27ae60; }
.btn-connect { background-color: #2980b9; }

.section-title {
    color: #2c3e50;
    font-size: 28px;
    margin-bottom: 30px;
    font-weight: 700;
}

.quizzes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 5px;
}

.quiz-card {
    background-color: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 2px solid transparent;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.quiz-card:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-color: #e67e22;
}

.quiz-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #eee;
}

.quiz-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.quiz-title {
    color: #2c3e50;
    font-size: 20px;
    margin: 0 0 15px 0;
    font-weight: 700;
    line-height: 1.3;
}

.quiz-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.tag {
    font-size: 11px;
    background: #f0f0f0;
    color: #555;
    padding: 2px 6px;
    border-radius: 4px;
}

.quiz-desc {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.quiz-play-btn {
    margin-top: auto;
    background-color: #e67e22;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    font-size: 15px;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-window {
    background-color: white;
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    text-align: left;
    position: relative;
}

.close-icon {
    position: absolute;
    top: 20px; right: 25px;
    font-size: 32px;
    color: #aaa;
    cursor: pointer;
}

.modal-input, .modal-submit-btn {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 16px;
}

.modal-submit-btn {
    background-color: #e67e22;
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.code-inputs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.code-box {
    width: 40px;
    height: 50px;
    font-size: 24px;
    text-align: center;
    border: 2px solid #eee;
    border-radius: 8px;
}

@media (max-width: 900px) {
    .input-div {
        min-width: 150px;
    }
}

@media (max-width: 600px) {
    .top-panel {
        padding: 0 15px;
        height: 60px;
    }

    .logo {
        font-size: 20px;
    }
    
    .main-content {
        padding-top: 80px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .quizzes-grid {
        gap: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 500px) {
    .input-div {
        display: none;
    }

    .top-panel {
        justify-content: space-between;
    }
    
    .login-link span {
        display: none;
    }
    
    .quizzes-grid {
        gap: 10px;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .quiz-image {
        height: 100px;
    }
    
    .quiz-title { font-size: 15px; margin-bottom: 5px; }
    .quiz-desc { font-size: 11px; -webkit-line-clamp: 1; }
    .tag { font-size: 9px; }
    .quiz-play-btn { padding: 8px; font-size: 13px; }
}

.mail-icon-swing {
    display: block;
    width: 280px;
    height: 280px;
    max-width: 80%;
    object-fit: contain;
    margin: 10px auto 35px;
}

.site-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #eaeaea;
    padding: 40px 0 20px;
    margin-top: auto;
    width: 100%;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links {
    display: flex;
    gap: 25px;
}

.footer-link {
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #e67e22;
    text-decoration: underline;
}

.footer-copyright {
    color: #888;
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 600px) {
    .site-footer {
        padding: 20px 0;
        text-align: center;
    }

    .footer-container {
        flex-direction: column;
        justify-content: center;
        gap: 15px;
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-copyright {
        margin-top: 10px;
    }
}

/* --- COOKIE БАННЕР --- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    border-top: 2px solid #e67e22;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    z-index: 9999;
    padding: 20px;
    display: none;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-content p {
    margin: 0;
    font-size: 14px;
    color: #555;
    flex-grow: 1;
    line-height: 1.5;
}

.cookie-content a {
    color: #e67e22;
    text-decoration: underline;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-cookie {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-cookie.accept {
    background-color: #27ae60;
    color: white;
}

.btn-cookie.accept:hover {
    background-color: #219150;
}

.btn-cookie.decline {
    background-color: #f0f0f0;
    color: #333;
}

.btn-cookie.decline:hover {
    background-color: #e0e0e0;
}

@media (max-width: 600px) {
    .cookie-banner {
        padding: 15px;
    }

    .cookie-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }

    .btn-cookie {
        flex-grow: 1;
        text-align: center;
    }
}