/* Font faces */
@font-face {
    font-family: 'Noto Sans';
    src: url('/fonts/NotoSans-Variable.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Sans JP';
    src: url('/fonts/NotoSansJP-Variable.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Sans KR';
    src: url('/fonts/NotoSansKR-Variable.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Sans SC';
    src: url('/fonts/NotoSansSC-Variable.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Sans TC';
    src: url('/fonts/NotoSansTC-Variable.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* CSS Variables for theming */
:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f8;
    --bg-tertiary: #f0f0f0;
    --text-primary: #000000;
    --text-secondary: #333333;
    --accent-color: #000000;
}

/* Dark theme colors */
[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #111111;
    --bg-tertiary: #222222;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --accent-color: #ffffff;
}

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

body {
    font-family: 'Noto Sans', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans SC', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Safari fallback */
@supports (-webkit-backdrop-filter: blur(1px)) {
    .header {
        background-color: rgba(255, 255, 255, 0.3);
    }
    
    [data-theme="dark"] .header {
        background-color: rgba(0, 0, 0, 0.3);
    }
}

[data-theme="dark"] .header {
    background-color: rgba(0, 0, 0, 0.5);
}

.header .container {
    max-width: 900px;
}

@media (min-width: 1400px) {
    .header .container {
        max-width: 1000px;
    }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    color: var(--text-primary);
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

.language-selector {
    position: relative;
}

.language-selector select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.5rem 1.25rem 0.5rem 0.75rem;
    border-radius: 0;
    font-size: 0.875rem;
    cursor: pointer;
    transition: color 0.2s ease;
    min-width: 80px;
}

.language-selector::after {
    content: "▼";
    position: absolute;
    right: 0.375rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.5rem;
    color: var(--text-secondary);
}

.language-selector select:hover {
    color: var(--text-secondary);
}

.language-selector select:focus {
    outline: none;
}

/* Apps Section */
.apps-section {
    flex: 1;
    padding-top: 7rem;
    padding-bottom: 4rem;
}

.apps-section .container {
    max-width: 900px;
}

@media (min-width: 1400px) {
    .apps-section .container {
        max-width: 1000px;
    }
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.app-card {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 3rem 2rem 1.5rem;
    background-color: var(--bg-secondary);
    border: none;
    border-radius: 2rem;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.app-card:hover {
    transform: scale(1.02);
    background-color: var(--bg-tertiary);
}

.app-card-link,
.app-card-link:hover,
.app-card-link:focus,
.app-card-link:visited,
.app-card-link * {
    text-decoration: none;
}

.app-card-link {
    display: block;
    color: inherit;
    cursor: pointer;
}

.app-card-link:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 1rem;
}

.app-card-icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    object-fit: contain;
    margin: 0 auto 1.5rem auto;
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.app-card-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.app-card-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 320px;
    margin: 0 auto 1.5rem auto;
}

.app-store-badge {
    height: 60px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.app-card-legal {
    margin-top: 2.5rem;
    font-size: 0.6875rem;
    color: #888888;
}

[data-theme="dark"] .app-card-legal {
    color: #aaaaaa;
}

.app-card-legal a,
.app-card-legal a:hover,
.app-card-legal a:focus,
.app-card-legal a:visited {
    color: inherit;
    text-decoration: none;
}

.app-card-legal-separator {
    margin: 0 0.25rem;
    color: inherit;
}

/* CTA Button */
.cta-section {
    text-align: center;
    margin-top: 3rem;
}

.cta-button {
    display: inline-block;
    padding: 0.875rem 2.5rem;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    background-color: #000000;
    color: #ffffff;
    cursor: default;
    user-select: none;
}

[data-theme="dark"] .cta-button {
    background-color: #ffffff;
    color: #000000;
}

/* Footer */
.site-footer {
    padding: 2rem 0 3rem;
    text-align: center;
}

.site-footer-text {
    font-size: 0.8125rem;
    line-height: 1.8;
    color: #888888;
}

[data-theme="dark"] .site-footer-text {
    color: #aaaaaa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .header-content {
        padding: 0.75rem 0;
    }

    .apps-section {
        padding-top: 6rem;
        padding-bottom: 3rem;
    }

    .apps-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .app-card {
        padding: 2.5rem 1.5rem 1.25rem;
    }
}

/* Ultra-wide screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1500px;
    }
}

/* Smooth transitions for theme switching */
* {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Focus styles for accessibility */
button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
