/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Night-friendly */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --accent-primary: #4f46e5;
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --border-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-secondary: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Header */
.header {
    background: var(--gradient-secondary);
    padding: 0.75rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

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

.header-text {
    flex: 1;
    text-align: left;
}

.language-selector {
    position: relative;
}

.language-dropdown {
    position: relative;
}

.language-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: space-between;
}

.language-toggle:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.dropdown-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.language-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.language-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow-color);
    z-index: 1000;
    min-width: 180px;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    margin-top: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

.language-dropdown-menu::-webkit-scrollbar {
    width: 4px;
}

.language-dropdown-menu::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.language-dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 2px;
}

.language-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

.language-dropdown.active .language-dropdown-menu {
    display: flex;
}

.lang-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    display: block;
}

.lang-link:last-child {
    border-bottom: none;
}

.lang-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.logo {
    font-size: 1.8rem;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.2rem;
}

.tagline {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Main Content */
.main {
    padding: 2rem 0;
}

/* Calculator Section */
.calculator-section {
    margin-bottom: 3rem;
}

.calculator-container {
    max-width: 600px;
    margin: 0 auto;
}

.calculator-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.calculator-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px var(--shadow-color);
}

/* Sleep Icon */
.sleep-icon {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
}

.calculator-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.calculator-icon:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* Settings Panel */
.settings-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.settings-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background: var(--accent-primary);
    color: var(--text-primary);
}

.settings-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
}

.fall-asleep-setting {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fall-asleep-setting label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.fall-asleep-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 60px;
    text-align: center;
}

.close-settings-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
}

.close-settings-btn:hover {
    color: var(--text-primary);
}

/* Calculator Interface */
.calculator-interface h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    text-align: center;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
}

/* Function Tabs */
.function-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.tab-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 150px;
}

.tab-btn:hover {
    background: var(--accent-primary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-primary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* Calculator Content */
.calculator-content {
    text-align: center;
}

.time-input-section, .current-time-section {
    margin-bottom: 1.5rem;
}

.time-input-section label, .current-time-section label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1rem;
}

/* iOS Style Time Picker */
.ios-time-picker {
    background: var(--bg-tertiary);
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    position: relative;
    max-width: 250px;
    margin: 0 auto;
}

/* Dropdown Selector Container (PC端时间选择器) */
.dropdown-selector-container {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
}

.time-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    min-width: 80px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

.time-select::-webkit-scrollbar {
    width: 4px;
}

.time-select::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.time-select::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 2px;
}

.time-select::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

.time-display {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.picker-container {
    display: flex;
    height: 120px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.picker-column {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.picker-column:first-child::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.picker-list {
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
}

.picker-list::-webkit-scrollbar {
    width: 3px;
}

.picker-list::-webkit-scrollbar-track {
    background: transparent;
}

.picker-list::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 1.5px;
    opacity: 0.5;
}

.picker-list::-webkit-scrollbar-thumb:hover {
    opacity: 1;
}

.picker-item {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-muted);
    scroll-snap-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.picker-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.picker-item.selected {
    color: var(--text-primary);
    font-size: 15px;
}

.picker-indicator {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 24px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: rgba(79, 70, 229, 0.1);
    pointer-events: none;
}

/* Current Time Display */
.current-time-display {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: inline-block;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 260px;
}

.current-time-display span {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-primary);
}

/* Calculate Button */
.calculate-btn {
    background: var(--gradient-primary);
    color: var(--text-primary);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Results Overlay */
.results-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 1rem;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.results-content {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.results-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-align: center;
}

.results-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
    width: 100%;
}

.result-option {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.7rem;
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: left;
}

.result-option:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.result-option.recommended {
    border-color: var(--accent-success);
    background: rgba(16, 185, 129, 0.1);
}

.result-time {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    text-align: center;
}

.result-details {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
    justify-content: center;
}

.cycles, .duration {
    background: var(--bg-primary);
    padding: 0.15rem 0.3rem;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.badge {
    background: var(--accent-success);
    color: var(--text-primary);
    padding: 0.15rem 0.3rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.result-description {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
}

.back-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 500px;
    margin-top: 0.6rem;
}

.back-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Education Section */
.education-section {
    margin-top: 3rem;
}

.education-section h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-align: center;
}

.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.education-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px var(--shadow-color);
    transition: all 0.3s ease;
}

.education-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--shadow-color);
}

.education-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.education-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.education-card ul {
    list-style: none;
    margin-bottom: 1rem;
}

.education-card li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.education-card li:before {
    content: '•';
    color: var(--accent-primary);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.education-card strong {
    color: var(--text-primary);
    font-weight: 600;
}

.cycle-recommendations {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cycle-recommendation {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.cycle-recommendation.recommended {
    border-color: var(--accent-success);
    background: rgba(16, 185, 129, 0.1);
}

.cycle-recommendation h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.cycle-recommendation p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Scientific Guide Section */
.scientific-guide-section {
    margin-top: 4rem;
    padding: 3rem 0;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.scientific-guide-section h2 {
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.scientific-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem;
}

.scientific-intro {
    background: var(--bg-tertiary);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.scientific-intro p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin: 0;
}

.scientific-section {
    margin-bottom: 2.5rem;
    padding: 2rem;
    background: var(--bg-tertiary);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.scientific-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.scientific-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-primary);
}

.scientific-section p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.scientific-section ul {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.scientific-section li {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.scientific-section li:before {
    content: "•";
    color: var(--accent-primary);
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 0;
}

.scientific-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

.sleep-age-table {
    margin: 1.5rem 0;
    overflow-x: auto;
}

.sleep-age-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.sleep-age-table th {
    background: var(--accent-primary);
    color: var(--text-primary);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 1rem;
}

.sleep-age-table td {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.sleep-age-table tr:hover {
    background: var(--bg-tertiary);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

.footer p {
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .header {
        padding: 0.6rem 0;
    }

    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .header-text {
        text-align: center;
    }

    .language-toggle {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        min-width: 100px;
    }

    .language-dropdown-menu {
        min-width: 180px;
        max-height: 250px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        scrollbar-width: thin;
        scrollbar-color: var(--accent-primary) var(--bg-tertiary);
    }

    .language-dropdown-menu::-webkit-scrollbar {
        width: 4px;
    }

    .language-dropdown-menu::-webkit-scrollbar-thumb {
        background: var(--accent-primary);
        border-radius: 2px;
    }

    .picker-list::-webkit-scrollbar {
        width: 3px;
    }

    .picker-list::-webkit-scrollbar-thumb {
        background: var(--accent-primary);
        border-radius: 1.5px;
        opacity: 0.5;
    }

    .logo {
        font-size: 1.5rem;
        margin-bottom: 0.15rem;
    }

    .tagline {
        font-size: 0.8rem;
    }

    .calculator-card {
        margin: 0.75rem;
        padding: 1.25rem;
    }

    .sleep-icon {
        top: 0.75rem;
        left: 0.75rem;
    }

    .calculator-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .calculator-card h2 {
        font-size: 1.3rem;
        margin-bottom: 0.2rem;
    }

    .subtitle {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }

    .function-tabs {
        flex-direction: column;
        gap: 0.3rem;
        margin-bottom: 1rem;
    }

    .tab-btn {
        max-width: none;
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .ios-time-picker {
        max-width: 260px;
        padding: 0.75rem;
    }

    .time-display {
        font-size: 1.2rem;
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .picker-container {
        height: 120px;
    }

    .picker-item {
        height: 24px;
        font-size: 13px;
    }

    .picker-item.selected {
        font-size: 15px;
    }

    .picker-indicator {
        height: 24px;
    }

    .current-time-display {
        min-height: 160px;
        min-width: 260px;
    }

    .time-input-section, .current-time-section {
        margin-bottom: 1rem;
    }

    .time-input-section label, .current-time-section label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .calculate-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        margin-top: 0.75rem;
    }

    .settings-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }

    .results-overlay {
        padding: 1rem;
    }

    .results-content {
        align-items: center;
    }

    .results-content h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .results-options {
        gap: 0.6rem;
        margin-bottom: 1rem;
    }

    .result-option {
        padding: 0.7rem;
    }

    .result-time {
        font-size: 1.2rem;
        margin-bottom: 0.3rem;
    }

    .result-details {
        gap: 0.6rem;
        margin-bottom: 0.3rem;
    }

    .cycles, .duration {
        padding: 0.15rem 0.3rem;
        font-size: 0.75rem;
    }

    .badge {
        padding: 0.15rem 0.3rem;
        font-size: 0.75rem;
    }

    .result-description {
        font-size: 0.8rem;
    }

    .back-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        margin-top: 0.6rem;
    }

    .education-grid {
        grid-template-columns: 1fr;
    }

    .education-card {
        padding: 1.25rem;
    }

    .education-section h2 {
        font-size: 1.6rem;
    }

    .scientific-guide-section {
        margin-top: 2rem;
        padding: 2rem 0;
    }

    .scientific-guide-section h2 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .scientific-content {
        padding: 0 1rem;
    }

    .scientific-intro {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .scientific-intro p {
        font-size: 1rem;
    }

    .scientific-section {
        margin-bottom: 2rem;
        padding: 1.5rem;
    }

    .scientific-section h3 {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }

    .scientific-section p {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }

    .scientific-section li {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    .sleep-age-table {
        margin: 1rem 0;
    }

    .sleep-age-table th,
    .sleep-age-table td {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.5rem 0;
    }

    .header-content {
        gap: 0.5rem;
    }

    .header-text {
        text-align: center;
    }

    .language-toggle {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
        min-width: 90px;
    }

    .language-dropdown-menu {
        min-width: 160px;
        max-height: 200px;
        scrollbar-width: thin;
        scrollbar-color: var(--accent-primary) var(--bg-tertiary);
    }

    .language-dropdown-menu::-webkit-scrollbar {
        width: 3px;
    }

    .language-dropdown-menu::-webkit-scrollbar-thumb {
        background: var(--accent-primary);
        border-radius: 1.5px;
    }

    .picker-list::-webkit-scrollbar {
        width: 2px;
    }

    .picker-list::-webkit-scrollbar-thumb {
        background: var(--accent-primary);
        border-radius: 1px;
        opacity: 0.4;
    }

    .lang-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .logo {
        font-size: 1.3rem;
        margin-bottom: 0.1rem;
    }

    .tagline {
        font-size: 0.75rem;
    }

    .calculator-card {
        margin: 0.4rem;
        padding: 0.8rem;
    }

    .sleep-icon {
        top: 0.5rem;
        left: 0.5rem;
    }

    .calculator-icon {
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }

    .calculator-card h2 {
        font-size: 1.1rem;
        margin-bottom: 0.15rem;
    }

    .subtitle {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .function-tabs {
        gap: 0.2rem;
        margin-bottom: 0.75rem;
    }

    .tab-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .ios-time-picker {
        max-width: 240px;
        padding: 0.6rem;
    }

    .time-display {
        font-size: 1.1rem;
        padding: 0.6rem;
        margin-bottom: 0.6rem;
    }

    .picker-container {
        height: 100px;
    }

    .picker-item {
        height: 20px;
        font-size: 12px;
    }

    .picker-item.selected {
        font-size: 14px;
    }

    .picker-indicator {
        height: 20px;
    }

    .current-time-display {
        min-height: 140px;
        min-width: 240px;
    }

    .time-input-section, .current-time-section {
        margin-bottom: 0.75rem;
    }

    .time-input-section label, .current-time-section label {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    .calculate-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }

    .settings-btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.65rem;
    }

    .results-overlay {
        padding: 0.8rem;
    }

    .results-content h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }

    .results-options {
        gap: 0.5rem;
        margin-bottom: 0.8rem;
    }

    .result-option {
        padding: 0.6rem;
    }

    .result-time {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }

    .result-details {
        gap: 0.5rem;
        margin-bottom: 0.25rem;
    }

    .cycles, .duration {
        padding: 0.1rem 0.25rem;
        font-size: 0.7rem;
    }

    .badge {
        padding: 0.1rem 0.25rem;
        font-size: 0.7rem;
    }

    .result-description {
        font-size: 0.75rem;
    }

    .back-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }

    .settings-panel {
        flex-direction: column;
        gap: 0.4rem;
        align-items: flex-start;
    }

    .fall-asleep-setting {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .time-select {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 70px;
    }

    .time-select::-webkit-scrollbar {
        width: 3px;
    }

    .time-select::-webkit-scrollbar-thumb {
        background: var(--accent-primary);
        border-radius: 1.5px;
    }

    .scientific-guide-section {
        margin-top: 1.5rem;
        padding: 1.5rem 0;
    }

    .scientific-guide-section h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .scientific-content {
        padding: 0 0.75rem;
    }

    .scientific-intro {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .scientific-intro p {
        font-size: 0.95rem;
    }

    .scientific-section {
        margin-bottom: 1.5rem;
        padding: 1rem;
    }

    .scientific-section h3 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .scientific-section p {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .scientific-section li {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
        padding-left: 1.2rem;
    }

    .sleep-age-table {
        margin: 0.75rem 0;
    }

    .sleep-age-table th,
    .sleep-age-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

@media (prefers-contrast: high) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #1a1a1a;
        --bg-tertiary: #2a2a2a;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border-color: #666666;
    }
}

@media print {
    .calculator-card, .education-card {
        box-shadow: none;
        border: 1px solid #000;
    }

    .calculate-btn, .back-btn, .tab-btn, .settings-btn {
        display: none;
    }
}