:root {
    /* Warm Gray Color Palette - Light Mode (Default) */
    --bg-color: linear-gradient(135deg, var(--hinana-yellow-light), var(--noctchill-sky));
    --card-bg: #ffffff;
    --text-primary: #2d2d2d;
    --text-secondary: #666666;
    --accent-color: #7c8c9c;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --hover-shadow: rgba(0, 0, 0, 0.12);
    --skill-bg: rgba(124, 140, 156, 0.1);
    --skill-text: #5a6e7c;
    
    /* Hinana × noctchill Theme Colors - Light Mode */
    --hinana-yellow: #FFF9D0;
    --hinana-yellow-light: #FFFEF5;
    --noctchill-blue: #92B2FF;
    --noctchill-sky: #8AD3FF;
    --noctchill-glow: #B6FFFD;
    
    /* Spacing & Sizing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --max-width: 600px;
    --header-height: 44px; /* Minimum touch target size */
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Noctchill Bioluminescent Theme - Dark Mode */
        --bg-color: linear-gradient(135deg, #0A1628, #1A3A5C);
        --card-bg: #1A3A5C;
        --text-primary: #E8F4F8;
        --text-secondary: #A8C5D0;
        --accent-color: #71FFF1;
        --shadow-color: rgba(0, 0, 0, 0.4);
        --hover-shadow: rgba(113, 255, 241, 0.2);
        --skill-bg: rgba(113, 255, 241, 0.15);
        --skill-text: #B6FFFD;

        /* Hinana × noctchill Theme Colors - Dark Mode */
        --hinana-yellow: #3D3A2E;
        --hinana-yellow-light: #2A2820;
        --noctchill-blue: #4A6CB3;
        --noctchill-sky: #3A8BC2;
        --noctchill-glow: #71FFF1;

        /* Wave Colors - Dark Mode */
        --wave-color-1: #1A3A5C;
        --wave-color-2: #0D4A6B;
        --wave-color-3: #0A1628;
    }

    /* Wave Layers - Dark Mode Overrides */
    .layer1 {
        fill: var(--wave-color-1);
    }

    .layer2 {
        fill: var(--wave-color-2);
    }

    .layer3 {
        fill: var(--wave-color-3);
    }
}

/* Global Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-md);
    transition: background 0.3s ease, color 0.3s ease;
    /* iOS Safe Area Support */
    padding-top: max(var(--spacing-lg), env(safe-area-inset-top));
    padding-bottom: max(var(--spacing-lg), env(safe-area-inset-bottom));
}

/* Layout Container */
header, main, footer {
    width: 100%;
    max-width: var(--max-width);
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Star Particles */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star {
    position: absolute;
    background-color: var(--noctchill-glow);
    border-radius: 50%;
    opacity: 0.2;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 0 4px var(--noctchill-glow);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

.star.twinkle {
    animation: twinkle var(--twinkle-duration, 3s) infinite ease-in-out;
    animation-delay: var(--twinkle-delay, 0s);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Header Section */
header {
    margin-bottom: var(--spacing-xl);
}

.avatar-container {
    margin-bottom: var(--spacing-md);
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--card-bg);
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.avatar:hover {
    transform: scale(1.05);
}

.name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.5px;
}

.name-english {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.signature {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.9;
}

/* Skills Section */
.skills-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.skill-tag {
    background-color: var(--skill-bg);
    color: var(--skill-text);
    padding: 6px 14px;
    border-radius: var(--border-radius-lg);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.skill-tag:hover {
    transform: translateY(-2px);
    background-color: var(--accent-color);
    color: white;
}

/* Link Cards */
.links-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.link-card {
    display: flex;
    align-items: center;
    justify-content: center; /* Center content */
    position: relative;
    background-color: var(--card-bg);
    color: var(--text-primary);
    text-decoration: none;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-height: 56px; /* Ensure >44px touch target */
    font-weight: 600;
}

.link-card i {
    font-size: 1.25rem;
    position: absolute;
    left: var(--spacing-lg);
    color: var(--accent-color);
    transition: transform 0.3s ease;
}

.link-card span {
    flex: 1;
    text-align: center;
}

.link-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 8px 16px var(--hover-shadow);
}

.link-card:hover i {
    transform: scale(1.1) rotate(-5deg);
    color: var(--text-primary);
}

.link-card:active {
    transform: translateY(-2px) scale(0.99);
}

/* Footer */
footer {
    margin-top: var(--spacing-xl);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Keyframes Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes wave-flow {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.waves {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 25vh;
    min-height: 150px;
}

.wave-layer {
    fill-opacity: 0.4;
    will-change: transform;
}

.layer1 {
    fill: var(--hinana-yellow-light);
    animation: wave-flow 12s cubic-bezier(0.36, 0.45, 0.63, 0.53) infinite;
}

.layer2 {
    fill: var(--noctchill-sky);
    animation: wave-flow 10s cubic-bezier(0.36, 0.45, 0.63, 0.53) infinite;
    animation-delay: -2s;
    opacity: 0.6;
}

.layer3 {
    fill: var(--noctchill-blue);
    animation: wave-flow 8s cubic-bezier(0.36, 0.45, 0.63, 0.53) infinite;
    animation-delay: -4s;
    opacity: 0.3;
}

.fade-in {
    opacity: 0; /* Initially hidden */
    animation: fadeInUp 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

/* Staggered Animation Delays */
header.fade-in { animation-delay: 0.1s; }
.skills-section.fade-in { animation-delay: 0.2s; }
.links-section .link-card:nth-child(1) { animation-delay: 0.3s; }
.links-section .link-card:nth-child(2) { animation-delay: 0.4s; }
.links-section .link-card:nth-child(3) { animation-delay: 0.5s; }
.links-section .link-card:nth-child(4) { animation-delay: 0.6s; }
footer.fade-in { animation-delay: 0.8s; }

/* Responsive Media Queries */
@media (max-width: 480px) {
    /* Mobile Styles */
    :root {
        --spacing-lg: 20px;
        --spacing-md: 12px;
    }
    
    .name {
        font-size: 1.75rem;
    }
    
    .avatar {
        width: 100px;
        height: 100px;
    }
    
    .link-card {
        padding: 14px 20px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    /* Tablet Styles */
    :root {
        --max-width: 500px;
    }
}

@media (min-width: 769px) {
    /* Desktop Styles */
    body {
        justify-content: center; /* Vertically center on large screens */
    }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .fade-in {
        opacity: 1;
        animation: none;
    }
    
    .link-card:hover {
        transform: none;
    }
}
