/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--accent-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    font-weight: 500;
}

.skip-link:focus {
    top: 6px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .tabs-container {
        transition: none !important;
    }
    
    .nav-content {
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #ffffff;
        --text-secondary: #ffffff;
    }
    
    [data-theme="light"] {
        --border-color: #000000;
        --text-secondary: #000000;
    }
}

/* Focus indicators */
*:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

button:focus,
a:focus,
select:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f1419;
    --bg-elevated: #252a3a;
    --text-primary: #ffffff;
    --text-secondary: #a8b2d1;
    --text-muted: #6b7280;
    --accent-primary: #58cc02;
    --accent-hover: #4caf02;
    --accent-light: #7dd321;
    --accent-glow: rgba(88, 204, 2, 0.3);
    --border-color: #2d3748;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --google-play: #01875f;
    --app-store: #007aff;
    --youtube: #ff0000;
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-elevated: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --accent-glow: rgba(88, 204, 2, 0.2);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

/* Performance optimizations */
.tetris-background,
.tabs-container,
.nav-content {
    will-change: transform;
}

/* Improve font rendering */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    position: relative;
    overflow-x: hidden;
    overscroll-behavior: none;
}

.tetris-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
    pointer-events: none;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 100;
    padding: var(--spacing-md);
}

.settings-btn {
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background: var(--bg-elevated);
    box-shadow: var(--shadow-md);
}

.hint-bubble {
    position: absolute;
    top: 60px;
    right: -20px;
    background: var(--accent-primary);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-width: 200px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.hint-bubble.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.hint-close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.hint-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hint-text {
    margin: 0;
    padding-right: 20px;
    line-height: 1.4;
}

.hint-arrow {
    position: absolute;
    top: -8px;
    right: 30px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--accent-primary);
}

.settings-icon {
    font-size: 20px;
}

.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.tabs-container {
    display: flex;
    width: 300%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-33.333%);
}

.tab-content {
    width: 33.333%;
    min-height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    padding: var(--spacing-lg) var(--spacing-md);
    padding-bottom: 100px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* Custom scrollbar styling */
.tab-content::-webkit-scrollbar {
    width: 6px;
}

.tab-content::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.tab-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.tab-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Firefox scrollbar */
.tab-content {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-primary);
}

.home-container {
    max-width: 480px;
    margin: 0 auto;
    padding-top: var(--spacing-xl);
}

.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
}

.profile-avatar {
    margin-bottom: var(--spacing-lg);
}

/* Improve image loading */
.avatar-image,
.project-thumbnail {
    loading: lazy;
}

.avatar-image {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    border: 3px solid var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.profile-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.profile-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: var(--spacing-md);
}

.profile-bio {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.contact-section {
    margin-top: var(--spacing-lg);
}

.contact-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.contact-pill {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    min-height: 56px;
}

.contact-pill:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.contact-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.section-container {
    max-width: 480px;
    margin: 0 auto;
    padding-top: var(--spacing-xl);
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-xl);
    color: var(--text-primary);
}

.experience-list,
.projects-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.experience-card,
.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    cursor: pointer;
    tabindex: 0;
}

.project-card {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.experience-card:hover,
.project-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.experience-card:focus,
.project-card:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.project-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.project-content {
    flex: 1;
    min-width: 0;
}

.experience-card.education {
    border-left: 4px solid var(--accent-primary);
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-xs);
    gap: var(--spacing-sm);
}

.job-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.project-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.project-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-sm) 0;
    line-height: 1.4;
}

.project-company {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.project-role {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 var(--spacing-sm) 0;
    line-height: 1.3;
}

.job-period {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.company-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.job-description {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.project-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
    justify-content: flex-start;
}

.project-badges:has(.badge:only-child) {
    justify-content: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    height: 40px;
    width: 135px;
}

.badge img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.badge:hover {
    opacity: 0.8;
}

.badge.youtube {
    height: 40px;
}

.badge.github {
    background: #333;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    height: 40px;
    width: 135px;
}

.badge.github:hover {
    background: #24292e;
    transform: translateY(-2px);
}

.badge.github i {
    font-size: 16px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 50;
    height: 80px;
}

.nav-section {
    flex: 1;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.nav-section.active .nav-content {
    transform: translateY(-8px) scale(1.05);
    color: var(--accent-primary);
    filter: drop-shadow(0 0 16px var(--accent-glow)) drop-shadow(0 4px 8px rgba(88, 204, 2, 0.4));
}

.nav-section:hover .nav-content {
    transform: translateY(-4px) scale(1.02);
    color: var(--accent-light);
}

.pixel-icon {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: contrast(1.5) brightness(1.2);
    text-shadow: 1px 1px 0px rgba(0,0,0,0.8);
}

.nav-icon {
    font-size: 24px;
    transition: all 0.3s ease;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
}

.settings-modal.active {
    display: block;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--bg-elevated);
}

.modal-body {
    padding: var(--spacing-lg);
}

.setting-item {
    margin-bottom: var(--spacing-lg);
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.setting-select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
}

/* Better mobile touch targets */
@media (max-width: 767px) {
    .nav-section {
        min-height: 44px;
        min-width: 44px;
    }
    
    .settings-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .contact-pill {
        min-height: 44px;
    }
}

@media (min-width: 768px) {
    .home-container,
    .section-container {
        max-width: 600px;
        padding-top: 60px;
    }
    
    .contact-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .experience-list,
    .projects-list {
        gap: var(--spacing-lg);
    }
    
    .bottom-nav {
        height: 90px;
    }
    
    .nav-section {
        padding: var(--spacing-md);
    }
}