*, *::before, *::after {
    box-sizing: border-box;
}

@property --animation-reduced {
    syntax: "*";
    inherits: false;
    initial-value: none;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: var(--animation-reduced) !important;
    }
}

html {
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
    overflow-anchor: none !important;
}

html, body {
    font-family: 'Inter', system-ui, sans-serif;
    overflow-x: clip;
    max-width: 100vw;
    overflow-anchor: none !important;
}

#portfolioMainContent, #portfolioMainContent > section {
    overflow-anchor: none !important;
    margin-top: 0 !important;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.35);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.65);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.progress-bar-fill {
    transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-interactive {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-interactive:hover {
    transform: translateY(-1.5px);
}

.btn-interactive:active {
    transform: translateY(0px) scale(0.96);
}

.card-hover-lift {
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.26s ease, border-color 0.26s ease;
}

.card-hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 30px -12px rgba(16, 185, 129, 0.14);
}

.sidebar-nav-btn {
    border: 1px solid transparent;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-nav-btn.is-active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(20, 184, 166, 0.12));
    color: #059669;
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 4px 14px -2px rgba(16, 185, 129, 0.22);
    position: relative;
}

.dark .sidebar-nav-btn.is-active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(20, 184, 166, 0.16));
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 4px 18px -2px rgba(16, 185, 129, 0.3);
}

.sidebar-nav-btn.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}

.filter-pill-btn.is-active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border-color: rgba(16, 185, 129, 0.6);
    box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.35);
}

.ide-tab-btn.is-active {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-bottom: 2px solid #10b981;
}

.ide-code-line, .ide-line-content {
    overflow: visible !important;
}

.syn-kw   { color: #c084fc; font-weight: 700; }
.syn-cls  { color: #38bdf8; font-weight: 700; }
.syn-type { color: #2dd4bf; font-weight: 600; }
.syn-prop { color: #93c5fd; }
.syn-str  { color: #34d399; }
.syn-num  { color: #fbbf24; font-weight: 700; }
.syn-fn   { color: #60a5fa; font-weight: 700; }
.syn-ns   { color: #a78bfa; }
.syn-cmt  { color: #64748b; font-style: italic; }

/* Tło ambientowe & siatka cybernetyczna */
.bg-cyber-grid {
    background-image: radial-gradient(rgba(148, 163, 184, 0.22) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(ellipse at 50% 25%, black 45%, transparent 92%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 25%, black 45%, transparent 92%);
}

.dark .bg-cyber-grid {
    background-image: radial-gradient(rgba(52, 211, 153, 0.14) 1px, transparent 1px);
    background-size: 28px 28px;
}

/* ================= SUPER ANIMACJE: PRZEJŚCIA ZAKŁADEK (BEZ PRZESUWANIA W DÓŁ) ================= */
@keyframes tabSmoothSwitch {
    0% {
        opacity: 0.15;
    }
    100% {
        opacity: 1;
    }
}

.tab-panel-animate {
    animation: tabSmoothSwitch 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: opacity;
    transform: none !important;
}

.tab-panel-animate > * {
    transform: none !important;
}

/* Płynne wejście sekcji podczas przewijania (Scroll Reveal) */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.42s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed,
.tab-panel-animate .reveal-on-scroll,
main > section:not(.hidden) {
    opacity: 1;
    transform: none !important;
}

@keyframes modalPopIn {
    0% { opacity: 0; transform: scale(0.95) translateY(8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-animate-in {
    animation: modalPopIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    --animation-reduced: none;
}

@keyframes eqBarBounce {
    0%, 100% { transform: scaleY(0.35); }
    50% { transform: scaleY(1); }
}

.coding-wave-bar {
    transform-origin: bottom;
    animation: eqBarBounce 0.9s ease-in-out infinite;
    --animation-reduced: none;
}

.coding-wave-bar:nth-child(2) { animation-delay: 0.18s; }
.coding-wave-bar:nth-child(3) { animation-delay: 0.36s; }
.coding-wave-bar:nth-child(4) { animation-delay: 0.12s; }

#mainSidebar.sidebar-collapsed {
    width: 4.5rem !important;
}

#mainSidebar.sidebar-collapsed .sidebar-text,
#mainSidebar.sidebar-collapsed .sidebar-header-text,
#mainSidebar.sidebar-collapsed .sidebar-badge,
#mainSidebar.sidebar-collapsed .sidebar-footer-text,
#mainSidebar.sidebar-collapsed .sidebar-action-btn > svg.opacity-60 {
    display: none !important;
}

#mainSidebar.sidebar-collapsed .sidebar-nav-btn,
#mainSidebar.sidebar-collapsed .sidebar-action-btn {
    justify-content: center !important;
    align-items: center !important;
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
    width: 100% !important;
}

#mainSidebar.sidebar-collapsed .sidebar-nav-btn > span:first-child,
#mainSidebar.sidebar-collapsed .sidebar-action-btn > span:first-child {
    justify-content: center !important;
    align-items: center !important;
    margin: 0 auto !important;
    gap: 0 !important;
}

#mainSidebar.sidebar-collapsed .sidebar-footer-box {
    padding: 0.5rem 0.25rem !important;
}

#mainSidebar.sidebar-collapsed .sidebar-footer-box > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.5rem !important;
}

#mainSidebar.sidebar-collapsed #sidebarCollapseBtn {
    margin: 0 auto !important;
}

#miniYoutubePlayer {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

#miniYoutubeMinimizedPill {
    animation: modalPopIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 1023px) {
    #mainSidebar {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        z-index: 70 !important;
        width: 18rem !important;
        max-width: 85vw !important;
        height: 100dvh !important;
        border-radius: 0 1.5rem 1.5rem 0 !important;
        transform: translate3d(-100%, 0, 0) !important;
        transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.24s !important;
        margin: 0 !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.55) !important;
    }
    #mainSidebar.mobile-open {
        transform: translate3d(0, 0, 0) !important;
        pointer-events: auto !important;
        visibility: visible !important;
    }
}

html.modal-open,
html.mobile-sidebar-locked {
    overflow: hidden !important;
}

#lidarScannerCanvas {
    cursor: crosshair;
    touch-action: none;
}

/* Ochrona praw autorskich astrofotografii przed kradzieżą */
.astro-protected-image {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.astro-photo-shield {
    position: absolute;
    inset: 0;
    z-index: 15;
    background: transparent;
    user-select: none;
    -webkit-user-select: none;
}
