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

body {
    font-family: 'Consolas', 'SF Mono', 'Menlo', 'Ubuntu Mono', monospace;
    background: #0a0a0a;
    color: #00ff41;
    line-height: 1.4;
    overflow-x: hidden;
}

/* Matrix-style background pattern */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(0, 255, 65, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

.scanlines::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(transparent 50%, rgba(0, 255, 65, 0.03) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1000;
    will-change: transform;
    transform: translateZ(0);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.terminal-window {
    border: 2px solid #00ff41;
    background: rgba(0, 20, 0, 0.9);
    margin: 20px 0;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
    opacity: 0;
    animation: fadeIn 0.5s ease-in forwards;
}

.terminal-window:nth-child(1) { animation-delay: 0.1s; }
.terminal-window:nth-child(2) { animation-delay: 0.2s; }
.terminal-window:nth-child(3) { animation-delay: 0.3s; }
.terminal-window:nth-child(4) { animation-delay: 0.4s; }
.terminal-window:nth-child(5) { animation-delay: 0.5s; }
.terminal-window:nth-child(6) { animation-delay: 0.6s; }

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

.terminal-header {
    background: #002200;
    color: #c8ffc8;
    padding: 3px 5px;
    border-bottom: 1px solid #00ff41;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    user-select: none;
    cursor: default;
}

.win-title {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.win-controls {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.win-btn {
    width: 16px;
    height: 14px;
    background: #001400;
    color: #00ff41;
    border-top: 1px solid #00ff41;
    border-left: 1px solid #00ff41;
    border-right: 1px solid #004400;
    border-bottom: 1px solid #004400;
    font-size: 9px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-family: inherit;
    line-height: 1;
}

.win-btn:hover {
    background: #00ff41;
    color: #000;
}

.win-btn:active {
    border-top: 1px solid #004400;
    border-left: 1px solid #004400;
    border-right: 1px solid #00ff41;
    border-bottom: 1px solid #00ff41;
}

.terminal-window.minimized > .terminal-content {
    display: none;
}

.terminal-window.closed {
    display: none;
}

.terminal-content {
    padding: 20px;
}

.terminal-content pre {
    overflow-x: auto;
    max-width: 100%;
}

.ascii-art {
    color: #00ffff;
    display: flex;
    justify-content: center;
    margin: 20px 0;
    text-shadow: 0 0 10px #00ffff;
    overflow: hidden;
    padding: 0 4px;
}

.ascii-art pre {
    font-size: clamp(4px, 1vw, 8px);
    line-height: 1;
    white-space: pre;
    text-align: left;
    margin: 0;
    overflow-x: hidden;
    max-width: none;
}

.glitch {
    animation: glitch 2s infinite;
}

@keyframes glitch {
    0%, 100% {
        transform: translateX(0);
    }
    10% {
        transform: translateX(-2px);
        color: #ff0040;
    }
    20% {
        transform: translateX(2px);
        color: #00ff41;
    }
    30% {
        transform: translateX(-1px);
        color: #ffff00;
    }
    40% {
        transform: translateX(1px);
        color: #00ff41;
    }
}

.nav-menu {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.nav-item {
    color: #00ff41;
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid #00ff41;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item:hover {
    background: #00ff41;
    color: #000;
    box-shadow: 0 0 15px #00ff41;
    transform: translateY(-2px);
}

.nav-item:focus {
    outline: 2px solid #00ff41;
    outline-offset: 2px;
}

.section-title {
    color: #ff6677;
    font-size: 18px;
    margin: 30px 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

.skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.skill-item {
    border: 1px solid #00ff41;
    padding: 15px;
    background: rgba(0, 255, 65, 0.05);
    transition: all 0.3s ease;
}

.skill-item:hover {
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    transform: translateY(-3px) scale(1.02);
}

.contact-info {
    text-align: center;
    margin: 30px 0;
}

.contact-info a {
    color: #00ffff;
    text-decoration: none;
    transition: all 0.3s ease;
}

.contact-info a:hover {
    text-shadow: 0 0 10px #00ffff;
}

.contact-info a:focus {
    outline: 2px solid #00ffff;
    outline-offset: 2px;
}

.typing {
    border-right: 2px solid #00ff41;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% {
        border-color: #00ff41;
    }
    51%, 100% {
        border-color: transparent;
    }
}

/* Accessibility - Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .glitch,
    .typing {
        animation: none;
    }
    
    .scanlines::before {
        display: none;
    }
    
    .terminal-window {
        opacity: 1;
        animation: none;
    }
    
    .nav-item:hover,
    .skill-item:hover {
        transform: none;
    }
}

/* Tablet styles */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .skill-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .container {
        padding: 15px;
    }
    
    .terminal-content {
        padding: 15px;
    }
}

/* Mobile styles */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .terminal-content {
        padding: 15px;
    }

    .nav-item {
        padding: 8px 16px;
        font-size: 14px;
    }

    .section-title {
        font-size: 16px;
        letter-spacing: 1px;
    }

    .skill-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .terminal-header {
        font-size: 10px;
        padding: 3px 5px;
    }

    .login-body {
        padding: 16px;
    }

    .login-banner {
        font-size: 11px;
        margin-bottom: 16px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .terminal-window {
        border-width: 3px;
    }
    
    .nav-item {
        border-width: 2px;
    }
    
    .skill-item {
        border-width: 2px;
    }
}

/* Login screen */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #0a0a0a;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.5s ease;
}

#login-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.login-window {
    border: 2px solid #00ff41;
    background: rgba(0, 20, 0, 0.97);
    box-shadow: 0 0 40px rgba(0, 255, 65, 0.3);
    width: 480px;
    max-width: 90vw;
}

.login-window .login-header {
    background: #002200;
    color: #c8ffc8;
    padding: 3px 5px;
    border-bottom: 1px solid #00ff41;
    font-size: 12px;
}

.login-body {
    padding: 24px;
    font-size: 14px;
}

.login-banner {
    color: #00ffff;
    margin: 0 0 24px;
    line-height: 1.5;
    font-size: 13px;
    overflow-x: auto;
}

.login-prompt {
    display: flex;
    align-items: center;
    margin: 6px 0;
    color: #00ff41;
}

.login-prompt input {
    background: transparent;
    border: none;
    outline: none;
    color: #00ff41;
    font-family: inherit;
    font-size: inherit;
    caret-color: #00ff41;
    flex: 1;
    min-width: 0;
}

#login-output {
    margin-top: 16px;
    line-height: 1.9;
    font-size: 13px;
}

.login-hint {
    color: #2a3d2a;
    font-size: 11px;
    margin-top: 16px;
}

.login-hint.ready {
    color: #00ff41;
    cursor: pointer;
    animation: hint-blink 1s infinite;
}

@keyframes hint-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.3; }
}

/* Print styles */
@media print {
    #login-screen,
    .scanlines::before,
    .glitch {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    body::after {
        display: none;
    }
    
    .terminal-window {
        border: 1px solid black;
        box-shadow: none;
        background: white;
    }
    
    .terminal-header {
        background: #f0f0f0;
    }
    
    .section-title {
        color: black;
    }
    
    .skill-item {
        background: #f9f9f9;
        border: 1px solid black;
    }
    
    .nav-item {
        border: 1px solid black;
        color: black;
    }
    
    .ascii-art,
    .contact-info {
        color: black;
    }
    
    pre {
        color: black !important;
    }
}

/* Focus indicators for better keyboard navigation */
.terminal-window:focus-within {
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.4);
}

/* Smooth scrolling for the whole page */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Selection styling */
::selection {
    background: rgba(0, 255, 65, 0.3);
    color: #ffffff;
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #00ff41;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00ffff;
}