:root {
    --primary: #5a67d8;
    --primary-dark: #4c51bf;
    --secondary: #f6ad55;
    --dark: #2d3748;
    --light: #f8f9fa;
    --success: #48bb78;
    --gray: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    color: var(--light);
    min-height: 100vh;
    padding: clamp(10px, 3vw, 20px);
    line-height: 1.6;
    font-size: clamp(14px, 2vw, 16px);
}

.lang-switch {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 8px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--light);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
    background: var(--primary);
    color: white;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(10px, 3vw, 20px);
}

header {
    text-align: center;
    padding: 30px 0;
}

h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: clamp(10px, 3vw, 20px);
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    padding: 0 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--gray);
    max-width: 700px;
    margin: 0 auto 30px;
}

.calculator {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.1);
}

.mode-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.mode-btn {
    flex: 1;
    min-width: clamp(150px, 40vw, 200px);
    padding: clamp(15px, 3vw, 20px);
    background: rgba(255,255,255,0.05);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--light);
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    white-space: normal;
    height: auto;
}

.mode-btn:hover {
    background: rgba(255,255,255,0.1);
}

.mode-btn.active {
    background: rgba(90, 103, 216, 0.3);
    border-color: var(--primary);
    color: #fff;
}

.input-section {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    margin-bottom: 30px;
}

.input-group {
    flex: 1;
    min-width: clamp(200px, 45vw, 250px);
    width: 100%;
}

.time-select-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.time-select {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: var(--light);
    padding: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    appearance: none;
    width: 80px;
    text-align: center;
}

.time-select:hover {
    background: rgba(255,255,255,0.15);
}

.time-select:focus {
    outline: none;
    border-color: var(--primary);
}

.time-separator {
    font-size: 1.5rem;
    color: var(--light);
    opacity: 0.8;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #cbd5e0;
}

input, select {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.3);
    color: white;
    font-size: 1.1rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(90, 103, 216, 0.3);
}

.slider-container {
    margin-top: 30px;
}

.slider-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary);
    margin-top: 10px;
}

.calculate-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 20px;
}

.calculate-btn:hover {
    background: var(--primary-dark);
}

.results {
    display: none;
    background: rgba(26, 32, 44, 0.8);
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.results-title {
    font-size: 1.8rem;
    color: var(--secondary);
}

.results-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.result-card {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 25px;
    text-align: center;
}

.result-label {
    font-size: 1.1rem;
    color: #a0aec0;
    margin-bottom: 10px;
}

.result-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    margin: 10px 0;
}

.result-desc {
    color: #cbd5e0;
    font-size: 1rem;
}

.sleep-cycle-chart {
    display: flex;
    justify-content: center;
    margin: clamp(20px, 5vw, 40px) auto;
    gap: clamp(10px, 2vw, 25px);
    flex-wrap: wrap;
    padding: clamp(15px, 4vw, 30px);
    max-width: min(95vw, 900px);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.cycle {
    width: clamp(70px, 18vw, 110px);
    height: clamp(70px, 18vw, 110px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--primary);
    color: white;
    font-weight: 600;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

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

.cycle::after {
    content: "→";
    position: absolute;
    right: -30px;
    font-size: 2rem;
    color: var(--secondary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cycle:last-child::after {
    display: none;
}

.cycle-number {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
}

.cycle-time {
    text-align: center;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
}

.info-section {
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    padding: 30px;
    margin-top: 40px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.1);
}

.info-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--secondary);
    text-align: center;
}

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

.info-card {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    padding: 25px;
}

.info-card h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.info-card h3 a {
    color: var(--primary);
}

.info-card ul {
    padding-left: 20px;
}

.info-card li {
    margin-bottom: 10px;
}

.articles-section {
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    padding: 30px;
    margin-top: 40px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.1);
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--secondary);
    text-align: center;
}

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

.article-card {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    padding: 25px;
    transition: transform 0.3s ease;
}

.article-card:hover {
    transform: translateY(-5px);
}

.article-card h3 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-align: center;
}

.article-list {
    list-style: none;
    padding: 0;
}

.article-list li {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    transition: background 0.3s ease;
}

.article-list li:hover {
    background: rgba(255,255,255,0.1);
}

.article-list a {
    color: var(--light);
    text-decoration: none;
    display: block;
    font-weight: 500;
    transition: color 0.3s ease;
}

.article-list a:hover {
    color: var(--secondary);
}

footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
    color: #a0aec0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

@media (max-width: 768px) {
    .input-section {
        flex-direction: column;
    }
    
    .cycle::after {
        display: none;
    }
    
    .sleep-cycle-chart {
        padding: clamp(10px, 3vw, 20px);
        gap: clamp(8px, 2vw, 15px);
    }

    .cycle {
        width: clamp(60px, 16vw, 90px);
        height: clamp(60px, 16vw, 90px);
    }
    
    .results-content {
        grid-template-columns: 1fr;
    }
    
    .result-value {
        font-size: clamp(1.8rem, 4vw, 2.2rem);
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .calculate-btn {
        padding: clamp(12px, 3vw, 16px);
        font-size: clamp(1rem, 2.5vw, 1.2rem);
    }

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

/* Article Page Styles */
.costs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* 404 Page Styles */
.error-404 {
    text-align: center;
    padding: 40px 20px;
}

.error-404 .cycle {
    width: 200px;
    height: 200px;
    background: rgba(90, 103, 216, 0.1);
    border: 2px solid var(--primary);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 40px auto;
    animation: pulse 2s infinite;
}

.error-404 .cycle-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 10px;
}

.error-404 .cycle-time {
    font-size: 1.2rem;
    color: var(--gray);
}

.error-404 .nav-link {
    display: inline-block;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: var(--light);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.error-404 .error-links {
    list-style: none;
    padding: 0;
    max-width: 600px;
    margin: 0 auto;
}

.error-404 .error-links li {
    margin: 15px 0;
}

.error-404 .nav-link {
    font-size: 1.1rem;
}

.error-404 .nav-link:hover {
    background: rgba(90, 103, 216, 0.2);
    border-color: var(--primary);
    transform: translateY(-2px);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(90, 103, 216, 0.4);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(90, 103, 216, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(90, 103, 216, 0);
    }
}

.cost-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.cost-card:hover {
    transform: translateY(-5px);
}

.cost-card h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.cost-card ul {
    list-style-type: none;
    padding-left: 0;
}

.cost-card li {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.cost-card li:before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.step-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chronotype-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--bg-color);
    border-radius: 8px;
    overflow: hidden;
}

.chronotype-table th,
.chronotype-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.chronotype-table th {
    background: var(--accent-color);
    color: white;
}

.chronotype-table tr:last-child td {
    border-bottom: none;
}

.pro-tip {
    background: var(--accent-color-light);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-style: italic;
}

.key-point {
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin: 1rem 0;
    font-weight: 500;
}

.action-steps ol {
    counter-reset: action-counter;
    list-style: none;
    padding: 0;
}

.action-steps li {
    counter-increment: action-counter;
    margin: 1rem 0;
    padding-left: 3rem;
    position: relative;
}

.action-steps li:before {
    content: counter(action-counter);
    position: absolute;
    left: 0;
    width: 2rem;
    height: 2rem;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.highlight-quote {
    font-size: 1.5rem;
    font-style: italic;
    color: var(--accent-color);
    text-align: center;
    margin: 2rem 0;
    padding: 2rem;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

.conclusion {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 2rem 0;
}

.conclusion a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 2px solid currentColor;
    transition: opacity 0.3s ease;
}

.conclusion a:hover {
    opacity: 0.8;
}

@media (max-width: 768px) {
    .costs-grid,
    .steps-grid {
        grid-template-columns: 1fr;
    }

    .chronotype-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .highlight-quote {
        font-size: 1.3rem;
        padding: 1.5rem;
    }
}

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

.navigation {
    margin-bottom: 30px;
}

.nav-link {
    color: var(--secondary);
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary);
}

.article-content {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: clamp(20px, 5vw, 40px);
    margin-bottom: 40px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.1);
}

.article-content h2 {
    color: var(--secondary);
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin: 2rem 0 1rem;
}

.article-content h3 {
    color: var(--primary);
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    margin: 1.5rem 0 0.8rem;
}

.article-content p {
    margin-bottom: 1.2rem;
    line-height: 1.8;
}

.article-content ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.8rem;
}

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

.benefit-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.3s ease;
}

.benefit-card:hover {
    transform: translateY(-5px);
}

.article-content a {
    color: var(--secondary);
    text-decoration: none;
    border-bottom: 1px solid var(--secondary);
    transition: all 0.3s ease;
}

.article-content a:hover {
    color: var(--primary);
    border-color: var(--primary);
}