:root {
    --color-bg: linear-gradient(to bottom, #312e81, #581c87, #831843);
    --color-card: rgba(255, 255, 255, 0.05);
    --color-card-hover: rgba(255, 255, 255, 0.1);
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-text: #ffffff;
    --color-text-muted: #93c5fd;
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 64rem;
    margin: 0 auto;
    padding: 3rem 1rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #bfdbfe, #fbcfe8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.calculator {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: var(--color-card-hover);
}

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

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .input-group {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
    }
}

.time-input, .age-input {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-text-muted);
}

input[type="time"], .age-select {
    background: var(--color-card);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--color-text);
    font-size: 1rem;
}

input[type="time"]:focus, .age-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.age-select {
    min-width: 150px;
    background-color: rgba(0, 0, 0, 0.2);
}

.age-select option {
    background-color: #1f2937;
    color: var(--color-text);
}

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

.time-card {
    background: var(--color-card);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    position: relative;
}

.time-card:hover {
    background: var(--color-card-hover);
}

.time-card.recommended {
    background: rgba(79, 70, 229, 0.2);
    border: 1px solid rgba(79, 70, 229, 0.4);
}

.recommended-badge {
    position: absolute;
    top: -0.75rem;
    right: 0.75rem;
    background: var(--color-primary);
    color: var(--color-text);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
}

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

.icon-wrapper {
    width: 2rem;
    height: 2rem;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-details span {
    display: block;
}

.time-label {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.time-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.cycle-info {
    text-align: right;
}

.cycle-label {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.cycle-number {
    font-size: 1.125rem;
    font-weight: 500;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem auto;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    border: none;
    border-radius: 0.5rem;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.share-btn:hover {
    background: var(--color-primary-hover);
}

.calculation-info {
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    backdrop-filter: blur(8px);
}

.calculation-info h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #bfdbfe, #fbcfe8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

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

.info-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
    transition: all 0.2s;
}

.info-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.info-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.info-card h4 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.info-card p {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.calculation-example {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-top: 1.5rem;
}

.calculation-example h4 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.calculation-example p {
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.calculation-example ul {
    list-style: none;
    padding-left: 1rem;
}

.calculation-example li {
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.calculation-example li::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: var(--color-primary);
}

.sleep-advice {
    margin-top: 3rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    backdrop-filter: blur(8px);
}

.sleep-advice h2 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #bfdbfe, #fbcfe8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.advice-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

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

.advice-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.2s;
}

.advice-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.advice-icon {
    width: 3rem;
    height: 3rem;
    background: rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.advice-card h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--color-text);
    font-size: 1.25rem;
}

.advice-card ul {
    list-style: none;
}

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

.advice-card li::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: var(--color-primary);
}

.site-footer {
    margin-top: 3rem;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
}

.footer-content {
    max-width: 64rem;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.copyright {
    color: var(--color-text-muted);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.footer-links a:hover {
    color: var(--color-text);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background: linear-gradient(to bottom, #312e81, #581c87);
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 90%;
    max-width: 28rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    color: var(--color-text);
}

.close-btn {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    opacity: 0.8;
}

.close-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.share-option {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 0.5rem;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.share-option:hover {
    background: rgba(255, 255, 255, 0.2);
}

.copy-link-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0. .5rem;
    padding: 0.75rem;
    background: var(--color-primary);
    border: none;
    border-radius: 0.5rem;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.copy-link-btn:hover {
    background: var(--color-primary-hover);
}

.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: #22c55e;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hidden {
    display: none;
}

.no-js-message {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 48rem;
    text-align: center;
}

.no-js-message p {
    margin-bottom: 1rem;
}

.no-js-message ul {
    list-style: none;
    margin-top: 1rem;
}

.no-js-message li {
    margin: 0.5rem 0;
    color: var(--color-text-muted);
}

.legal-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.back-link {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.back-link:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.1);
}

.legal-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 3rem;
}

.legal-section {
    margin-bottom: 2.5rem;
}

.legal-section:last-child {
    margin-bottom: 0;
}

.legal-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-text);
    background: linear-gradient(to right, #bfdbfe, #fbcfe8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.legal-section p {
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.legal-section p:last-child {
    margin-bottom: 0;
}

.footer-links a.active {
    color: var(--color-text);
    pointer-events: none;
}

@media (max-width: 768px) {
    .legal-header {
        padding-top: 3rem;
    }

    .back-link {
        top: 0;
        left: 50%;
        transform: translateX(-50%);
    }

    .legal-content {
        padding: 1.5rem;
    }
}