/* Общие стили */
:root {
    --logo-url: url('pics/@Pakenrolcom Logo.webp');
    --logo-size: 80px;
    --logo-size-mobile: 60px;
    --logo-size-footer: 40px;
    /* Цвет подзаголовка в шапке (для совпадения цвета линии) */
    --banner-subtitle-color: #666;
    
    /* Размеры картинок проектов */
    --project-image-size-desktop: clamp(150px, 25vw, 250px);
    --project-image-size-mobile: 120px;
    --project-image-size-small: 200px;
    
    /* Отступы для картинок проектов */
    --project-image-margin-desktop: clamp(8px, 1.2vw, 10px);
    --project-image-margin-large: 10px;
    --project-image-margin-4k: 9px;
    --project-image-margin-tablet: 8px;
    --project-image-margin-mobile: 6px;
    
    /* Цветовая схема - светлая тема */
    --bg-primary: #ffffff;
    --bg-secondary: rgba(248, 249, 250, 0.1);
    --bg-toolbar: rgba(255, 255, 255, 0.9);
    --text-primary: #000;
    --text-secondary: #333;
    --text-muted: #555;
    --text-heading: #000;
    --text-footer: #888;
    --border-light: #eee;
    --border-medium: #e9ecef;
    --button-bg: #000000;
    --button-text: #ffffff;
    --button-hover: #222222;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    --card-bg: #f8f9fa;
    --card-border: #e9ecef;
    --top-gradient-height: 250px;
    --top-gradient-scale: 1;
    --top-gradient: linear-gradient(
        180deg,
        rgb(143, 196, 239) 0%,
        rgba(143, 202, 239, 0.85) 50%,
        rgba(240, 254, 197, 0) 100%
    );
}

@media (max-width: 768px) {
    :root {
        --top-gradient-height: 200px;
    }
}

    /* Темная тема */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0a0a0a;
        --bg-secondary: rgba(22, 27, 34, 0.1);
        --bg-toolbar: rgba(33, 38, 45, 0.9);
        --text-primary: #e6edf3;
        --text-secondary: #7d8590;
        --text-muted: #8b949e;
        --text-heading: #f0f6fc;
        --text-footer: #7d8590;
        --border-light: #30363d;
        --border-medium: #21262d;
        --button-bg: #f0f6fc;
        --button-text: #0d1117;
        --button-hover: #e6edf3;
        --glass-bg: rgba(240, 246, 252, 0.15);
        --glass-shadow: rgba(0, 0, 0, 0.4);
        --card-bg: #161b22;
        --card-border: #30363d;
        /* Цвет подзаголовка в шапке на темной теме */
        --banner-subtitle-color: #c9d1d9;
        --top-gradient: var(--bg-primary);
    }
    
    /* Мягкие эффекты для темной темы без “стекла” */
    .project-title, .achievement-title {
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(60, 67, 77, 0.6);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
        text-shadow: none !important;
        color: #e6edf3 !important;
    }
    
    .project-title::before, .achievement-title::before {
        content: none;
    }
    
    .project-card.mobile-active .project-title,
    .achievement-item.mobile-active .achievement-title {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(82, 90, 102, 0.8);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
        text-shadow: none !important;
        color: #f0f6fc !important;
    }
    
    /* Обновленные hover эффекты для карточек в темной теме */
    .project-card.mobile-active,
    .achievement-item.mobile-active {
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    }
    
    /* Более светлый текст для описания в темной теме */
    .banner h3 {
        color: #c9d1d9;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Фон для всей страницы */
html {
    background-color: var(--bg-primary);
    background-position: top center;
    min-height: 100vh;
}

/* Фиксированный градиентный слой, привязанный к вьюпорту */
.top-gradient-layer {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: calc(var(--top-gradient-height) * var(--top-gradient-scale) + env(safe-area-inset-top));
    background: var(--top-gradient);
    pointer-events: none;
    z-index: 50;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    mask-image: linear-gradient(180deg, #000 0%, #000 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 80%, transparent 100%);
}

/* Темная тема для html */
@media (prefers-color-scheme: dark) {
    html {
        background-color: var(--bg-primary);
    }

    .top-gradient-layer {
        display: none;
    }
}

body {
    background-color: transparent;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    max-width: 800px;
    margin: 0 auto;
    padding: calc(40px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
    background-color: transparent;
}

/* Заголовки */
h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-heading);
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 0.5rem 0;
    color: var(--text-heading);
}

h3 {
    font-size: 1.2rem;
    font-weight: 400;
    margin: 1.5rem 0 0.5rem 0;
    color: var(--text-secondary);
}

/* Параграфы */
p {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Ссылки */
a {
    color: #0066cc;
    text-decoration: underline;
    transition: color 0.2s ease;
}

a:hover {
    color: #004499;
}

a strong {
    font-weight: 600;
}

/* Заголовок сайта */
.banner {
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    z-index: 60;
}

/* Логотип */
.logo-container {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.site-logo {
    width: var(--logo-size);
    height: var(--logo-size);
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 4px 20px var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--glass-bg);
    padding: 8px;
}

.site-logo:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px var(--glass-shadow);
}

.banner h1 {
    margin-bottom: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 900;
}

.banner h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    color: var(--text-muted);
    margin: 0;
}

/* Вкладки */
.tab-container {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 742px;
    margin-left: auto;
    margin-right: auto;
}

/* Тонкая линия-сепаратор перед космической карточкой, вровень с её шириной */
.tab-content-area {
    position: relative;
    /* Центрируем линию между текстом шапки (margin-bottom у .banner = 2rem)
       и верхом карточки, делая отступ снизу от линии равным 2rem */
    padding-top: 2rem;
    z-index: 2; /* поднять слой, чтобы линия была над фоном/светом */
}

.tab-content-area::before {
    content: "";
    position: absolute;
    top: -17px; /* 2rem (~32px) - 17px = 15px отступ от текста */
    left: 30px;
    right: 30px;
    height: 1px;
    background: var(--banner-subtitle-color);
    z-index: 3; /* линия над остальными элементами этой области */
}

.tab-content-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    height: 200px;
    position: relative;
    overflow: hidden;
    background-image: url('pics/howen-2EQ0Nmovq8g-unsplash.webp');
    background-size: 120% auto;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: scroll;
    transition: background-position 0.4s ease-out;
    
    /* Оптимизация рендеринга */
    will-change: background-position;
    transform: translateZ(0);
    contain: layout style paint;
    backface-visibility: hidden;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    
    /* Дополнительные оптимизации */
    content-visibility: auto;
    isolation: isolate;
    transform-style: preserve-3d;
}

/* Позиции фона для разных вкладок */
.tab-content-card.tab-models {
    background-position: 0% center;
}

.tab-content-card.tab-achievements {
    background-position: 50% center;
}

.tab-content-card.tab-skills {
    background-position: 100% center;
}

.tab-content-card.tab-experience {
    background-position: 60% center;
}

.tab-content-card.tab-contact {
    background-position: 90% center;
}

.tab-content {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.tab-content.active {
    opacity: 1;
}

/* Убрали волны, теперь используем звездный фон */

/* Убрали анимацию мерцающих звезд */

.tab-content-text {
    position: relative;
    z-index: 10;
    padding: 1rem;
    text-align: center;
    
    /* Оптимизация рендеринга текста */
    will-change: transform;
    transform: translateZ(0);
    contain: layout style paint;
}

.tab-content-text h3 {
    font-size: 67px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.5rem 0;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    line-height: 1;
}

.tab-content-text p {
    color: #e0e0e0;
    font-size: 1.2rem;
    margin: 0 auto;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    font-weight: 400;
    max-width: 350px;
}

/* Панель вкладок */
.tab-toolbar {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-toolbar);
    border-radius: 12px;
    padding: 8px;
    margin: 20px auto;
    width: 100%;
    max-width: 742px; /* Совпадает с tab-container */
    box-shadow: 0 2px 4px var(--glass-shadow);
    border: 1px solid var(--border-light);
}

.tab-button {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: min(16px, 4vw);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--button-text);
}

.tab-button:focus {
    outline: none;
}

/* Секция "О себе" */
.about {
    margin-bottom: 3rem;
}

.about h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Контакты */
.contacts {
    margin-top: 1.5rem;
}

.contacts p {
    margin-bottom: 0.5rem;
}

/* Футер */
footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

/* Логотип в футере */
.footer-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.footer-logo-img {
    width: var(--logo-size-footer);
    height: var(--logo-size-footer);
    object-fit: contain;
    border-radius: 50%;
    background: var(--glass-bg);
    padding: 4px;
    box-shadow: 0 2px 10px var(--glass-shadow);
    transition: transform 0.3s ease;
}

.footer-logo-img:hover {
    transform: scale(1.1);
}

footer p {
    color: var(--text-footer);
    font-size: 0.9rem;
    margin: 0;
    max-width: 742px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.footer-content {
    max-width: 742px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

.footer-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.footer-top .flags-card {
    margin-bottom: 0;
}

.footer-copyright {
    text-align: left;
    margin: 8px 0 0 0;
    color: var(--text-footer);
    font-size: 0.9rem;
    max-width: 742px;
    margin-left: 0;
    padding-left: 0;
}

/* Карточка с флагами */
.flags-card {
    width: 160px;
    min-height: 60px;
    background: rgba(0, 129, 252, 0.2);
    border-radius: 20px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flags-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flags-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flags-left h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-style: normal;
    font-weight: 900;
    font-size: 18px;
    line-height: 100%;
    color: #0081FC !important;
    margin: 0;
}

.flags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: flex-start;
    justify-content: flex-start;
}

.flag-item {
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: inline-block;
    line-height: 1;
    color: #FFFFFF;
}

.flag-item:hover {
    transform: scale(1.1);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .flags-card {
        width: 160px;
        min-height: 50px;
        padding: 10px;
    }
    
    .flags-left h3 {
        font-size: 16px;
        color: #0081FC !important;
    }
    
    .flags-grid {
        gap: 3px;
    }
    
    .flag-item {
        font-size: 16px;
    }
}

@media (max-width: 600px) {
    .flags-card {
        width: 160px;
        min-height: 45px;
        padding: 8px;
    }
    
    .flags-left h3 {
        font-size: 14px;
        color: #0081FC !important;
    }
    
    .flags-grid {
        gap: 2px;
    }
    
    .flag-item {
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    .flags-card {
        width: 160px;
        min-height: 40px;
        padding: 6px;
    }
    
    .flags-left h3 {
        font-size: 12px;
        color: #0081FC !important;
    }
    
    .flags-grid {
        gap: 1px;
    }
    
    .flag-item {
        font-size: 12px;
    }
}

/* Адаптивность для мобильных */
@media (max-width: 600px) {
    body {
        padding: 20px 10px;
    }
    
    /* Логотип на мобильных */
    .site-logo {
        width: var(--logo-size-mobile);
        height: var(--logo-size-mobile);
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .tab-toolbar {
        width: 100%;
        padding: 6px;
    }
    
    .tab-button {
        padding: 10px 6px;
        font-size: min(14px, 3.5vw);
    }
    
    /* Футер на мобильных */
    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .social-button-container {
        margin-top: 0;
    }
    
    .tab-button {
        min-width: 33.333%; /* Принудительная минимальная ширина */
    }
    
    /* Дополнительные стили для tab-slider на мобильных */
    .tab-slider {
        transition: all 0.15s cubic-bezier(0.32, 0.72, 0, 1);
    }
    
    .tab-content-card {
        background-size: cover;
        background-position: center center;
    }
    
    .tab-content-card.tab-models {
        background-position: left center;
    }
    
    .tab-content-card.tab-achievements {
        background-position: center center;
    }
    
    .tab-content-card.tab-skills {
        background-position: right center;
    }
    
    .tab-content-text {
        padding: 0.5rem;
    }
    
    .tab-content-text h3 {
        font-size: 34px;
    }
    
    .tab-content-text p {
        font-size: 1rem;
        max-width: 250px;
    }
}

/* Для средних экранов (планшеты) */
@media (max-width: 768px) {
    .tab-button {
        padding: 8px 4px;
        font-size: min(13px, 3.2vw);
    }
}

/* Для очень узких экранов */
@media (max-width: 400px) {
    .tab-content-card {
        height: 180px;
        background-size: cover;
    }
    
    .tab-content-text h3 {
        font-size: 28px;
    }
    
    .tab-content-text p {
        font-size: 0.9rem;
        max-width: 200px;
    }
    
    .tab-button {
        padding: 6px 2px;
        font-size: min(12px, 3vw);
        min-width: 0;
    }
}

/* Для экстремально узких экранов */
@media (max-width: 320px) {
    body {
        padding: 15px 8px;
    }
    
    .tab-content-card {
        height: 160px;
        background-size: cover;
        background-position: center center;
    }
    
    .tab-content-text h3 {
        font-size: 22px;
    }
    
    .tab-content-text p {
        font-size: 0.8rem;
        max-width: 180px;
    }
    
    .tab-button {
        padding: 4px 1px;
        font-size: min(10px, 2.8vw);
        min-width: 0;
    }
}

/* Социальная кнопка */
.social-button-container {
    margin-top: 0;
    display: flex;
    justify-content: flex-start;
}

.social-button-wrapper {
    position: relative;
    display: inline-block;
}

.social-main-button {
    min-width: 160px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--button-bg);
    color: var(--button-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.social-main-button:hover {
    background: var(--button-hover);
}

.social-main-button .link-icon {
    width: 16px;
    height: 16px;
}

.social-buttons-panel {
    position: absolute;
    top: 0;
    left: 0;
    height: 40px;
    display: flex;
    overflow: hidden;
    border-radius: 6px;
    width: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.social-button-wrapper:hover .social-buttons-panel {
    opacity: 1;
    pointer-events: auto;
}

.social-button-wrapper:hover .social-main-button {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.social-btn {
    width: 80px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-20px);
}

/* Three equal segments inside the fixed width */
.social-buttons-panel .social-btn {
    width: calc(100% / 3);
    flex: 0 0 calc(100% / 3);
}

.social-btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.social-btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    border-right: none;
}

.social-btn:hover {
    background: var(--button-hover);
}

.social-btn.active {
    transform: scale(0.85);
}

.social-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.social-btn.active::before {
    opacity: 1;
}

/* Анимация появления кнопок */
.social-button-wrapper:hover .social-btn:nth-child(1) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0ms;
}

.social-button-wrapper:hover .social-btn:nth-child(2) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 50ms;
}

.social-button-wrapper:hover .social-btn:nth-child(3) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 100ms;
}

/* Ensure icons within social buttons are sized consistently */
.social-btn .link-icon {
    width: 16px;
    height: 16px;
}

/* Стили для секции с книгами */
.books-section {
    display: none;
    margin-top: 2rem;
    animation: fadeIn 0.5s ease-out;
    --book-cover-width: clamp(82px, 18vw, 112px);
    --book-cover-height: clamp(110px, 26vw, 140px);
    --book-cover-gap: clamp(16px, 3vw, 26px);
}

.books-section.active {
    display: block;
}

.bookshelf-content {
    width: 100%;
    max-width: 742px;
    margin: 0 auto;
    padding: 30px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}

.books-timeline {
    position: relative;
    padding-left: 20px;
}

.books-timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--text-heading);
}

.year-section {
    margin-bottom: 30px;
}

.year-section:last-child {
    margin-bottom: 0;
}

.year-title {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 900;
    font-size: 40px;
    color: var(--text-heading);
    margin: 0 0 12px 0;
    line-height: 1;
}

.books-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.book-item {
    display: grid;
    grid-template-columns: var(--book-cover-width) 1fr;
    align-items: start;
    gap: var(--book-cover-gap);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.2;
}

.book-cover-wrapper {
    width: var(--book-cover-width);
    min-width: var(--book-cover-width);
    height: var(--book-cover-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-cover {
    display: block;
    height: 100%;
    width: auto;
    max-width: 100%;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
}

.book-cover-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
    border: 1px dashed rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(30px, 6vw, 38px);
    color: rgba(99, 102, 241, 0.6);
}

.book-item--no-cover .book-cover-placeholder span {
    display: block;
    transform: translateY(4px);
}

.book-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.book-title {
    font-family: inherit;
    font-weight: 400;
    font-size: 32px;
    color: var(--text-primary);
    font-style: italic;
    line-height: 1.1;
}

.book-author {
    font-family: inherit;
    font-size: 22px;
    color: var(--text-muted);
    line-height: 1.2;
}

.empty-state {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 20px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

/* Адаптивные стили для секции с книгами */
@media (max-width: 600px) {
    .books-section {
        --book-cover-width: clamp(68px, 24vw, 90px);
        --book-cover-height: clamp(95px, 28vw, 120px);
    }
    
    .bookshelf-content {
        padding: 20px;
    }
    
    .books-timeline {
        padding-left: 15px;
    }
    
    .year-title {
        font-size: 28px;
    }
    
    .book-title {
        font-size: 24px;
    }

    .book-author {
        font-size: 18px;
    }
}

@media (max-width: 400px) {
    .books-section {
        --book-cover-width: clamp(62px, 28vw, 82px);
        --book-cover-height: clamp(88px, 30vw, 110px);
        --book-cover-gap: clamp(12px, 5vw, 18px);
    }
    
    .bookshelf-content {
        padding: 15px;
    }
    
    .books-timeline {
        padding-left: 12px;
    }
    
    .year-title {
        font-size: 24px;
    }
    
    .book-title {
        font-size: 20px;
    }

    .book-author {
        font-size: 16px;
    }
}

/* Стили для секции с проектами */
.projects-section {
    display: none;
    margin-top: 2rem;
    animation: fadeIn 0.5s ease-out;
}

.projects-section.active {
    display: block;
}

.projects-content {
    padding: 0;
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 742px;
    margin: 0 auto;
}

/* Карточка проекта */
.project-card {
    width: 100%;
    min-height: 300px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: clamp(16px, 3.5vw, 24px);
    position: relative;
    display: grid;
    grid-template-columns: 1fr minmax(180px, 33%);
    grid-template-rows: auto 1fr auto;
    gap: clamp(15px, 2vw, 20px);
    padding: clamp(15px, 2.5vw, 20px);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.2s ease;
}

.project-card.mobile-active {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    border-color: var(--button-bg);
}

/* Заголовок проекта с Liquid Glass эффектом */
.project-title {
    font-family: 'SF Compact Rounded', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: clamp(32px, 5vw, 48px);
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    z-index: 2;
    line-height: 1;
    margin: 0;
    align-self: start;
    
    /* Цвет текста */
    color: var(--text-secondary);
    
    /* Стеклянная подложка только под текстом */
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    padding: clamp(8px, 1.6vw, 12px) clamp(12px, 2vw, 18px);
    border-radius: clamp(10px, 1.8vw, 16px);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--card-border);
    box-shadow: none;
    text-shadow: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
}

/* Псевдоэлементы для дополнительных стеклянных слоев */
.project-title::before {
    content: none;
}

/* Анимация при наведении */
.project-card.mobile-active .project-title {
    transform: translateY(clamp(-2px, -0.4vw, -3px)) scale(1.01);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-heading);
}

/* Бокс с описанием */
.project-description-box {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    width: 100%;
    height: auto;
    margin: 0;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
}

.project-description {
    font-family: 'SF Compact Rounded', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
    font-weight: 300;
    font-size: clamp(18px, 3vw, 24px);
    color: var(--text-heading);
    line-height: 1.35;
    margin: 4px 0 0 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Обертка для картинки проекта */
.project-image-wrapper {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    padding-right: var(--project-image-margin-desktop);
    width: 100%;
    box-sizing: border-box;
}

/* Картинка проекта */
.project-image {
    width: 100%;
    /* Квадратное соотношение сторон для современных браузеров */
    aspect-ratio: 1 / 1;
    border-radius: clamp(16px, 3.5vw, 24px);
    object-fit: cover;
    object-position: center;
    background: var(--bg-primary);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    /* Fallback для браузеров без поддержки aspect-ratio */
    height: auto;
    display: block;
}

/* Для браузеров с поддержкой aspect-ratio убираем фиксированную высоту */
@supports (aspect-ratio: 1 / 1) {
    .project-image {
        height: auto;
    }
}

/* Обертка для кнопки проекта */
.project-button-wrapper {
    grid-column: 2 / 3;
    grid-row: 3 / 4;
    padding-right: var(--project-image-margin-desktop);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: end;
}

/* Кнопка проекта */
.project-button {
    width: 100%;
    height: clamp(45px, 8vw, 65px);
    background: var(--button-bg);
    border: none;
    border-radius: clamp(22px, 4vw, 32px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.project-button:hover {
    background: var(--button-hover);
    transform: scale(1.05);
}

.project-button-text {
    font-family: 'SF Compact Rounded', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: clamp(20px, 4vw, 32px);
    color: var(--button-text);
    margin: 0;
}

/* Пустой блок для сетки */
.project-spacer {
    grid-column: 1 / 2;
    grid-row: 3 / 4;
}

/* Годы проекта */
.project-years {
    font-family: 'SF Compact Rounded', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: clamp(14px,3.5vw,18px);
    color: var(--text-secondary);
    grid-column: 1 / 2;
    grid-row: 3 / 4;
    margin: 0;
    align-self: end;
}

/* Адаптивность для больших экранов */
@media (min-width: 1200px) {
    .project-card {
        grid-template-columns: 1fr 230px;
        gap: 20px;
        padding: 20px;
    }
    
    .project-image-wrapper {
        padding-right: var(--project-image-margin-large);
    }
    
    .project-button-wrapper {
        padding-right: var(--project-image-margin-large);
    }
    
    .project-title {
        font-size: 44px;
        padding: 12px 20px;
        border-radius: 16px;
    }
    
    .project-title::before {
        border-radius: 18px;
    }
    
    .project-description {
        font-size: 22px;
    }
    
    .project-button {
        height: 55px;
    }
    
    .project-button-text {
        font-size: 26px;
    }
}

/* Адаптивность для очень больших экранов */
@media (min-width: 1440px) {
    .project-card {
        grid-template-columns: 1fr 210px;
    }
    
    .project-title {
        font-size: 40px;
        padding: 11px 18px;
        border-radius: 15px;
    }
    
    .project-title::before {
        border-radius: 17px;
    }
    
    .project-description {
        font-size: 20px;
    }
    
    .project-button {
        height: 52px;
    }
    
    .project-button-text {
        font-size: 24px;
    }
}

/* Для экстремально больших экранов (4K и выше) */
@media (min-width: 1920px) {
    .project-card {
        grid-template-columns: 1fr 190px;
        gap: 18px;
        padding: 18px;
    }
    
    .project-image-wrapper {
        padding-right: var(--project-image-margin-4k);
    }
    
    .project-button-wrapper {
        padding-right: var(--project-image-margin-4k);
    }
    
    .project-title {
        font-size: 36px;
        padding: 10px 16px;
        border-radius: 14px;
    }
    
    .project-title::before {
        border-radius: 16px;
    }
    
    .project-description {
        font-size: 18px;
    }
    
    .project-button {
        height: 48px;
    }
    
    .project-button-text {
        font-size: 22px;
    }
}

/* Адаптивность для планшетов */
@media (max-width: 768px) {
    .project-card {
        grid-template-columns: 1fr 180px;
        gap: 15px;
        padding: 15px;
        min-height: clamp(200px, 40vw, 280px);
    }
    
    .project-image-wrapper {
        padding-right: var(--project-image-margin-tablet);
    }
    
    .project-button-wrapper {
        padding-right: var(--project-image-margin-tablet);
    }
    
    .project-spacer {
        display: none;
    }
    
    .project-title {
        font-size: clamp(32px, 6vw, 40px);
        padding: 10px 16px;
        border-radius: 14px;
    }
    
    .project-title::before {
        border-radius: 16px;
    }
    
    .project-description {
        font-size: clamp(18px, 3vw, 22px);
    }
    
    .project-button {
        height: 50px;
    }
    
    .project-button-text {
        font-size: 24px;
    }
}

/* Адаптивность для мобильных */
@media (max-width: 600px) {
    .project-card {
        grid-template-columns: 1fr 110px;
        grid-template-rows: auto auto auto;
        gap: 12px;
        padding: 12px;
        border-radius: 30px;
        min-height: clamp(180px, 35vw, 220px);
    }
    
    .project-title {
        font-size: clamp(24px, 6vw, 30px);
        padding: 6px 12px;
        border-radius: 12px;
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }

    .project-description-box {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        align-self: start;
    }

    .project-years {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
        font-size: clamp(14px, 3.5vw, 16px);
        margin-top: 8px;
    }

    .project-image-wrapper {
        grid-column: 2 / 3;
        grid-row: 1 / 3;
        max-width: 110px;
        padding-right: var(--project-image-margin-mobile);
    }
    
    .project-button-wrapper {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
        padding-right: var(--project-image-margin-mobile);
    }
    
    .project-spacer {
        display: none;
    }
    
    .project-description {
        font-size: clamp(15px, 3.8vw, 18px);
        line-height: 1.2;
    }
    
    .project-button {
        height: 45px;
        border-radius: 22px;
    }
    
    .project-button-text {
        font-size: clamp(18px, 4vw, 20px);
    }
}

/* Для очень маленьких экранов */
@media (max-width: 400px) {
    .project-card {
        grid-template-columns: 1fr 120px;
        grid-template-rows: auto 1fr auto;
        gap: 8px;
        padding: 12px;
        text-align: left;
    }

    .project-title {
        font-size: clamp(22px, 6vw, 28px);
        padding: 6px 10px;
        border-radius: 10px;
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        justify-self: start;
    }

    .project-image-wrapper {
        grid-column: 2 / 3;
        grid-row: 1 / 3;
        max-width: 120px;
        padding-right: var(--project-image-margin-mobile);
    }

    .project-button-wrapper {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
        padding-right: var(--project-image-margin-mobile);
    }

    .project-description-box {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }

    .project-description {
        font-size: clamp(15px,4vw,17px);
    }
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для модального окна */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-close-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: auto;
    background: transparent;
    padding: 40px;
    z-index: 2;
    animation: modalSlideIn 0.3s ease;
    overflow: visible;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 24px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 3;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Карусель в модальном окне */
.modal-images {
    display: flex;
    width: 100%;
    height: auto;
    overflow: visible;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.carousel-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 70vh;
    overflow: hidden;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-image {
    width: auto;
    max-width: 90%;
    height: 65vh;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 20px;
    filter: drop-shadow(0 8px 30px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s ease, filter 0.3s ease;
    display: block;
}

.modal-image:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 12px 40px rgba(0, 0, 0, 0.5));
}

/* Кнопки навигации */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.carousel-prev {
    left: 15px;
}

.carousel-next {
    right: 15px;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.95);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Индикаторы */
.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.carousel-dot.active {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 1);
    transform: scale(1.2);
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.1);
}

/* Для кнопки модального окна нужен курсор */
.project-modal-button {
    cursor: pointer;
}

/* Адаптивные стили для карусели */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 15px;
    }
    
    .modal-images {
        padding: 15px;
    }
    
    .carousel-container {
        max-width: 100%;
        height: 65vh;
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .carousel-prev {
        left: 8px;
    }
    
    .carousel-next {
        right: 8px;
    }
    
    .modal-image {
        width: auto;
        max-width: 85%;
        height: 60vh;
        max-height: 60vh;
        border-radius: 15px;
    }
    
    .carousel-indicators {
        bottom: -50px;
    }
    
    .carousel-dot {
        width: 10px;
        height: 10px;
    }
    
    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 600px) {
    .modal-content {
        padding: 10px;
    }
    
    .modal-images {
        padding: 10px;
    }
    
    .carousel-container {
        height: 60vh;
    }
    
    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .carousel-prev {
        left: 5px;
    }
    
    .carousel-next {
        right: 5px;
    }
    
    .modal-image {
        width: auto;
        max-width: 80%;
        height: 55vh;
        max-height: 55vh;
        border-radius: 12px;
    }
    
    .carousel-indicators {
        bottom: -40px;
        gap: 8px;
    }
    
    .carousel-dot {
        width: 8px;
        height: 8px;
        border-width: 1px;
    }
}

@media (max-width: 400px) {
    .modal-content {
        padding: 5px;
    }
    
    .modal-images {
        padding: 5px;
    }
    
    .carousel-container {
        height: 55vh;
    }
    
    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    .modal-image {
        width: auto;
        max-width: 75%;
        height: 50vh;
        max-height: 50vh;
        border-radius: 10px;
    }
    
    .carousel-indicators {
        bottom: -35px;
        gap: 6px;
    }
}

/* Блокировка скролла когда модалка открыта */
body.modal-open {
    overflow: hidden;
}

/* Achievements Section */
.achievements-section {
    display: none;
    margin-top: 20px;
    padding: 0;
}

.achievements-section.active {
    display: block;
}

.achievements-content {
    max-width: 742px;
    margin: 0 auto;
    padding: 0;
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0;
}

.achievement-item {
    width: 100%;
    min-height: 200px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: clamp(16px, 3.5vw, 24px);
    position: relative;
    padding: clamp(15px, 2.5vw, 20px);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.2s ease;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        "title"
        "description"
        "footer";
    gap: clamp(14px, 2vw, 18px);
}

.achievement-item.mobile-active {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    border-color: var(--button-bg);
}

.achievement-title {
    font-family: 'SF Compact Rounded', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: clamp(24px, 4vw, 32px);
    line-height: 1;
    margin: 0;
    align-self: start;
    color: var(--text-secondary);
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    padding: clamp(8px, 1.6vw, 12px) clamp(12px, 2vw, 18px);
    border-radius: clamp(10px, 1.8vw, 16px);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--card-border);
    box-shadow: none;
    text-shadow: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
    position: relative;
    grid-area: title;
}

.achievement-title::before {
    content: none;
}

.achievement-item.mobile-active .achievement-title {
    transform: translateY(clamp(-2px, -0.4vw, -3px)) scale(1.01);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-heading);
}

@media (hover: hover) and (pointer: fine) {
    .project-card:hover,
    .achievement-item:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
        border-color: var(--button-bg);
    }
    
    .project-card:hover .project-title,
    .achievement-item:hover .achievement-title {
        transform: translateY(clamp(-2px, -0.4vw, -3px)) scale(1.01);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
        background: rgba(255, 255, 255, 0.18);
        border-color: rgba(255, 255, 255, 0.25);
        color: var(--text-heading);
    }
}

@media (prefers-color-scheme: dark) and (hover: hover) and (pointer: fine) {
    .project-card:hover,
    .achievement-item:hover {
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    }
    
    .project-card:hover .project-title,
    .achievement-item:hover .achievement-title {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(82, 90, 102, 0.8);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
        text-shadow: none !important;
        color: #f0f6fc !important;
    }
}

.achievement-description {
    font-family: 'SF Compact Rounded', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
    font-weight: 300;
    font-size: clamp(18px, 3vw, 24px);
    color: var(--text-heading);
    line-height: 1.35;
    margin: 4px 0 0 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 90%;
    grid-area: description;
}

.achievement-footer {
    margin-top: clamp(12px, 2.4vw, 20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(10px, 1.8vw, 18px);
    width: 100%;
    grid-area: footer;
}

.achievement-date {
    font-family: 'SF Compact Rounded', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: clamp(16px, 2.5vw, 20px);
    color: var(--text-secondary);
    margin: 0;
    text-align: right;
    flex: 0 0 auto;
}

.achievement-button {
    padding: clamp(8px, 1.8vw, 12px) clamp(18px, 3vw, 26px);
    border: none;
    border-radius: clamp(18px, 4vw, 28px);
    background: var(--button-bg);
    color: var(--button-text);
    font-family: 'SF Compact Rounded', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: clamp(16px, 3.2vw, 22px);
    cursor: pointer;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.achievement-button:hover,
.achievement-button:focus-visible {
    background: var(--button-hover);
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    outline: none;
}

.achievement-button:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.chess-board-container {
    margin-top: clamp(12px, 2.5vw, 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(12px, 2vw, 20px);
    width: 100%;
    grid-column: 1 / -1;
}

.chess-board-container[hidden] {
    display: none !important;
    margin-top: 0 !important;
}

.chess-board-wrapper {
    width: clamp(220px, 55vw, 320px);
    max-width: 100%;
    border-radius: clamp(22px, 4vw, 32px);
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
}

/* Специальная раскладка для карточки с шахматами */
.chess-item {
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
        "title"
        "description"
        "board"
        "footer";
}

.chess-item .chess-board-container {
    grid-area: board;
    width: 100%;
}

.chess-item .achievement-date {
    margin-top: 18px;
}

/* Адаптивность для карточек увлечений */
@media (max-width: 768px) {
    .achievement-item {
        gap: 12px;
    }
    
    .achievement-description {
        max-width: 100%;
    }
    
    .achievement-footer {
        justify-content: flex-start;
        gap: 12px;
    }
}

@media (max-width: 600px) {
    .achievement-item {
        gap: 10px;
        padding: 12px;
        border-radius: 20px;
    }
    
    .achievement-title {
        font-size: clamp(22px, 6vw, 28px);
    }
    
    .achievement-description {
        font-size: clamp(16px, 4vw, 20px);
        line-height: 1.4;
    }
    
    .achievement-footer {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

.chess-board-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: 100%;
    aspect-ratio: 1 / 1;
}

.chess-square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 600;
    user-select: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.2s ease, outline 0.2s ease;
}

.chess-square.light {
    background: #f0d9b5;
}

.chess-square.dark {
    background: #b58863;
}

.chess-square:hover {
    transform: scale(1.02);
}

.chess-square.selected {
    outline: 3px solid rgba(255, 215, 0, 0.9);
    outline-offset: -3px;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.15);
}

.chess-piece {
    pointer-events: none;
    transform: translateY(2px);
    color: #1c1c1c;
}

.chess-message {
    font-family: 'SF Compact Rounded', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: clamp(22px, 4vw, 30px);
    color: var(--text-heading);
    text-align: center;
    padding: clamp(12px, 3vw, 20px) clamp(18px, 4vw, 26px);
    border-radius: clamp(20px, 4vw, 30px);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chess-message.visible {
    opacity: 1;
}

@media (max-width: 600px) {
    .achievement-item {
        padding: 15px;
        min-height: 180px;
    }
    
    .achievement-title {
        font-size: 28px;
        padding: 8px 16px;
    }
    
    .achievement-description {
        font-size: 16px;
        margin: 15px 0 0 0;
    }
    
    .achievement-date {
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    .achievement-item {
        padding: 12px;
        min-height: 160px;
    }
    
    .achievement-title {
        font-size: 24px;
        padding: 6px 12px;
    }
    
    .achievement-description {
        font-size: 14px;
        margin: 12px 0 0 0;
    }
    
    .achievement-date {
        font-size: 14px;
    }
}

@media (prefers-color-scheme: dark) {
    .chess-board-wrapper {
        background: rgba(33, 38, 45, 0.9);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    .chess-square.light {
        background: #c89c69;
    }
    
    .chess-square.dark {
        background: #7b5432;
    }
    
    .chess-square.selected {
        outline-color: rgba(255, 220, 120, 0.95);
        box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
    }
    
    .chess-piece {
        color: #f7f7f7;
    }
    
    .chess-message {
        background: rgba(33, 38, 45, 0.9);
        color: var(--text-primary);
        border: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    }
}

.tab-slider {
    position: absolute;
    height: calc(100% - 16px);
    background: var(--button-bg);
    border-radius: 8px;
    top: 8px;
    transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 0;
    /* Начальные размеры для корректной инициализации */
    width: 0;
    left: 0;
    will-change: transform, width, left;
}

/* Заглушка для правильного размера слайдера до загрузки JS */
.tab-toolbar:not(.loaded) .tab-slider {
    width: 33.333%;
    left: 0;
    transition: none;
}

/* Для мобильных устройств - показываем примерный размер */
@media (max-width: 768px) {
    .tab-toolbar:not(.loaded) .tab-slider {
        width: 33.333%;
        left: 0;
    }
}

/* Улучшенная поддержка для мобильных устройств */
@media (max-width: 768px) {
    .tab-slider {
        /* Более быстрая анимация для мобильных */
        transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
    }
    
    /* Принудительная перерисовка для мобильных браузеров */
    .tab-toolbar {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
    
    .tab-button {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}

/* Исправление для iOS Safari */
@supports (-webkit-touch-callout: none) {
    .tab-slider {
        /* Отключаем transition при первой загрузке */
        transition: none;
    }
    
    .tab-toolbar.loaded .tab-slider {
        /* Включаем transition после загрузки */
        transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
    }
}

.tab-button.active {
    color: var(--button-text);
}

.tab-button:not(.active):hover {
    color: var(--text-primary);
}

/* Games window */
.footer-bottom {
    max-width: 742px;
    margin: 8px auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.footer-bottom .footer-copyright {
    margin: 0;
}

.games-button {
    border: none;
    background: transparent;
    color: inherit;
    border-radius: 12px;
    padding: 6px;
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.games-button:hover {
    transform: translateY(-1px);
    background: rgba(0, 0, 0, 0.06);
}

.games-button:focus-visible {
    outline: 2px solid #0081FC;
    outline-offset: 3px;
}

.macos-window {
    position: fixed;
    left: 16px;
    top: 16px;
    width: min(640px, calc(100vw - 32px));
    height: min(70vh, 520px);
    background: rgba(20, 20, 22, 0.96);
    color: #e6e6e6;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 9000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.macos-window__resize-handle {
    position: absolute;
    z-index: 2;
}

.macos-window:not(.resize-enabled) .macos-window__resize-handle {
    pointer-events: none;
    opacity: 0;
}

.macos-window__resize-handle--n,
.macos-window__resize-handle--s {
    left: 10px;
    right: 10px;
    height: 8px;
}

.macos-window__resize-handle--n {
    top: 0;
    cursor: ns-resize;
}

.macos-window__resize-handle--s {
    bottom: 0;
    cursor: ns-resize;
}

.macos-window__resize-handle--e,
.macos-window__resize-handle--w {
    top: 10px;
    bottom: 10px;
    width: 8px;
}

.macos-window__resize-handle--e {
    right: 0;
    cursor: ew-resize;
}

.macos-window__resize-handle--w {
    left: 0;
    cursor: ew-resize;
}

.macos-window__resize-handle--ne,
.macos-window__resize-handle--nw,
.macos-window__resize-handle--se,
.macos-window__resize-handle--sw {
    width: 14px;
    height: 14px;
}

.macos-window__resize-handle--ne {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.macos-window__resize-handle--nw {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.macos-window__resize-handle--se {
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
}

.macos-window__resize-handle--sw {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

.macos-window.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.macos-window.is-dragging {
    cursor: grabbing;
    transition: none;
}

.macos-window__titlebar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 14px;
    background: rgba(28, 28, 30, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: grab;
    user-select: none;
    touch-action: none;
}


.macos-window__controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.macos-window__control {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    padding: 0;
    background: #ff5f57;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button.macos-window__control {
    cursor: pointer;
}

.macos-window__control--min {
    background: #febc2e;
}

.macos-window__control--zoom {
    background: #28c840;
}

.macos-window__title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.02em;
    pointer-events: none;
}

.macos-window__body {
    padding: 12px 16px 14px;
    background: linear-gradient(180deg, rgba(20, 20, 22, 0.95), rgba(16, 16, 18, 0.95));
    flex: 1;
    overflow: auto;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    scrollbar-width: thin;
}

.macos-window__body::-webkit-scrollbar {
    width: 8px;
    background: transparent;
}

.macos-window__body::-webkit-scrollbar-track {
    background: transparent;
}

.macos-window__body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

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

.macos-window__body::-webkit-scrollbar-corner {
    background: transparent;
}

.macos-window__code {
    margin: 0;
    font-family: "SF Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 0.65;
    color: #d6d6d6;
    tab-size: 2;
}

.macos-window__code .code-line {
    display: block;
    padding-left: 46px;
    position: relative;
    white-space: pre;
}

.macos-window__code .code-line::before {
    content: attr(data-line);
    position: absolute;
    left: 0;
    width: 32px;
    text-align: right;
    color: rgba(255, 255, 255, 0.35);
}

.macos-window__code .json-key {
    color: #93c5fd;
}

.macos-window__code .json-string {
    color: #f9a8d4;
}

.macos-window__code .json-number {
    color: #facc15;
}

.macos-window__code .json-literal {
    color: #34d399;
}

@media (max-width: 600px) {
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .macos-window {
        width: calc(100vw - 24px);
        max-height: 70vh;
        border-radius: 12px;
    }

    .macos-window__title {
        width: 70%;
    }

    .macos-window__control--close {
        position: relative;
        touch-action: manipulation;
    }

    .macos-window__control--close::before {
        content: "";
        position: absolute;
        top: -10px;
        right: -10px;
        bottom: -10px;
        left: -10px;
    }
}

 
