/* Сине-голубой дизайн МШП */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none !important;
}

:root {
    /* Палитра МШП */
    --primary: #1E88E5;
    --primary-dark: #1565C0;
    --primary-light: #7DD3FC;
    --secondary: #06B6D4;
    --accent: #F59E0B;
    
    /* Фоновые цвета */
    --bg-dark: #EAF7FF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #D8F0FF;
    
    /* Текст */
    --text-primary: #10213B;
    --text-secondary: #56708F;
    --text-muted: #6A7D95;
    
    /* Статусы */
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    /* Тени */
    --shadow-sm: 0 2px 8px rgba(16, 62, 111, 0.08);
    --shadow-md: 0 8px 24px rgba(16, 62, 111, 0.12);
    --shadow-lg: 0 18px 48px rgba(16, 62, 111, 0.16);
    --shadow-glow: 0 10px 28px rgba(30, 136, 229, 0.28);
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    background-image:
        linear-gradient(115deg, rgba(218, 247, 255, 0.9) 0%, rgba(229, 242, 255, 0.94) 48%, rgba(207, 225, 255, 0.9) 100%);
    background-attachment: fixed;
    text-decoration: none !important;
}

body:has(.home-page-shell) {
    overflow: hidden;
}

.container {
    max-width: 2000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Навигация */
.navbar {
    background: rgba(7, 28, 57, 0.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(125, 211, 252, 0.18);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);

}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 20px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.mshp-logo {
    width: 154px;
    height: auto;
    display: block;
    border-radius: 0;
    flex-shrink: 0;
}

.nav-brand .logo {
    font-size: 1.35rem;
    font-weight: 700;
    color: #F8FCFF;
    background: none;
    -webkit-text-fill-color: currentColor;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    filter: none;
    text-decoration: none !important;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: rgba(226, 241, 255, 0.78);
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(30, 136, 229, 0.2), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover {
    color: #FFFFFF;
    background: rgba(125, 211, 252, 0.14);
    transform: translateY(-2px);
}

.nav-link.admin-link {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.nav-link.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.24);
}

.nav-link.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(30, 136, 229, 0.5);
}

/* Главный контент */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 1.5rem 0 2rem;
}

/* Hero секция */
.hero {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(219, 244, 255, 0.96) 100%);
    backdrop-filter: blur(20px);
    border-radius: 8px;
    padding: 3.2rem 2rem;
    text-align: center;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(30, 136, 229, 0.18);
    position: relative;
    overflow: hidden;
}

.hero::before {
    display: none;
}

.hero-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1.2rem;
    position: relative;
    z-index: 1;
}

.hero-logo-mark {
    width: min(360px, 82vw);
    aspect-ratio: 889 / 218;
    background: linear-gradient(135deg, #0B5CAD 0%, #1E88E5 45%, #06B6D4 100%);
    mask: url("../img/mshp-logo.92b52fa83f0e.png") center / contain no-repeat;
    -webkit-mask: url("../img/mshp-logo.92b52fa83f0e.png") center / contain no-repeat;
    filter: drop-shadow(0 14px 26px rgba(30, 136, 229, 0.2));
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hero-title {
    font-size: 3rem;
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
    background: none;
    color: #0B2240;
    -webkit-text-fill-color: currentColor;
    font-weight: 700;
    position: relative;
    z-index: 1;
    animation: none;
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(30, 136, 229, 0.5)); }
    50% { filter: drop-shadow(0 0 40px rgba(6, 182, 212, 0.8)); }
}

.hero-subtitle {
    font-size: 1.3rem;
    color: #476684;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.student-register-note {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.student-register-note a {
    color: #0B5CAD;
    font-weight: 600;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

/* Кнопки */
.btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 40px rgba(30, 136, 229, 0.6);
}

.btn-secondary {
    background: rgba(30, 136, 229, 0.2);
    color: var(--primary-light);
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: rgba(30, 136, 229, 0.3);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #DC2626 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #2563EB 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-large {
    padding: 1.2rem 2.5rem;
    font-size: 1.1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
}

/* Features */
.features {
    margin: 4rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 25px;
    text-align: center;
    border: 1px solid rgba(30, 136, 229, 0.2);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(30, 136, 229, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.feature-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(30, 136, 229, 0.5));
    animation: float 3s ease-in-out infinite;
}
.feature-icon-1 {
    font-size: 2rem;
    margin-bottom: 0rem;
    filter: drop-shadow(0 0 10px rgba(30, 136, 229, 0.5));

}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-light);
    font-size: 1.3rem;
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Квизы */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.quiz-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid rgba(30, 136, 229, 0.2);
    position: relative;
    overflow: hidden;
}

.quiz-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--primary);
    transition: width 0.4s;
}

.quiz-card:hover::after {
    width: 100%;
    opacity: 0.1;
}

.quiz-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.quiz-header h3 {
    flex: 1;
    margin-right: 1rem;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.quiz-questions-count {
    background: rgba(30, 136, 229, 0.2);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--primary-light);
    border: 1px solid rgba(30, 136, 229, 0.3);
    white-space: nowrap;
}

.quiz-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.quiz-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(30, 136, 229, 0.2);
}

.quiz-author {
    color: var(--text-secondary);
}

/* Все остальные стили продолжаются так же... */
/* ПРОДОЛЖЕНИЕ CSS - Forms, Tables, Modals, Profile, Results... */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.auth-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    border: 1px solid rgba(30, 136, 229, 0.3);
}

.auth-title {
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-group {
    margin-bottom: 1.8rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.7rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 1rem;
    border: 2px solid rgba(30, 136, 229, 0.3);
    border-radius: 15px;
    font-size: 1rem;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 20px rgba(30, 136, 229, 0.3);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-errors {
    color: #B91C1C;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.18);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: .85rem 1rem;
}

.form-errors ul {
    margin: .45rem 0 0 1.2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    color: var(--secondary);
}

.flash-messages {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.alert {
    padding: 1.2rem 1.8rem;
    border-radius: 15px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid;
    animation: slideInRight 0.4s;
}

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
    border-color: rgba(16, 185, 129, 0.5);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    border-color: rgba(239, 68, 68, 0.5);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
    border-color: rgba(59, 130, 246, 0.5);
}

.close-alert {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.close-alert:hover {
    opacity: 1;
    transform: translateY(-50%) rotate(90deg);
}

.footer {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 2.5rem 0;
    text-align: center;
    margin-top: 4rem;
    border-top: 1px solid rgba(30, 136, 229, 0.2);
}

.footer p {
    color: var(--text-secondary);
}

.text-center {
    text-align: center;
}

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary) 100%);
}

::selection {
    background: rgba(30, 136, 229, 0.3);
    color: var(--text-primary);
}

@media (max-width: 968px) {
    .nav-menu { flex-wrap: wrap; gap: 0.5rem; }
    .hero-title { font-size: 2.5rem; }
    .quiz-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .hero-title { font-size: 2rem; }
    .section-title { font-size: 2rem; }
}



.quizzes-page {
    max-width: 2000px;
    margin: 0 auto;
    padding: 2rem 0;
}

.quizzes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.quizzes-title {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* Панель управления */
.quizzes-controls {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(30, 136, 229, 0.3);
    border: 1px solid rgba(30, 136, 229, 0.3);
}

/* Поиск */
.search-form {
    margin-bottom: 1.5rem;
}

.search-container {
    display: flex;
    gap: 1rem;
    position: relative;
    max-width: 600px;
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid rgba(30, 136, 229, 0.3);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(30, 136, 229, 0.3);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Poppins', sans-serif;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 136, 229, 0.5);
}

.search-clear {
    position: absolute;
    right: 170px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 1.2rem;
}

.search-clear:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: translateY(-50%) scale(1.1);
}

/* Сортировка */
.sort-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.sort-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.sort-btn {
    padding: 0.7rem 1.5rem;
    background: rgba(30, 136, 229, 0.1);
    color: var(--text-secondary);
    border: 0px solid rgba(30, 136, 229, 0.2);
    border-radius: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
}

.sort-btn:hover {
    background: rgba(30, 136, 229, 0.2);
    transform: translateY(-2px);
}

.sort-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(30, 136, 229, 0.4);
}

/* Сетка квизов */
.quizzes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* Компактная карточка квиза */
.quiz-card-compact {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.8rem;
    box-shadow: 0 4px 16px rgba(30, 136, 229, 0.2);
    transition: all 0.3s;
    border: 1px solid rgba(30, 136, 229, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quiz-card-compact:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(30, 136, 229, 0.3);
    border-color: var(--primary);
}

.quiz-compact-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
}

.quiz-compact-title {
    flex: 1;
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

.quiz-compact-count {
    background: rgba(30, 136, 229, 0.2);
    color: var(--primary-light);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    white-space: nowrap;
    border: 1px solid rgba(30, 136, 229, 0.3);
}

.quiz-compact-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.quiz-compact-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-top: 0.5rem;
    border-top: 1px solid rgba(30, 136, 229, 0.1);
}

.quiz-stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.quiz-compact-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: auto;
}

.quiz-compact-actions .btn {
    flex: 1;
}

/* Пустое состояние */
.quizzes-empty {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 4rem 2rem;
    text-align: center;
    border: 2px dashed rgba(30, 136, 229, 0.3);
    margin: 3rem 0;
}

.quizzes-empty .empty-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.quizzes-empty h3 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.quizzes-empty p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ============================================
   СТРАНИЦА СОЗДАНИЯ КВИЗА
   ============================================ */

.create-quiz-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 0;
}

.create-quiz-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2.5rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.create-quiz-form {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 3rem;
    box-shadow: 0 8px 32px rgba(30, 136, 229, 0.3);
    border: 1px solid rgba(30, 136, 229, 0.3);
}

.form-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 2px solid rgba(30, 136, 229, 0.1);
}

.form-section:last-of-type {
    border-bottom: none;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
    color: var(--primary-light);
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Карточки тем */
.theme-section {
    border-bottom: 2px solid rgba(30, 136, 229, 0.2);
}

.theme-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.theme-card {
    background: rgba(255, 255, 255, 0.5);
    border: 3px solid rgba(30, 136, 229, 0.2);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.theme-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(30, 136, 229, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.theme-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(30, 136, 229, 0.3);
}

.theme-card:hover::before {
    opacity: 1;
}

.theme-radio {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.theme-radio:checked + .theme-content {
    position: relative;
}

.theme-radio:checked ~ .theme-checkmark {
    opacity: 1;
    transform: scale(1);
}

.theme-card:has(.theme-radio:checked) {
    border-color: var(--primary);
    background: rgba(30, 136, 229, 0.15);
    box-shadow: 0 0 30px rgba(30, 136, 229, 0.4);
}

.theme-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.theme-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(30, 136, 229, 0.5));
}

.theme-name {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.theme-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.theme-checkmark {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.color-picker input[type="color"] {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(30, 136, 229, 0.3);
}

.color-presets {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.color-preset {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
}

.color-preset:hover {
    transform: scale(1.15);
    border-color: white;
    box-shadow: 0 4px 15px rgba(30, 136, 229, 0.4);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-actions .btn {
    flex: 1;
}



@media (max-width: 768px) {
    .quizzes-grid {
        grid-template-columns: 1fr;
    }

    .quizzes-header {
        flex-direction: column;
        align-items: stretch;
    }

    .quizzes-title {
        font-size: 2rem;
        text-align: center;
    }

    .search-container {
        flex-direction: column;
        max-width: 100%;
    }

    .search-clear {
        right: 15px;
    }

    .sort-buttons {
        justify-content: center;
    }

    .quiz-compact-actions {
        flex-direction: column;
    }

    .create-quiz-form {
        padding: 2rem 1.5rem;
    }

    .theme-cards {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .quizzes-controls {
        padding: 1.5rem;
    }

    .sort-btn {
        flex: 1;
        min-width: 100px;
    }
}

/* create_quizez */
.cq-wrapper{max-width:780px;margin:0 auto;padding:2rem 0}
.cq-header{text-align:center;margin-bottom:2rem}
.cq-title{font-size:2.2rem;font-weight:700;background:linear-gradient(135deg,#7DD3FC,#06B6D4);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}
.cq-subtitle{color:var(--text-secondary);margin-top:.4rem}
.cq-title-card{padding:1.8rem;margin-bottom:1.5rem}
.cq-label{display:block;font-weight:600;color:var(--text-primary);margin-bottom:.7rem;font-size:.95rem}
.cq-add-row{text-align:center;margin:1.5rem 0}
.cq-submit-row{text-align:center;margin-top:2rem}
.q-block{background:rgba(255,255,255,.8);border:1px solid rgba(30,136,229,.2);border-radius:20px;padding:1.8rem;margin-bottom:1.5rem;position:relative}
.q-block-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.2rem}
.q-block-title{font-size:1rem;font-weight:600;color:var(--primary-light)}
.q-remove-btn{background:rgba(239,68,68,.15);border:1px solid rgba(239,68,68,.3);color:#EF4444;border-radius:10px;padding:.3rem .8rem;cursor:pointer;font-size:.85rem;transition:all .2s}
.q-remove-btn:hover{background:rgba(239,68,68,.3)}
.q-row{margin-bottom:1rem}
.q-row label{display:block;font-size:.85rem;color:var(--text-secondary);margin-bottom:.4rem;font-weight:500}
.q-select,.q-input{width:100%;padding:.8rem 1rem;background:rgba(255,255,255,.5);border:2px solid rgba(30,136,229,.25);border-radius:12px;color:var(--text-primary);font-family:'Poppins',sans-serif;font-size:.95rem;transition:all .3s}
.q-select:focus,.q-input:focus{outline:none;border-color:var(--primary);box-shadow:0 0 15px rgba(30,136,229,.2)}
.q-select option{background:#FFFFFF}
.answers-grid{display:grid;grid-template-columns:1fr 1fr;gap:.8rem}
@media(max-width:500px){.answers-grid{grid-template-columns:1fr}}
.answer-row{display:flex;align-items:center;gap:.6rem;background:rgba(30,136,229,.07);border:1px solid rgba(30,136,229,.15);border-radius:12px;padding:.6rem .8rem}
.answer-row input[type=radio],.answer-row input[type=checkbox]{width:18px;height:18px;accent-color:var(--primary);cursor:pointer;flex-shrink:0}
.answer-row .ans-label{font-size:.8rem;color:var(--primary-light);font-weight:600;min-width:16px}
.answer-row .q-input{margin:0;border:none;background:transparent;padding:.3rem .4rem}
.answer-row .q-input:focus{box-shadow:none}
.time-opts{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:.4rem}
.time-opt{display:none}
.time-opt + label{padding:.4rem .9rem;background:rgba(30,136,229,.1);border:1px solid rgba(30,136,229,.2);border-radius:10px;cursor:pointer;font-size:.85rem;color:var(--text-secondary);transition:all .2s}
.time-opt:checked + label{background:rgba(30,136,229,.3);border-color:var(--primary);color:var(--primary-light);font-weight:600}
.text-hint{color:var(--text-muted);font-style:italic;font-size:.9rem;padding:.8rem;background:rgba(30,136,229,.05);border-radius:10px;border:1px dashed rgba(30,136,229,.2)}



/* lobby */
.lobby-wrapper{max-width:800px;margin:0 auto;padding:2rem 0}
.lobby-header{text-align:center;margin-bottom:2rem}
.lobby-title{font-size:2.2rem;font-weight:700;background:linear-gradient(135deg,#7DD3FC,#06B6D4);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;margin-bottom:.5rem}
.lobby-meta{color:var(--text-secondary)}
.lobby-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:1.5rem}
@media(max-width:600px){.lobby-grid{grid-template-columns:1fr}}
.lobby-pin-card,.lobby-status-card{padding:1.8rem}
.pin-label{font-size:.8rem;text-transform:uppercase;letter-spacing:.1em;color:var(--text-muted);margin-bottom:.5rem}
.pin-code{font-size:3.5rem;font-weight:700;letter-spacing:.3em;background:linear-gradient(135deg,#7DD3FC,#06B6D4);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;margin-bottom:1rem}
.join-link-row{display:flex;align-items:center;gap:.8rem;flex-wrap:wrap}
.join-link-text{font-size:.75rem;color:var(--text-muted);word-break:break-all;flex:1}
.status-row{display:flex;align-items:center;justify-content:space-between;padding:1rem 0;border-bottom:1px solid rgba(30,136,229,.1)}
.status-row:last-child{border-bottom:none}
.status-label{color:var(--text-secondary);font-size:.9rem}
.status-value{font-size:2rem;font-weight:700;color:var(--primary-light)}
.status-max{color:var(--text-muted);font-size:1.1rem}
.lbadge{display:inline-block;padding:.3rem .9rem;border-radius:20px;font-size:.85rem;font-weight:600}
.lbadge-success{background:rgba(16,185,129,.2);color:#10B981;border:1px solid rgba(16,185,129,.3)}
.lbadge-danger{background:rgba(239,68,68,.2);color:#EF4444;border:1px solid rgba(239,68,68,.3)}
.players-section{padding:1.8rem;margin-bottom:1.5rem}
.section-title{font-size:1.1rem;font-weight:600;color:var(--text-primary);margin-bottom:1rem}
.players-list{list-style:none;display:flex;flex-wrap:wrap;gap:.7rem}
.players-empty{color:var(--text-muted);font-style:italic}
.player-chip{background:rgba(30,136,229,.15);border:1px solid rgba(30,136,229,.3);border-radius:20px;padding:.4rem 1rem;font-size:.9rem;color:var(--text-primary)}
.lobby-actions{display:flex;gap:1rem;flex-wrap:wrap;justify-content:center}


/* my_quizez */
.mq-wrapper {
    max-width: 2000px;
    margin: 0 auto;
    padding: 2.5rem 0 4rem;
}

.mq-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.mq-title {
    font-size: 2.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #B7E6FF 0%, #06B6D4 60%, #F59E0B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin-bottom: .3rem;
    letter-spacing: 0;
}

.mq-subtitle {
    color: var(--text-muted);
    font-size: .95rem;
}

.mq-create-btn {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1rem;
    padding: .9rem 1.8rem;
}

.mq-create-icon {
    font-size: 1.1rem;
}

.mq-stats-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(30, 136, 229, .06);
    border: 1px solid rgba(30, 136, 229, .15);
    border-radius: 16px;
    padding: 1rem 1.6rem;
    margin-bottom: 2rem;
    width: fit-content;
}

.mq-stat {
    display: flex;
    align-items: baseline;
    gap: .4rem;
}

.mq-stat-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-light);
    line-height: 1;
}

.mq-stat-label {
    font-size: .8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.mq-stat-divider {
    width: 1px;
    height: 2rem;
    background: rgba(30, 136, 229, .2);
}

.mq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.4rem;
}

.mq-card {
    position: relative;
    background: rgba(22, 22, 42, .9);
    border: 1px solid rgba(30, 136, 229, .18);
    border-radius: 22px;
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
    gap: .9rem;
    overflow: hidden;
    transition: transform .25s, border-color .25s, box-shadow .25s;
    cursor: default;
}

.mq-card:hover {
    transform: translateY(-5px);
    border-color: rgba(30, 136, 229, .5);
    box-shadow: 0 12px 40px rgba(30, 136, 229, .22);
}

.mq-card-glow {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(30, 136, 229, .18) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    transition: opacity .3s;
    opacity: 0;
}

.mq-card:hover .mq-card-glow {
    opacity: 1;
}

.mq-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mq-card-num {
    font-size: .75rem;
    font-weight: 700;
    color: rgba(30, 136, 229, .4);
    letter-spacing: .12em;
    font-variant-numeric: tabular-nums;
}

.mq-badge {
    font-size: .72rem;
    font-weight: 600;
    padding: .25rem .7rem;
    border-radius: 20px;
    letter-spacing: .04em;
}

.mq-badge-pub {
    background: rgba(16, 185, 129, .15);
    color: #6EE7B7;
    border: 1px solid rgba(16, 185, 129, .25);
}

.mq-badge-draft {
    background: rgba(245, 158, 11, .12);
    color: #FCD34D;
    border: 1px solid rgba(245, 158, 11, .2);
}

.mq-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
}

.mq-card-desc {
    font-size: .85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

.mq-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    padding-top: .6rem;
    border-top: 1px solid rgba(30, 136, 229, .1);
}

.mq-meta-item {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .78rem;
    color: var(--text-muted);
    background: rgba(30, 136, 229, .07);
    padding: .25rem .6rem;
    border-radius: 8px;
}

.mq-meta-icon {
    font-size: .85rem;
}

.mq-card-actions {
    display: flex;
    gap: .6rem;
    margin-top: .2rem;
}

.mq-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem;
    border-radius: 12px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all .2s;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    border: none;
}

.mq-btn-play {
    background: rgba(30, 136, 229, .15);
    color: var(--primary-light);
    border: 1px solid rgba(30, 136, 229, .25);
}

.mq-btn-play:hover {
    background: rgba(30, 136, 229, .3);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.mq-btn-lobby {
    background: rgba(6, 182, 212, .12);
    color: #F9A8D4;
    border: 1px solid rgba(6, 182, 212, .22);
}

.mq-btn-lobby:hover {
    background: rgba(6, 182, 212, .25);
    border-color: var(--secondary);
    transform: translateY(-2px);
}

.mq-empty {
    padding: 5rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.mq-empty-visual {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .5rem;
}

.mq-empty-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid rgba(30, 136, 229, .2);
    animation: mqRingPulse 3s ease-in-out infinite;
}

.mq-ring-1 { width: 60px; height: 60px; animation-delay: 0s; }
.mq-ring-2 { width: 90px; height: 90px; animation-delay: .4s; opacity: .7; }
.mq-ring-3 { width: 120px; height: 120px; animation-delay: .8s; opacity: .4; }

@keyframes mqRingPulse {
    0%, 100% { transform: scale(1); opacity: .6; }
    50% { transform: scale(1.06); opacity: 1; }
}

.mq-empty-icon {
    font-size: 2.6rem;
    z-index: 1;
}

.mq-empty-title {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mq-empty-sub {
    color: var(--text-muted);
    font-size: .95rem;
    margin-bottom: .8rem;
}


/* Дополнительные стили для страницы профиля */
.profile-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0;
}

.profile-card-main {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 3rem;
    box-shadow: 0 8px 32px rgba(30, 136, 229, 0.3);
    border: 1px solid rgba(30, 136, 229, 0.3);
    margin-bottom: 2rem;
}

.profile-user-info {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid rgba(30, 136, 229, 0.2);
}

.profile-avatar-large {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1E88E5 0%, #06B6D4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    font-weight: 700;
    box-shadow: 0 0 30px rgba(30, 136, 229, 0.5);
    border: 0px solid rgba(30, 136, 229, 0.3);
}

.profile-user-details {
    flex: 1;
}

.profile-username {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #7DD3FC 0%, #06B6D4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-email {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.profile-joined {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.profile-stat-card {
    background: linear-gradient(135deg, rgba(30, 136, 229, 0.2) 0%, rgba(6, 182, 212, 0.2) 100%);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    border: 1px solid rgba(30, 136, 229, 0.3);
    transition: all 0.3s;
}

.profile-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(30, 136, 229, 0.4);
}

.profile-stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.profile-stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.profile-stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.profile-history-section {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(30, 136, 229, 0.3);
    border: 1px solid rgba(30, 136, 229, 0.3);
    margin-bottom: 2rem;
}

.profile-section-title {
    font-size: 1.8rem;
    margin-bottom: 0;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.profile-quiz-history {
    display: grid;
    gap: 1rem;
}

.profile-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    border: 1px solid rgba(30, 136, 229, 0.2);
    transition: all 0.3s;
}

.profile-history-item:hover {
    background: rgba(30, 136, 229, 0.1);
    transform: translateX(5px);
}

.profile-history-info {
    flex: 1;
}

.profile-history-title {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.profile-history-date {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.profile-history-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-score-badge {
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.profile-status-badge {
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.status-progress {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.profile-empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.profile-empty-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.profile-category-stats {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(30, 136, 229, 0.3);
    border: 1px solid rgba(30, 136, 229, 0.3);
    margin-bottom: 2rem;
}

.profile-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.profile-category-card {
    background: rgba(255, 255, 255, 0.5);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid rgba(30, 136, 229, 0.2);
}

.profile-category-card h4 {
    margin-bottom: 1rem;
    color: var(--primary-light);
}

.profile-category-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.profile-achievements {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(30, 136, 229, 0.3);
    border: 1px solid rgba(30, 136, 229, 0.3);
    margin-bottom: 2rem;
}

.profile-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1.5rem;
}

.profile-achievement {
    background: rgba(255, 255, 255, 0.5);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(30, 136, 229, 0.2);
    position: relative;
    transition: all 0.3s;
}

.profile-achievement.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.profile-achievement.unlocked {
    border-color: var(--success);
}

.profile-achievement.unlocked:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.profile-achievement-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.profile-achievement-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-achievement-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
}

.profile-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
    gap: 1.5rem;
    justify-content: center;
    max-width: 100%;
}

.profile-actions .btn {
    min-width: 0;
    white-space: normal;
    text-align: center;
}

/* Адаптивность */
@media (max-width: 768px) {
    .profile-user-info {
        flex-direction: column;
        text-align: center;
    }

    .profile-stats-grid {
        grid-template-columns: 1fr;
    }

    .profile-history-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .profile-history-stats {
        width: 100%;
        justify-content: center;
    }

    .profile-actions {
        flex-direction: column;
    }

    .profile-history-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* all quizzes info modal */
.mq-btn-history{
    background:rgba(59,130,246,.12);
    border:1px solid rgba(59,130,246,.3);
    color:#93C5FD;
}

.mq-btn-history:hover{
    background:rgba(59,130,246,.25);
    border-color:var(--info);
}

.quiz-info-content-template{
    display:none;
}

.quiz-info-popup-title{
    font-size:1.35rem;
    font-weight:700;
    color:#B7E6FF;
    margin-bottom:1rem;
    letter-spacing:.02em;
}

.quiz-info-grid{
    display:flex;
    flex-direction:column;
    gap:.8rem;
}

.quiz-info-quiz-title{
    font-size:1.65rem;
    font-weight:700;
    color:var(--text-primary);
    margin-bottom:1rem;
    line-height:1.35;
}

.quiz-info-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:1rem;
    padding:.75rem .85rem;
    border-radius:12px;
    background:rgba(30,136,229,.08);
}

.quiz-info-label{
    font-size:1.15rem;
    color:var(--text-muted);
}

.quiz-info-value{
    font-size:1.15rem;
    color:var(--text-primary);
    text-align:right;
    font-weight:600;
}

.quiz-info-modal-backdrop{
    position:fixed;
    inset:0;
    background:rgba(5,8,18,.72);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:1.2rem;
    z-index:2500;
    opacity:0;
    pointer-events:none;
    transition:opacity .2s ease;
}

.quiz-info-modal-backdrop.is-open{
    opacity:1;
    pointer-events:auto;
}

.quiz-info-modal{
    width:min(900px, 100%);
    max-height:90vh;
    overflow:auto;
    background:linear-gradient(160deg, rgba(14,21,44,.98), rgba(12,16,34,.98));
    border:1px solid rgba(30,136,229,.42);
    border-radius:20px;
    box-shadow:0 30px 60px rgba(0,0,0,.45);
    padding:1.8rem;
    position:relative;
}

.quiz-info-close-btn{
    position:absolute;
    top:.9rem;
    right:.9rem;
    border:1px solid rgba(30,136,229,.35);
    background:rgba(30,136,229,.12);
    color:var(--text-primary);
    width:40px;
    height:40px;
    border-radius:10px;
    cursor:pointer;
    font-size:1.1rem;
    font-weight:700;
    transition:all .2s;
}

.quiz-info-close-btn:hover{
    background:rgba(30,136,229,.28);
    transform:translateY(-1px);
}

@media (max-width: 768px){
    .quiz-info-modal{
        padding:1rem;
    }

    .quiz-info-popup-title{
        font-size:1.15rem;
    }

    .quiz-info-quiz-title{
        font-size:1.35rem;
    }

    .quiz-info-label,
    .quiz-info-value{
        font-size:1rem;
    }

    .quiz-info-row{
        align-items:flex-start;
        flex-direction:column;
        gap:.35rem;
    }
}



/* ===== Виджет входа по коду ===== */
.join-code-block {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: fadeInUp 0.6s ease both;
    animation-delay: 0.2s;
}

.join-code-label {
    color: #fff;
    font-size: 1.45rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.01em;
    text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.join-code-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 60px;
    padding: 0.5rem 0.5rem 0.5rem 1.6rem;
    backdrop-filter: blur(10px);
    transition: border-color 0.25s, box-shadow 0.25s;
}

.join-code-form:focus-within {
    border-color: var(--primary, #6C63FF);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.22);
}

.join-code-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    align-items: flex-start;
}

.join-code-input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    width: 210px;
    line-height: 1.2;
}

.join-code-input::placeholder {
    color: rgba(255, 255, 255, 0.28);
    font-weight: 400;
    letter-spacing: 0.18em;
}

.join-code-hint {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    line-height: 1;
    padding-left: 0;
    text-align: left;
}

.join-code-btn {
    border-radius: 50px !important;
    padding: 0.75rem 1.8rem !important;
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    white-space: nowrap;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
    .join-code-label {
        font-size: 1.15rem;
    }
    .join-code-form {
        flex-direction: column;
        border-radius: 20px;
        padding: 1rem 1.2rem;
        width: 100%;
        max-width: 320px;
    }
    .join-code-input-wrap {
        width: 100%;
    }
    .join-code-input {
        width: 100%;
        text-align: center;
        font-size: 1.3rem;
    }
    .join-code-hint {
        text-align: center;
    }
    .join-code-btn {
        width: 100%;
    }
}

/* ===== MSHP theme polish ===== */
.section-title,
.quizzes-title,
.auth-title,
.cq-title,
.lobby-title,
.pin-code,
.mq-title,
.profile-username,
.profile-section-title,
.quiz-info-popup-title,
.hs-title,
.sr-title,
.tr-title {
    background: linear-gradient(135deg, #0B5CAD 0%, #0891B2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0;
}

.feature-card,
.quiz-card,
.quiz-card-compact,
.auth-card,
.quizzes-controls,
.empty-state,
.create-quiz-card,
.cq-card,
.lobby-card,
.players-section,
.mq-card,
.mq-stats-bar,
.profile-card-main,
.profile-history-section,
.profile-category-stats,
.profile-category-card,
.profile-achievements,
.profile-achievement,
.quiz-info-modal,
.report-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(30, 136, 229, 0.18);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.feature-card:hover,
.quiz-card:hover,
.quiz-card-compact:hover,
.mq-card:hover,
.profile-stat-card:hover {
    border-color: rgba(30, 136, 229, 0.42);
    box-shadow: var(--shadow-lg);
}

.feature-card h3,
.profile-category-card h4 {
    color: #0B5CAD;
}

.feature-icon,
.feature-icon-1,
.ap-stat-icon {
    filter: drop-shadow(0 6px 16px rgba(30, 136, 229, 0.18));
}

.btn,
.search-btn,
.sort-btn,
.mq-btn,
.quiz-info-close-btn,
.form-control,
.search-input {
    border-radius: 8px;
}

.btn-primary,
.search-btn,
.sort-btn.active,
.profile-avatar-large {
    background: linear-gradient(135deg, #1E88E5 0%, #06B6D4 100%);
    color: #FFFFFF;
}

.btn-secondary,
.sort-btn,
.mq-btn-play,
.quiz-questions-count,
.quiz-compact-count,
.player-chip,
.mq-meta-item {
    background: rgba(30, 136, 229, 0.1);
    color: #0B5CAD;
    border-color: rgba(30, 136, 229, 0.24);
}

.form-control,
.search-input {
    background: rgba(255, 255, 255, 0.86);
    color: var(--text-primary);
    border-color: rgba(30, 136, 229, 0.26);
}

.form-control:focus,
.search-input:focus {
    background: #FFFFFF;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.14);
}

.join-code-label {
    color: #0B2240;
    text-shadow: none;
}

.join-code-form {
    background: rgba(248, 252, 255, 0.92);
    border: 1px solid rgba(30, 136, 229, 0.22);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.join-code-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.14);
}

.join-code-input {
    color: #0B2240;
}

.join-code-input::placeholder {
    color: rgba(86, 112, 143, 0.42);
}

.join-code-hint {
    color: #6A7D95;
}

.profile-avatar-large {
    overflow: hidden;
    padding: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: 0 8px 20px rgba(16, 62, 111, 0.14);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.profile-user-info .profile-avatar-large {
    width: 96px;
    height: 96px;
    border-radius: 24px;
}

.profile-empty-hint {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}

@media (max-width: 720px) {
    .navbar .container {
        align-items: flex-start;
        gap: 0.85rem;
    }

    .brand-link {
        gap: 0.65rem;
    }

    .mshp-logo {
        width: 128px;
    }

    .nav-menu {
        justify-content: flex-end;
    }

    .hero-title {
        font-size: 2.25rem;
    }
}

/* ===== MSHP home refinement ===== */
.main-content:has(.home-page-shell) {
    height: calc(100svh - 66px);
    padding: 0;
    overflow: hidden;
}

.home-page-shell {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    isolation: isolate;
}

.home-page-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(30, 136, 229, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 136, 229, .06) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at 50% 42%, black, transparent 72%);
    pointer-events: none;
}

.home-page-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(142deg, rgba(30, 136, 229, .16) 0 18%, transparent 18.2%) left top / 44vw 30vh no-repeat,
        linear-gradient(322deg, rgba(8, 182, 206, .15) 0 20%, transparent 20.2%) right bottom / 38vw 28vh no-repeat,
        linear-gradient(34deg, rgba(255, 255, 255, .36) 0 12%, transparent 12.2%) left bottom / 32vw 24vh no-repeat;
    pointer-events: none;
}

.hero-home {
    width: 100%;
    margin: 0;
    padding: clamp(1.8rem, 4vw, 3.2rem) 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 0;
    box-shadow: none;
    position: relative;
    z-index: 2;
}

.hero-home .container {
    max-width: 1180px;
}

.hero-home .hero-brand {
    margin-bottom: 1.4rem;
}

.hero-home .hero-logo-mark {
    width: min(560px, 86vw);
    aspect-ratio: 2048 / 748;
    background: linear-gradient(135deg, #0B5CAD 0%, #1E88E5 48%, #08B6CE 100%);
    background-size: 240% 100%;
    mask: url("../img/mshp-kviz-logo-mask.6fddbd6655ae.png") center / contain no-repeat;
    -webkit-mask: url("../img/mshp-kviz-logo-mask.6fddbd6655ae.png") center / contain no-repeat;
    filter: drop-shadow(0 16px 28px rgba(30, 136, 229, .18));
    animation: heroGradientFlow 5.5s ease-in-out infinite;
}

.hero-home .hero-title {
    display: grid;
    gap: .45rem;
    max-width: none;
    margin: 0 auto 1.7rem;
    font-size: clamp(1.85rem, 3.05vw, 3rem);
    line-height: 1.05;
    color: #0B2240;
}

.hero-home .hero-title > span:last-child {
    background: linear-gradient(90deg, #0B2240 0%, #0B5CAD 36%, #0891B2 58%, #1E88E5 78%, #0B2240 100%);
    background-size: 240% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: heroGradientFlow 5.5s ease-in-out infinite;
    display: block;
    white-space: nowrap;
}

@keyframes heroGradientFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-title-kicker {
    width: fit-content;
    margin: 0 auto;
    padding: .2rem .85rem .28rem;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(30, 136, 229, .14), rgba(6, 182, 212, .2));
    color: #0B5CAD;
    -webkit-text-fill-color: currentColor;
    font-size: .72em;
}

.hero-home .join-code-block {
    margin-top: 0;
    animation: none;
    opacity: 1;
    transform: none;
    position: relative;
    z-index: 2;
}

.home-mascot {
    position: absolute;
    left: 0;
    right: auto;
    top: auto;
    bottom: 0;
    width: min(470px, 34vw);
    opacity: 1;
    pointer-events: none;
    display: grid;
    justify-items: center;
    gap: .35rem;
    transform: translate(-10%, 9%);
    z-index: 1;
}

.home-mascot img {
    width: 100%;
    display: block;
}

.hero-home .join-code-label {
    color: #315477;
    font-size: 1.05rem;
    font-weight: 600;
}

.hero-home .join-code-form {
    border-radius: 8px;
    transform: translateX(-18px);
}

.hero-home .join-code-form-compact {
    width: min(390px, calc(100vw - 2rem));
    justify-content: space-between;
}

.hero-home .join-code-input-wrap {
    align-items: flex-start;
}

.hero-home .join-code-hint {
    align-self: flex-start;
    padding-left: 0;
    text-align: left;
}

.mshp-logo {
    max-height: 42px;
    object-fit: contain;
}

.quizzes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.mq-btn-disabled {
    cursor: not-allowed;
    opacity: .66;
    background: rgba(86, 112, 143, .1);
    color: var(--text-muted);
    border-color: rgba(86, 112, 143, .18);
}

.mq-btn-danger {
    background: rgba(239, 68, 68, .1);
    color: #B91C1C;
    border-color: rgba(239, 68, 68, .25);
}

.mq-btn-danger:hover {
    background: rgba(239, 68, 68, .16);
    color: #991B1B;
}

.mq-card {
    overflow: hidden;
}

.mq-card-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: .65rem;
    align-items: stretch;
}

.mq-card-actions form {
    min-width: 0;
}

.qd-page {
    max-width: 980px;
    margin: 0 auto;
    padding: 1.4rem 0 2.5rem;
}

.qd-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.qd-actions,
.qd-share-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .65rem;
}

.qd-share-row .btn {
    display: inline-flex;
    align-items: center;
    min-width: 138px;
    justify-content: center;
    white-space: nowrap;
}

.qd-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, .72fr);
    gap: 1.25rem;
    align-items: start;
    padding: 1.4rem;
}

.qd-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: .6rem;
    padding: .28rem .65rem;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 800;
}

.qd-status-active {
    background: rgba(34, 197, 94, .14);
    color: #047857;
}

.qd-status-draft {
    background: rgba(245, 158, 11, .14);
    color: #B45309;
}

.qd-title {
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1.08;
}

.qd-desc {
    margin: .7rem 0 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.qd-share label {
    display: block;
    margin-bottom: .35rem;
    color: var(--text-secondary);
    font-size: .85rem;
    font-weight: 700;
}

.qd-share .form-control {
    min-width: 0;
}

.qd-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin: .9rem 0 1.2rem;
}

.qd-meta-item {
    display: grid;
    gap: .25rem;
    padding: .85rem;
    border: 1px solid rgba(30, 136, 229, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .62);
}

.qd-meta-item span {
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 700;
}

.qd-meta-item strong {
    color: var(--text-primary);
}

.qd-questions {
    display: grid;
    gap: 1rem;
}

.qd-question {
    padding: 1.2rem;
}

.qd-question-head {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .85rem;
}

.qd-question-head span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: .25rem .6rem;
    border-radius: 8px;
    background: rgba(30, 136, 229, .1);
    color: #07529A;
    font-size: .8rem;
    font-weight: 800;
}

.qd-question-title {
    margin: 0 0 .9rem;
    color: var(--text-primary);
    font-size: 1.25rem;
    line-height: 1.35;
}

.qd-question-code,
.qd-missing-text {
    margin: 0 0 .9rem;
    padding: .9rem;
    border: 1px solid rgba(30, 136, 229, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .68);
    color: var(--text-primary);
    white-space: pre-wrap;
}

.qd-question-code {
    font-family: "Courier New", monospace;
    line-height: 1.55;
}

.qd-question-image,
.qd-answer-image {
    display: block;
    max-width: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.qd-question-image {
    max-height: 320px;
    margin: 0 0 .9rem;
}

.qd-answer-image {
    max-height: 150px;
}

.qd-answers {
    display: grid;
    gap: .65rem;
}

.qd-answer {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .75rem;
    border: 1px solid rgba(30, 136, 229, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .62);
    color: var(--text-primary);
}

.qd-answer-correct {
    border-color: rgba(34, 197, 94, .28);
    background: rgba(34, 197, 94, .08);
}

.qd-correct-label {
    margin-left: auto;
    color: #047857;
    font-size: .78rem;
}

.qd-match-cell {
    display: grid;
    gap: .45rem;
    min-width: 0;
    flex: 1;
}

.qd-match-arrow {
    color: var(--primary);
    font-weight: 900;
}

.qd-answer-empty,
.qd-empty {
    color: var(--text-muted);
}

.staff-required-shell {
    min-height: calc(100vh - 140px);
    display: grid;
    place-items: center;
    padding: 2rem 0;
}

.staff-required-card {
    max-width: 560px;
    padding: 2rem;
    text-align: center;
}

.staff-required-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto .9rem;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 900;
    font-size: 1.25rem;
}

.staff-required-card h1 {
    margin: 0 0 .65rem;
    color: var(--text-primary);
    font-size: clamp(1.55rem, 3vw, 2.2rem);
    line-height: 1.12;
}

.staff-required-card p {
    margin: 0 auto 1.2rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.staff-required-actions {
    display: flex;
    justify-content: center;
    gap: .7rem;
    flex-wrap: wrap;
}

.mq-card-actions .mq-btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    color: #07529A;
    font-weight: 700;
}

.mq-card-actions .mq-btn-play,
.mq-card-actions .mq-btn-lobby,
.mq-card-actions .mq-btn-history {
    color: #07529A;
}

.mq-card-actions .mq-btn-play span,
.mq-card-actions .mq-btn-lobby span,
.mq-card-actions .mq-btn-history span {
    color: inherit;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: .75rem;
    margin-top: .85rem;
}

.filter-select {
    width: 100%;
    padding: .8rem 1rem;
    border: 1px solid rgba(30, 136, 229, .24);
    border-radius: 8px;
    background: rgba(255, 255, 255, .86);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
}

.cq-field-gap {
    margin-top: 1.2rem;
}

.cq-meta-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, .9fr);
    gap: 1rem;
    margin-top: 1.2rem;
}

.grade-picker {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .5rem;
}

.grade-option {
    cursor: pointer;
}

.grade-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.grade-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(30, 136, 229, .22);
    background: rgba(30, 136, 229, .08);
    color: #0B5CAD;
    font-weight: 700;
}

.grade-option input:checked + span {
    background: linear-gradient(135deg, #1E88E5, #06B6D4);
    color: #fff;
    border-color: transparent;
}

.cq-new-subject {
    margin-top: .6rem;
}

.q-answer-count-row {
    max-width: 220px;
}

.answer-fields {
    display: grid;
    gap: .45rem;
    min-width: 0;
    width: 100%;
}

.q-file-row,
.q-existing-media {
    color: var(--text-muted);
    font-size: .85rem;
}

.q-file-input {
    width: 100%;
    padding: .62rem .75rem;
    border: 1px dashed rgba(30, 136, 229, .28);
    border-radius: 8px;
    background: rgba(255, 255, 255, .62);
    color: var(--text-secondary);
}

.q-media-upload {
    display: block;
    cursor: pointer;
}

.q-media-control {
    display: grid;
    gap: .45rem;
}

.q-media-input.q-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.q-media-thumb {
    min-height: 76px;
    border: 1.5px dashed rgba(30, 136, 229, .34);
    border-radius: 8px;
    background: rgba(255, 255, 255, .58);
    display: grid;
    place-items: center;
    gap: .3rem;
    padding: .8rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.25;
    transition: border-color .2s, box-shadow .2s, background .2s;
    overflow: hidden;
}

.q-media-upload:hover .q-media-thumb {
    border-color: var(--primary);
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 8px 22px rgba(30, 136, 229, .12);
}

.q-file-row .q-media-thumb {
    min-height: 118px;
}

.answer-fields .q-media-thumb {
    min-height: 68px;
    font-size: .76rem;
}

.q-media-plus {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
}

.q-media-text {
    max-width: 260px;
}

.q-media-thumb.has-preview {
    position: relative;
    padding: 0;
    display: block;
    background: rgba(255, 255, 255, .9);
}

.q-media-thumb.has-preview img {
    width: 100%;
    height: 100%;
    min-height: inherit;
    max-height: 180px;
    object-fit: contain;
    display: block;
    padding: .35rem;
}

.answer-fields .q-media-thumb.has-preview img {
    max-height: 120px;
}

.q-media-change {
    position: absolute;
    right: .45rem;
    bottom: .45rem;
    padding: .28rem .5rem;
    border-radius: 8px;
    background: rgba(11, 34, 64, .78);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
}

.q-media-remove {
    justify-self: start;
    border: 1px solid rgba(239, 68, 68, .28);
    border-radius: 8px;
    background: rgba(239, 68, 68, .08);
    color: #B91C1C;
    cursor: pointer;
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    padding: .42rem .7rem;
    transition: background .2s, border-color .2s, transform .2s;
}

.q-media-remove:hover {
    background: rgba(239, 68, 68, .14);
    border-color: rgba(239, 68, 68, .42);
    transform: translateY(-1px);
}

.q-existing-media {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-top: .45rem;
}

.q-existing-media:empty {
    display: none;
}

.q-existing-media img {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(30, 136, 229, .2);
}

.sp-question-image {
    display: block;
    max-width: min(520px, 100%);
    max-height: 320px;
    object-fit: contain;
    margin: 0 auto 1.4rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.js-zoomable-image {
    cursor: zoom-in;
}

.image-zoom-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(6, 18, 38, .82);
    backdrop-filter: blur(10px);
}

.image-zoom-overlay img {
    max-width: min(96vw, 1200px);
    max-height: 92vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    cursor: zoom-out;
}

.image-zoom-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    color: #0B2240;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}

.sp-answer-content {
    display: grid;
    gap: .45rem;
    min-width: 0;
}

.sp-answer-image {
    max-width: 180px;
    max-height: 140px;
    object-fit: contain;
    border-radius: 8px;
}

.text-answer-editor {
    display: grid;
    gap: .85rem;
}

.text-answer-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
}

.q-missing-text-row {
    display: grid;
    gap: .45rem;
}

.q-missing-text-row .q-input {
    min-height: 132px;
    font-family: inherit;
}

.text-check-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .65rem;
}

.text-check-option {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .65rem .75rem;
    border-radius: 8px;
    background: rgba(30, 136, 229, .07);
    border: 1px solid rgba(30, 136, 229, .16);
    color: var(--text-secondary);
    font-size: .85rem;
    cursor: pointer;
}

.text-check-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.text-check-option-wide {
    width: fit-content;
    margin-bottom: .2rem;
}

.q-inline-btn {
    justify-self: start;
    border: 1px solid rgba(30, 136, 229, .24);
    border-radius: 8px;
    background: rgba(30, 136, 229, .09);
    color: #07529A;
    cursor: pointer;
    font: inherit;
    font-size: .85rem;
    font-weight: 700;
    padding: .5rem .75rem;
}

.q-inline-btn:hover {
    background: rgba(30, 136, 229, .16);
}

.matching-editor {
    display: grid;
    gap: .55rem;
}

.matching-editor-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .55rem;
    align-items: start;
    padding: .65rem;
    border-radius: 8px;
    background: rgba(30, 136, 229, .06);
    border: 1px solid rgba(30, 136, 229, .14);
}

.matching-editor-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: .55rem;
}

.matching-cell-editor {
    display: grid;
    gap: .42rem;
    align-content: start;
}

.matching-cell-label {
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 700;
}

.matching-cell-editor .q-media-thumb {
    min-height: 64px;
    font-size: .76rem;
}

.sp-matching-card.is-selected {
    border-color: var(--primary);
    background: rgba(30, 136, 229, .18);
    box-shadow: 0 0 0 4px rgba(30, 136, 229, .1);
}

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.avatar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    padding: .8rem;
    border: 1px solid rgba(30, 136, 229, .2);
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}

.avatar-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.avatar-preview {
    width: 58px;
    height: 58px;
    display: block;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
    object-fit: cover;
}

.avatar-label {
    color: var(--text-secondary);
    font-size: .85rem;
}

.avatar-option:has(input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 136, 229, .12);
    transform: translateY(-1px);
}

@media (min-width: 721px) and (max-width: 980px), (min-width: 721px) and (max-height: 650px) {
    .home-mascot {
        width: min(340px, 36vw);
        transform: translate(-14%, 10%);
    }

    .hero-home .hero-logo-mark {
        width: min(480px, 74vw);
    }
}

@media (max-width: 720px) {
    .main-content:has(.home-page-shell) {
        height: auto;
        min-height: calc(100svh - 66px);
        overflow: visible;
    }

    body:has(.home-page-shell) {
        overflow: auto;
    }

    .home-page-shell {
        align-items: flex-start;
        padding-top: 1rem;
    }

    .quizzes-header,
    .text-check-options {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .hero-home .join-code-form {
        width: min(460px, 100%);
        transform: none;
    }

    .hero-home .hero-title {
        font-size: 2.05rem;
        max-width: 520px;
    }

    .hero-home .hero-title > span:last-child {
        white-space: normal;
    }

    .cq-meta-grid,
    .filter-row,
    .matching-editor-row,
    .matching-editor-fields,
    .qd-share-row,
    .qd-hero,
    .qd-meta {
        grid-template-columns: 1fr;
    }

    .qd-topbar,
    .qd-actions,
    .qd-share-row,
    .qd-answer {
        flex-direction: column;
        align-items: stretch;
    }

    .home-mascot {
        position: static;
        width: min(190px, 48vw);
        margin: .8rem auto 1rem;
        transform: none;
    }

    .grade-picker {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}
