/* ====== SHARED COMPONENTS ====== */

:where(body[class^="page-"], body[class*=" page-"]) .section-title {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xl);
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0, 90, 156, 0.3);
}

:where(body[class^="page-"], body[class*=" page-"]) .section-title i {
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
}

:where(body[class^="page-"], body[class*=" page-"]) .section-subtitle {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin: var(--spacing-xl) 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ====== ШКАЛА ПРОГРЕССА ====== */
:where(body[class^="page-"], body[class*=" page-"]) .progress-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xxl);
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(0, 90, 156, 0.2);
}

:where(body[class^="page-"], body[class*=" page-"]) .progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

:where(body[class^="page-"], body[class*=" page-"]) .progress-title {
    font-size: 1.3rem;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

:where(body[class^="page-"], body[class*=" page-"]) .progress-bar-container {
    background: rgba(255, 255, 255, 0.1);
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
    position: relative;
}

:where(body[class^="page-"], body[class*=" page-"]) .progress-bar {
    height: 100%;
    background: var(--gradient-blue);
    border-radius: 6px;
    width: 45%;
    transition: width 0.5s ease;
    position: relative;
}

:where(body[class^="page-"], body[class*=" page-"]) .progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

:where(body[class^="page-"], body[class*=" page-"]) .progress-info {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ====== ПОИСК ====== */
:where(body[class^="page-"], body[class*=" page-"]) .search-container {
    max-width: 600px;
    margin: 0 auto var(--spacing-xxl);
    position: relative;
}

:where(body[class^="page-"], body[class*=" page-"]) .search-box {
    width: 100%;
    padding: 15px 20px 15px 50px;
    background: var(--bg-card);
    border: 2px solid rgba(0, 90, 156, 0.3);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

:where(body[class^="page-"], body[class*=" page-"]) .search-box:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 90, 156, 0.2);
}

:where(body[class^="page-"], body[class*=" page-"]) .search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* ====== МАТРИЦА ИГР ====== */
:where(body[class^="page-"], body[class*=" page-"]) .games-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-card {
    background: var(--gradient-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 90, 156, 0.2);
    cursor: pointer;
    position: relative;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
    border-color: var(--secondary-blue);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-image {
    height: 160px;
    width: 100%;
    background: var(--gradient-dark);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-cover {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.35s ease, filter 0.35s ease;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-card:hover .game-cover {
    transform: scale(1.04);
    filter: saturate(1.08) brightness(1.04);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-cover-fallback {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 18px;
    overflow: hidden;
    isolation: isolate;
    color: #f4fbff;
    text-align: center;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.42);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-cover-fallback::before,
:where(body[class^="page-"], body[class*=" page-"]) .game-cover-fallback::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-cover-fallback::before {
    z-index: -2;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.2), transparent 32%),
        linear-gradient(135deg, rgba(0, 0, 0, 0.18), transparent 55%, rgba(0, 0, 0, 0.2));
}

:where(body[class^="page-"], body[class*=" page-"]) .game-cover-fallback::after {
    z-index: -1;
    background: linear-gradient(125deg, transparent 42%, rgba(255, 255, 255, 0.14) 50%, transparent 58%);
    transform: translateX(-120%);
    transition: transform 0.55s ease;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-card:hover .game-cover-fallback::after {
    transform: translateX(120%);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-cover-fallback i {
    position: relative;
    inset: auto;
    transform: none;
    z-index: 1;
    font-size: clamp(2.5rem, 4vw, 3.8rem);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-cover-fallback strong {
    position: relative;
    z-index: 1;
    max-width: 100%;
    font-size: clamp(0.78rem, 1.25vw, 1rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-cover-grid {
    position: absolute;
    inset: 0;
    z-index: -2;
    opacity: 0.34;
    background:
        linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: 24px 24px;
    transform: perspective(360px) rotateX(55deg) scale(1.8) translateY(16%);
    transform-origin: center bottom;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-cover-lines {
    position: absolute;
    inset: 12% -20%;
    z-index: -1;
    opacity: 0.5;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    transform: rotate(-12deg);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-image i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    color: rgba(255, 255, 255, 0.9);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-badge.novice {
    background: rgba(49, 160, 152, 0.2);
    color: var(--accent-teal);
    border: 1px solid var(--accent-teal);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-badge.medium {
    background: rgba(255, 209, 102, 0.2);
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-badge.hard {
    background: rgba(230, 57, 70, 0.2);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-content {
    padding: 20px;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

:where(body[class^="page-"], body[class*=" page-"]) .game-xp {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 0.95rem;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-play-btn {
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

:where(body[class^="page-"], body[class*=" page-"]) .game-play-btn:hover {
    background: var(--secondary-blue);
}

/* ====== ФИЛЬТРЫ ИГР ====== */
:where(body[class^="page-"], body[class*=" page-"]) .filters-container {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

:where(body[class^="page-"], body[class*=" page-"]) .filter-btn {
    padding: 10px 25px;
    background: var(--bg-card);
    border: 1px solid rgba(0, 90, 156, 0.3);
    color: var(--text-secondary);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95rem;
}

:where(body[class^="page-"], body[class*=" page-"]) .filter-btn:hover {
    border-color: var(--secondary-blue);
    color: var(--text-primary);
    transform: translateY(-2px);
}

:where(body[class^="page-"], body[class*=" page-"]) .filter-btn.active {
    background: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
}

/* ====== ОПРОСЫ ====== */
:where(body[class^="page-"], body[class*=" page-"]) .surveys-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 40px;
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-light);
    border-left: 4px solid var(--accent-teal);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-icon {
    width: 50px;
    height: 50px;
    background: rgba(0, 90, 156, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    color: var(--secondary-blue);
    font-size: 1.3rem;
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-reward {
    background: rgba(255, 209, 102, 0.1);
    color: var(--accent-gold);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-btn:hover {
    background: var(--secondary-blue);
}

:where(body[class^="page-"], body[class*=" page-"]) .survey-btn.completed {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: default;
}

/* ====== СТАТИСТИКА ====== */
:where(body[class^="page-"], body[class*=" page-"]) .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

:where(body[class^="page-"], body[class*=" page-"]) .stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px 20px;
    text-align: center;
    border: 1px solid rgba(0, 90, 156, 0.2);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

:where(body[class^="page-"], body[class*=" page-"]) .stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--secondary-blue);
}

:where(body[class^="page-"], body[class*=" page-"]) .stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(90deg, var(--primary-blue), var(--secondary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
    line-height: 1.2;
}

:where(body[class^="page-"], body[class*=" page-"]) .stat-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

:where(body[class^="page-"], body[class*=" page-"]) .stat-item {
    text-align: center;
    padding: 25px 15px;
    background: rgba(0, 90, 156, 0.1);
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 90, 156, 0.3);
}

/* ====== ПУСТОЕ СОСТОЯНИЕ ====== */
/* ====== ФУТЕР ====== */



/* ====== МОДАЛЬНЫЕ ОКНА ====== */
:where(body[class^="page-"], body[class*=" page-"]) .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: clamp(10px, 2vh, 20px);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

:where(body[class^="page-"], body[class*=" page-"]) .modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: calc(100dvh - 2 * clamp(10px, 2vh, 20px));
    overflow-y: auto;
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(0, 90, 156, 0.3);
    position: relative;
}

:where(body[class^="page-"], body[class*=" page-"]) .modal-content.large {
    max-width: 800px;
    max-height: calc(100dvh - 2 * clamp(10px, 2vh, 20px));
}

:where(body[class^="page-"], body[class*=" page-"]) .modal-header {
    padding: 25px 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

:where(body[class^="page-"], body[class*=" page-"]) .modal-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

:where(body[class^="page-"], body[class*=" page-"]) .modal-body {
    padding: 25px 30px;
}

:where(body[class^="page-"], body[class*=" page-"]) .modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    background: transparent;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
    z-index: 1;
    line-height: 1;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    box-shadow: none;
}

:where(body[class^="page-"], body[class*=" page-"]) .modal-close:hover {
    color: var(--accent-red);
    background: transparent;
}

/* Форма авторизации */
:where(body[class^="page-"], body[class*=" page-"]) .form-group {
    margin-bottom: 20px;
}

:where(body[class^="page-"], body[class*=" page-"]) .form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

:where(body[class^="page-"], body[class*=" page-"]) .form-input,
:where(body[class^="page-"], body[class*=" page-"]) .form-select {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

:where(body[class^="page-"], body[class*=" page-"]) .form-input:focus,
:where(body[class^="page-"], body[class*=" page-"]) .form-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: rgba(0, 90, 156, 0.1);
    box-shadow: 0 0 0 3px rgba(0, 90, 156, 0.1);
}

:where(body[class^="page-"], body[class*=" page-"]) .form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a8b2d1' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

:where(body[class^="page-"], body[class*=" page-"]) textarea.form-input {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

:where(body[class^="page-"], body[class*=" page-"]) .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

:where(body[class^="page-"], body[class*=" page-"]) .btn {
    padding: 12px 25px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
}

:where(body[class^="page-"], body[class*=" page-"]) .btn-primary {
    background: var(--primary-blue);
    color: var(--white);
}

:where(body[class^="page-"], body[class*=" page-"]) .btn-primary:hover {
    background: var(--secondary-blue);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 90, 156, 0.4);
}

:where(body[class^="page-"], body[class*=" page-"]) .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

:where(body[class^="page-"], body[class*=" page-"]) .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* ====== УВЕДОМЛЕНИЯ ====== */
:where(body[class^="page-"], body[class*=" page-"]) .notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--gradient-blue);
    color: var(--white);
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    animation: slideInRight 0.3s ease;
    font-size: 0.95rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

:where(body[class^="page-"], body[class*=" page-"]) .notification.error {
    background: var(--gradient-red);
}

:where(body[class^="page-"], body[class*=" page-"]) .notification i {
    font-size: 1.2rem;
}


/* Дополнительные универсальные layout-компоненты форм */
:where(body[class^="page-"], body[class*=" page-"]) .form-row {
    display: flex;
    gap: 20px;
}

:where(body[class^="page-"], body[class*=" page-"]) .form-row > .form-group {
    flex: 1;
}

:where(body[class^="page-"], body[class*=" page-"]) .action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 25px;
}

:where(body[class^="page-"], body[class*=" page-"]) .stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

@media (max-width: 768px) {
    :where(body[class^="page-"], body[class*=" page-"]) .form-row {
        flex-direction: column;
        gap: 15px;
    }

    :where(body[class^="page-"], body[class*=" page-"]) .form-actions {
        flex-direction: column;
    }

    :where(body[class^="page-"], body[class*=" page-"]) .btn {
        width: 100%;
    }
}
