:root {
    --bg-color: #3e4a7c;
    --secbg-color: #4b699e;
    --main-bg-color: rgba(255, 255, 255, 0.05);
    --secondary-bg-color: rgba(255, 255, 255, 0.2);
    --accent-color: #9fc5f8;
    --text-color: #ffffff;
    --blur-bg: blur(6px);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: rgba(0, 0, 0, 0.25);
}

/* Ensure predictable sizing everywhere */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: "Nunito", sans-serif;
    font-weight: 500;
    font-style: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(var(--angle), var(--bg-color), var(--secbg-color), var(--accent-color));
    color: var(--text-color);
    position: relative;
    overflow: hidden;
    animation: fadeIn 2s forwards, rotate 10s linear infinite;
    background-attachment: fixed;
    background-size: cover;
    padding-top: 35px;
}

#video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    filter: brightness(0.4) saturate(1.2) hue-rotate(10deg);
}


.content-container {
    backdrop-filter: blur(50px);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    z-index: 1;
    transition: all 0.3s ease;
}

.content-container > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.content-container h1 {
    animation-delay: 0.2s;
}

.content-container h5 {
    animation-delay: 0.4s;
}

.content-container h2 {
    animation-delay: 0.6s;
}

.social-links {
    animation-delay: 0.8s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Контейнер переключателя */
.lang-switcher {
    position: fixed;
    top: 5px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 9999999;
}

/* Общий стиль кнопок */
.lang-btn {
    background-color: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Hover эффект */
.lang-btn:hover {
    background-color: rgba(255,255,255,0.1);
    color: #0f0; /* Можно выбрать любой акцентный цвет */
    transform: scale(1.05);
}

/* Иконка внутри кнопки */
.lang-btn i {
    font-size: 16px;
}


h1, h3, h5, h2 {
    color: var(--text-color);
    margin: 5px 0;
    opacity: 0;
    animation: fadeIn 2s forwards;
}

h1 {
    font-size: 2.5em;
}

.social-links {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    display: flex;
    gap: 20px;
    opacity: 0;
    animation: fadeIn 2s forwards 0.5s;
}

.cursor-line {
    position: fixed;
    width: 40px;
    height: 2px;
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
    border-radius: 1px;
    pointer-events: none;
    z-index: 9999;
    transform-origin: left center;
    transition: opacity 1s ease;
}

#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    color: #00ff00;
    font-family: monospace;
    font-size: 16px;
    padding: 20px;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: hidden;
    animation: fadeOut 1s ease 5.5s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}


@keyframes trail-fade {
    to {
        opacity: 0;
        transform: scale(2);
    }
}


.social-links a {
    background-color: var(--main-bg-color);
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1em;
    padding: 10px 16px;
    border: 2px solid var(--secondary-bg-color);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 160px;
    height: 42px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.social-links .link-text {
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

.social-links .link-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.link-icon {
    font-size: 25px;
}
.social-links a {
    background-color: var(--main-bg-color);
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1em;
    padding: 10px 16px;
    border: 2px solid transparent;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 160px;
    height: 50px;
    overflow: hidden;
    perspective: 800px;
    transform-style: preserve-3d;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    isolation: isolate;
}

.social-links a::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 180deg at 50% 50%, #0f0c29, #302b63, #24243e, #0f0c29);
    animation: spin-border 4s linear infinite;
    z-index: -1;
    filter: blur(16px);
    opacity: 0.3;
    transition: opacity 0.3s ease-in-out;
    border-radius: 12px;
}

.social-links a:hover::before {
    opacity: 0.6;
}

@keyframes spin-border {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.social-links a:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(36, 36, 62, 0.8);
    /*background-color: rgba(255, 255, 255, 0.08);*/
    background: conic-gradient(from 180deg at 50% 50%, #1a183f, #4b497e, #3b3a5a, #1a183f);

}

.social-links .link-text {
    transition: transform 0.3s ease;
    z-index: 2;
}

.social-links .link-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 2;
}

.social-links a:hover .link-text {
    transform: translateY(-200%);
    opacity: 0;
}

.social-links a:hover .link-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.3);
}

.move-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.5em;
    display: none;
    animation: fadeIn 2s forwards;
}

.projects-container {
    display: none;
    backdrop-filter: blur(30px);
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
    max-width: 600px;
    width: 90%;
}

.project-item {
    background-color: var(--main-bg-color);
    padding: 18px;
    margin: 10px;
    border-radius: 12px;
    color: var(--text-color);
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 800px;
    will-change: transform;
    isolation: isolate;
}

.project-item::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg at 50% 50%, #0f0c29, #302b63, #24243e, #0f0c29);
    animation: rotateProject 5s linear infinite;
    filter: blur(20px);
    opacity: 0.2;
    z-index: -1;
    transition: opacity 0.3s;
    border-radius: 12px;
}

.project-item:hover::before {
    opacity: 0.4;
}

.project-item:hover {
    transform: scale(1.03);
    box-shadow: 0 0 20px rgba(36, 36, 62, 0.7);
    background-color: rgba(255, 255, 255, 0.07);
}

.project-description {
    display: block;
    font-size: 0.85em;
    color: #ccc;
    margin-top: 5px;
}

@keyframes rotateProject {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.project-description {
    display: block;
    font-size: 0.8em;
    color: #ececec;
    margin-top: 5px;
}

#projects-button.active {
    background-color: #6d8ec9;
    border-color: #ececec;
}

.back-button {
    background-color: var(--main-bg-color);
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1em;
    padding: 10px 16px;
    border: 2px solid transparent;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 160px;
    height: 50px;
    overflow: hidden;
    perspective: 800px;
    transform-style: preserve-3d;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    isolation: isolate;
}

.back-button::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg at 50% 50%, #0f0c29, #302b63, #24243e, #0f0c29);
    animation: spinBack 5s linear infinite;
    filter: blur(20px);
    opacity: 0.25;
    z-index: -1;
    border-radius: 12px;
    transition: opacity 0.3s ease;
}

.back-button:hover::before {
    opacity: 0.45;
}

.back-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(36, 36, 62, 0.7);
    background-color: rgba(255, 255, 255, 0.08);
}

@keyframes spinBack {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

#c-hints {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.6;
    background: #222;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    z-index: 999;
    pointer-events: none;
}

#terminal-resizer {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    cursor: ns-resize;
    width: 100%;
}

.terminal-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 200px;
    max-height: 95vh; /* не больше 90% экрана */
    height: 600px; /* начальная высота */
    background: rgba(10, 10, 10, 0.9);
    color: #00ffcc;
    font-family: monospace;
    font-size: 14px;
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(10px);
}

#terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: #00ffcc;
    font-family: monospace;
    font-size: 14px;
    width: 100%;
}

.terminal-output {
    overflow-y: auto;
    flex-grow: 1;
    white-space: pre-wrap;
    line-height: 1.3em;
}

.terminal-line {
    margin-bottom: 4px;
}

.terminal-line .user-host {
    color: #00dfff;
    font-weight: bold;
}

.terminal-line .command {
    color: #ffd700;
    font-style: italic;
}

.terminal-banner {
    font-family: monospace;
    white-space: pre;
    font-size: 14px;
    color: #00ff00;
    margin: 0;
    padding: 10px;
}

.qr {
    display: inline-block;
    line-height: 0;
}

.qr-row {
    display: flex;
}

.qr-cell {
    width: 8px; /* размер блока */
    height: 8px;
    display: inline-block;
}

.qr-cell.empty {
    background: #111; /* фон терминала */
}

.ubuntu-topbar {
    height: 35px;
    width: 100%;
    background-color: #333;
    display: flex;
    align-items: center;
    padding: 0 15px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Контейнер для кнопок слева и "отступа" справа */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

/* Кнопки Ubuntu */
.topbar-left .btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.topbar-left .close { background-color: #ff5f57; }
.topbar-left .minimize { background-color: #ffbd2e; }
.topbar-left .maximize { background-color: #28c840; }

/* Заголовок: центрируем по оставшемуся пространству */
.ubuntu-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-70%, -50%); /* сдвигаем по X и по Y на половину размера */

/* ===== Spotify Widget ===== */
.spotify-widget{
    display:flex; gap:16px; align-items:center; margin:18px auto 10px; padding:14px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px; backdrop-filter: blur(18px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    max-width: 680px; width: 90%;
}
.spotify-artwork{ position:relative; width:72px; height:72px; flex:0 0 72px; }
.spotify-artwork img{ width:100%; height:100%; object-fit:cover; border-radius:12px; border:1px solid rgba(255,255,255,0.15); }
.sp-status-badge{ position:absolute; left:6px; bottom:6px; font-size:10px; padding:2px 6px; border-radius:999px; background:#1db954; color:#000; text-transform:uppercase; letter-spacing:.06em; }
.spotify-widget:not(.is-playing) .sp-status-badge{ background:#999; color:#111; }
.spotify-info{ flex:1 1 auto; min-width:0; }
.sp-title{ font-weight:800; font-size:1.05rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sp-artists{ opacity:.9; font-size:.95rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sp-album{ opacity:.8; font-size:.9rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sp-progress{ margin-top:8px; }
.sp-progress-bar{ position:relative; height:6px; background:rgba(255,255,255,0.15); border-radius:999px; overflow:hidden; }
.sp-progress-bar span{ position:absolute; left:0; top:0; bottom:0; width:0; background:linear-gradient(90deg, #1db954, #1ed760); box-shadow:0 0 12px rgba(29,185,84,.4) inset; }
.sp-times{ display:flex; justify-content:space-between; font-size:.8rem; opacity:.85; margin-top:4px; }
.spotify-actions{ flex:0 0 auto; }
.spotify-actions .sp-open{ display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; border-radius:12px; background:rgba(29,185,84,0.15); color:#1db954; border:1px solid rgba(29,185,84,0.4); transition:all .2s; }
.spotify-actions .sp-open:hover{ transform:scale(1.06); background:rgba(29,185,84,0.25); }
    font-size: 14px;
    font-weight: 600;
    color: #eee;
    pointer-events: none;
}


#terminal-output {
    overflow-y: auto;
    padding-right: 8px;
}

/* для WebKit браузеров (Chrome, Safari, Edge Chromium) */
#terminal-output::-webkit-scrollbar {
    width: 10px; /* ширина полосы прокрутки */
}

#terminal-output::-webkit-scrollbar-track {
    background: #1a1a1a; /* фон дорожки */
    border-radius: 5px;
}

#terminal-output::-webkit-scrollbar-thumb {
    background-color: #00ff88;
    border-radius: 5px;
    border: 2px solid #1a1a1a;
}

/* Firefox */
#terminal-output {
    scrollbar-width: thin;
    scrollbar-color: #00ff88 #1a1a1a;
}

#turnstile-container {
    display: none;
    margin-top: 1em;
    padding: 10px;
    background-color: rgba(15, 15, 15, 0.9);
    border: 1px solid #333;
    border-radius: 6px;
    width: fit-content;
    font-family: monospace;
    color: #0f0;
    text-align: center;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.2);
    animation: fadeIn 0.3s ease-in-out;
}


#no-js-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 1.5rem;
    margin: 0;
    background-color: #ff4444;
    color: white;
    font-family: 'Nunito', sans-serif;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.5s ease-out;
}

#no-js-notification a {
    color: #fff;
    text-decoration: underline;
    font-weight: bold;
    transition: opacity 0.2s;
}

#no-js-notification a:hover {
    opacity: 0.8;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes rotate {
    to {
        --angle: 360deg;
    }
}

@property --angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@media (max-width: 768px) {
    /* Prevent any horizontal overflow on small screens */
    html, body { overflow-x: hidden; }

    /* Content container fits viewport with padding */
    .content-container {
        width: 100%;
        max-width: calc(100% - 20px);
        margin: 8px auto;
        padding: 10px;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Make sure children are visible even if animations haven't run */
    .content-container > * {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        visibility: visible !important;
    }

    /* Responsive grid for social buttons */
    .social-links {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .social-links li { width: 100%; margin: 0; padding: 0; }

    /* Buttons: full width inside grid cells, don't exceed container */
    .social-links a {
        width: 95% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 8px 10px !important;
        font-size: 0.95em !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        height: auto !important;
    }

    .social-links .link-text {
        display: inline-block;
        max-width: 85%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Reduce heavy visual effects on small screens */
    .social-links a::before { opacity: 0.25; filter: blur(10px); }

    /* Make other wide components adapt */
    .back-button,
    .social-card,
    .project-item,
    .project-card {
        width: 94% !important;
        max-width: 100% !important;
        height: auto !important;
        box-sizing: border-box;
    }

    /* Force visibility for social links and children on mobile */
    .social-links {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    .social-links a, .social-links li {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }
}

/* Small-screen fallback: allow wrapping and single-column buttons */
@media (max-width: 360px) {
    .social-links { grid-template-columns: 1fr !important; gap: 6px; }
    .social-links a { white-space: normal !important; padding: 8px 8px !important; }
    .social-links .link-text { white-space: normal !important; max-width: 100% !important; }
}

@media (min-width: 769px) {
    .move-icon {
        display: block;
    }
}