:root {
    --bg: #090d1b;
    --bg-soft: #10162b;
    --surface: rgba(19, 27, 52, .78);
    --surface-solid: #151d36;
    --surface-2: #1b2543;
    --text: #f4f5ff;
    --muted: #aeb7d4;
    --line: rgba(255,255,255,.10);
    --primary: #9388ff;
    --primary-2: #6e63ff;
    --cyan: #7bdcff;
    --moon: #ffe7a6;
    --success: #82e7bd;
    --warning: #ffc879;
    --shadow: 0 24px 80px rgba(0,0,0,.30);
    --radius: 20px;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #eef3ff;
    --bg-soft: #e5ebfb;
    --surface: rgba(255,255,255,.80);
    --surface-solid: #ffffff;
    --surface-2: #f5f7ff;
    --text: #19213c;
    --muted: #626c89;
    --line: rgba(30,45,90,.12);
    --primary: #6658f4;
    --primary-2: #5445e4;
    --cyan: #248fc0;
    --moon: #f0a93d;
    --shadow: 0 24px 60px rgba(57,74,120,.14);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    overflow-x: hidden;

    background:
        radial-gradient(
            circle at 50% -10%,
            rgba(108, 99, 255, .25),
            transparent 34rem
        ),
        var(--bg);

    color: var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.6;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color:
        transparent;
}

a {
    color: inherit;
}

button {
    color: inherit;
}

.sky {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.moon {
    position: absolute;
    width: 180px;
    height: 180px;
    top: 105px;
    right: 8vw;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 35% 32%,
            #fff9dc,
            var(--moon) 50%,
            #e5c56d 100%
        );

    box-shadow:
        0 0 80px
        rgba(255, 230, 161, .18);

    opacity: .13;

    animation:
        moonFloat
        8s
        ease-in-out
        infinite;
}

.star {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: white;
    box-shadow:
        0 0 10px white;

    animation:
        twinkle
        3s
        ease-in-out
        infinite alternate;
}

.s1 { left: 10%; top: 14%; }
.s2 { left: 22%; top: 29%; animation-delay: .7s; }
.s3 { left: 38%; top: 11%; animation-delay: 1.6s; }
.s4 { left: 53%; top: 23%; animation-delay: .2s; }
.s5 { left: 68%; top: 8%; animation-delay: 1.2s; }
.s6 { left: 82%; top: 32%; animation-delay: 2s; }
.s7 { left: 91%; top: 16%; animation-delay: .9s; }
.s8 { left: 5%; top: 43%; animation-delay: 1.4s; }

.cloud {
    position: absolute;
    height: 80px;
    width: 240px;
    border-radius: 100px;

    background:
        rgba(255,255,255,.025);

    filter:
        blur(1px);

    animation:
        cloudDrift
        25s
        linear
        infinite;
}

.cloud::before,
.cloud::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: inherit;
}

.cloud::before {
    width: 100px;
    height: 100px;
    left: 35px;
    top: -42px;
}

.cloud::after {
    width: 130px;
    height: 130px;
    right: 30px;
    top: -60px;
}

.cloud-a {
    top: 68%;
    left: -260px;
}

.cloud-b {
    top: 38%;
    left: -360px;
    animation-delay: -11s;
    animation-duration: 34s;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;

    border-bottom:
        1px solid
        var(--line);

    background:
        rgba(9, 13, 27, .76);

    backdrop-filter:
        blur(18px);
}

:root[data-theme="light"]
.site-header {
    background:
        rgba(238,243,255,.82);
}

.header-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 70px;

    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    color: var(--text);
    text-decoration: none;
    font-size: 18px;
    letter-spacing: -.4px;
}

.brand strong {
    color: var(--primary);
}

.brand-moon {
    display: grid;
    place-items: center;

    width: 38px;
    height: 38px;

    border:
        1px solid
        rgba(147,136,255,.32);

    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            rgba(147,136,255,.18),
            rgba(123,220,255,.08)
        );

    color: var(--moon);
    font-size: 25px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.main-nav a,
.theme-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;

    padding: 8px 12px;

    border: 0;
    border-radius: 11px;

    background: transparent;
    color: var(--muted);

    text-decoration: none;
    cursor: pointer;

    transition:
        background .18s ease,
        color .18s ease,
        transform .18s ease;
}

.main-nav a:hover,
.theme-toggle:hover {
    background: var(--surface);
    color: var(--text);
    transform: translateY(-1px);
}

.menu-toggle {
    display: none;

    width: 42px;
    height: 42px;

    border:
        1px solid
        var(--line);

    border-radius: 12px;

    background:
        var(--surface);

    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;

    cursor: pointer;
}

.menu-toggle span {
    width: 19px;
    height: 2px;
    border-radius: 10px;
    background: currentColor;

    transition:
        transform .18s ease,
        opacity .18s ease;
}

.menu-toggle.open
span:nth-child(1) {
    transform:
        translateY(7px)
        rotate(45deg);
}

.menu-toggle.open
span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.open
span:nth-child(3) {
    transform:
        translateY(-7px)
        rotate(-45deg);
}

.hero {
    width:
        min(
            1100px,
            calc(100% - 32px)
        );

    margin:
        0 auto;

    padding:
        92px 0
        48px;

    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: 48px;
    align-items: end;
}

.eyebrow {
    display: inline-block;

    color: var(--cyan);

    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.6px;
}

.hero h1 {
    max-width: 760px;

    margin:
        11px 0
        18px;

    font-size:
        clamp(
            42px,
            8vw,
            82px
        );

    line-height: .96;
    letter-spacing: -3.8px;
}

.hero h1 span {
    display: block;

    background:
        linear-gradient(
            90deg,
            var(--primary),
            var(--cyan),
            var(--moon)
        );

    -webkit-background-clip:
        text;

    background-clip:
        text;

    color: transparent;
}

.hero-lead {
    max-width: 710px;
    margin: 0;

    color: var(--muted);
    font-size: 18px;
}

.trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;

    margin-top: 25px;
}

.trust-row span {
    padding:
        8px 11px;

    border:
        1px solid
        var(--line);

    border-radius: 999px;

    background:
        rgba(255,255,255,.025);

    color: var(--muted);
    font-size: 13px;
}

.local-clock {
    min-width: 155px;
    padding: 16px 18px;

    border:
        1px solid
        var(--line);

    border-radius: 17px;

    background: var(--surface);
    backdrop-filter: blur(18px);

    box-shadow: var(--shadow);
}

.local-clock span {
    display: block;

    color: var(--muted);
    font-size: 12px;
}

.local-clock strong {
    display: block;
    margin-top: 3px;

    font-size: 28px;
    letter-spacing: -1px;
}

.calculator-shell {
    width:
        min(
            1030px,
            calc(100% - 32px)
        );

    margin:
        0 auto
        100px;
}

.calculator-card {
    position: relative;

    padding: 30px;

    border:
        1px solid
        var(--line);

    border-radius: 26px;

    background:
        linear-gradient(
            145deg,
            rgba(24,33,62,.94),
            rgba(14,20,40,.90)
        );

    box-shadow: var(--shadow);

    overflow: hidden;
}

:root[data-theme="light"]
.calculator-card {
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.96),
            rgba(242,246,255,.94)
        );
}

.calculator-card::before {
    content: "";

    position: absolute;
    width: 320px;
    height: 320px;

    top: -180px;
    right: -150px;

    border-radius: 50%;

    background:
        var(--primary);

    filter: blur(100px);
    opacity: .16;

    pointer-events: none;
}

.calculator-heading {
    position: relative;

    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;

    margin-bottom: 26px;
}

.calculator-heading h2 {
    margin: 4px 0 0;

    font-size:
        clamp(
            27px,
            4vw,
            38px
        );

    letter-spacing: -1.2px;
}

.sleep-status {
    padding:
        7px 11px;

    border:
        1px solid
        rgba(130,231,189,.22);

    border-radius: 999px;

    background:
        rgba(130,231,189,.08);

    color: var(--success);
    font-size: 12px;
    white-space: nowrap;
}

.mode-tabs {
    position: relative;

    display: grid;
    grid-template-columns:
        repeat(3, 1fr);

    gap: 8px;

    padding: 6px;

    border:
        1px solid
        var(--line);

    border-radius: 16px;

    background:
        rgba(0,0,0,.12);

    margin-bottom: 24px;
}

.mode-tab {
    min-height: 54px;

    padding: 10px 14px;

    border: 0;
    border-radius: 12px;

    background: transparent;
    color: var(--muted);

    cursor: pointer;

    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease;
}

.mode-tab span {
    margin-right: 5px;
}

.mode-tab.active {
    background:
        linear-gradient(
            135deg,
            var(--primary-2),
            #8277ff
        );

    color: white;

    box-shadow:
        0 10px 30px
        rgba(108,99,255,.25);
}

.mode-tab:hover:not(.active) {
    background:
        rgba(255,255,255,.045);
    color: var(--text);
}

.time-panel {
    padding: 22px;

    border:
        1px solid
        var(--line);

    border-radius: 18px;

    background:
        rgba(255,255,255,.025);
}

.time-panel[hidden] {
    display: none;
}

.time-panel > label {
    display: block;
    margin-bottom: 10px;

    font-weight: 750;
}

.time-control {
    display: flex;
    gap: 10px;
}

input[type="time"],
select {
    width: 100%;
    min-height: 52px;

    padding: 11px 14px;

    border:
        1px solid
        var(--line);

    border-radius: 13px;

    outline: none;

    background: var(--surface-solid);
    color: var(--text);

    transition:
        border .18s ease,
        box-shadow .18s ease;
}

input[type="time"] {
    font-size: 22px;
    font-weight: 750;
}

input:focus,
select:focus {
    border-color:
        rgba(147,136,255,.7);

    box-shadow:
        0 0 0 4px
        rgba(147,136,255,.11);
}

.now-button,
.ghost-button {
    min-height: 44px;

    padding:
        9px 14px;

    border:
        1px solid
        var(--line);

    border-radius: 12px;

    background: var(--surface-solid);
    color: var(--text);

    cursor: pointer;
}

.now-button[hidden] {
    display: none;
}

.field-help,
.setting-help {
    display: block;

    margin:
        8px 0
        0;

    color: var(--muted);
    font-size: 12px;
}

.settings-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 13px;

    margin-top: 14px;
}

.setting-card {
    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 160px;

    padding: 18px;

    border:
        1px solid
        var(--line);

    border-radius: 17px;

    background:
        rgba(255,255,255,.022);
}

.setting-title {
    color: var(--muted);
    font-size: 13px;
}

.setting-value {
    margin:
        6px 0
        12px;

    font-size: 14px;
}

.setting-value strong {
    margin-right: 4px;

    color: var(--text);
    font-size: 24px;
}

input[type="range"] {
    width: 100%;

    accent-color:
        var(--primary);

    cursor: pointer;
}

.setting-scale {
    display: flex;
    justify-content: space-between;

    margin-top: 4px;

    color: var(--muted);
    font-size: 11px;
}

.setting-card select {
    margin-top: 12px;
    font-size: 14px;
}

.calculate-button {
    width: 100%;
    min-height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    margin-top: 16px;

    border: 0;
    border-radius: 15px;

    background:
        linear-gradient(
            100deg,
            var(--primary-2),
            var(--primary),
            #6bbde8
        );

    color: white;

    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 14px 34px
        rgba(108,99,255,.24);

    transition:
        transform .18s ease,
        box-shadow .18s ease;
}

.calculate-button:hover {
    transform:
        translateY(-2px);

    box-shadow:
        0 18px 40px
        rgba(108,99,255,.32);
}

.results {
    margin-top: 28px;
    padding-top: 28px;

    border-top:
        1px solid
        var(--line);
}

.results[hidden] {
    display: none;
}

.result-intro {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.result-intro h3 {
    margin:
        4px 0
        5px;

    font-size: 27px;
}

.result-intro p {
    max-width: 680px;
    margin: 0;

    color: var(--muted);
}

.result-actions {
    display: flex;
    gap: 7px;
}

.result-grid {
    display: grid;
    grid-template-columns:
        repeat(4, 1fr);

    gap: 11px;

    margin-top: 20px;
}

.result-card {
    position: relative;

    padding: 18px;

    border:
        1px solid
        var(--line);

    border-radius: 17px;

    background:
        var(--surface-solid);

    animation:
        resultRise
        .45s
        ease
        both;

    animation-delay:
        var(--delay);
}

.result-card.recommended {
    border-color:
        rgba(130,231,189,.35);

    background:
        linear-gradient(
            145deg,
            rgba(130,231,189,.09),
            var(--surface-solid)
        );
}

.result-card.warning {
    border-color:
        rgba(255,200,121,.26);
}

.cycle-badge {
    width: 45px;
    height: 45px;

    display: grid;
    place-items: center;

    border:
        1px solid
        var(--line);

    border-radius: 13px;

    color: var(--primary);
    font-size: 18px;
    font-weight: 900;
}

.cycle-badge span {
    display: block;

    margin-top: -7px;

    color: var(--muted);
    font-size: 8px;
    font-weight: 700;
}

.result-time {
    display: block;

    margin-top: 21px;

    font-size:
        clamp(
            25px,
            4vw,
            35px
        );

    line-height: 1;
    letter-spacing: -1.4px;
}

.result-day,
.sleep-duration,
.guidance-label {
    display: block;
}

.result-day {
    margin-top: 5px;

    color: var(--muted);
    font-size: 11px;
}

.sleep-duration {
    margin-top: 14px;

    color: var(--muted);
    font-size: 12px;
}

.guidance-label {
    margin-top: 7px;

    color: var(--success);
    font-size: 11px;
    font-weight: 750;
}

.warning .guidance-label {
    color: var(--warning);
}

.neutral .guidance-label {
    color: var(--muted);
}

.result-disclaimer {
    margin:
        17px 0 0;

    color: var(--muted);
    font-size: 12px;
}

.content-section,
.formula-section,
.age-section,
.faq-section,
.sources-section,
.simple-page {
    width:
        min(
            1030px,
            calc(100% - 32px)
        );

    margin:
        0 auto
        100px;
}

.section-heading {
    max-width: 750px;
    margin-bottom: 28px;
}

.section-heading h2,
.formula-copy h2,
.sources-section h2,
.simple-page h1 {
    margin:
        7px 0
        12px;

    font-size:
        clamp(
            30px,
            5vw,
            48px
        );

    line-height: 1.05;
    letter-spacing: -1.8px;
}

.section-heading p,
.formula-copy p,
.sources-section > p,
.simple-page p {
    color: var(--muted);
}

.feature-grid {
    display: grid;
    grid-template-columns:
        repeat(3, 1fr);

    gap: 13px;
}

.feature-card,
.article-grid article,
.source-panel {
    padding: 22px;

    border:
        1px solid
        var(--line);

    border-radius: 18px;

    background: var(--surface);
    backdrop-filter: blur(15px);
}

.feature-icon {
    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    border-radius: 14px;

    background:
        rgba(147,136,255,.12);

    color: var(--primary);

    font-weight: 900;
}

.feature-card h3 {
    margin:
        18px 0
        8px;
}

.feature-card p {
    margin: 0;

    color: var(--muted);
}

.formula-section {
    display: grid;
    grid-template-columns:
        1.15fr
        .85fr;

    gap: 50px;
    align-items: center;
}

.formula-box {
    margin:
        18px 0;

    padding:
        16px 18px;

    border:
        1px solid
        rgba(147,136,255,.24);

    border-radius: 14px;

    background:
        rgba(147,136,255,.07);

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        monospace;

    color: var(--text);
}

.text-link {
    display: inline-flex;
    margin-top: 6px;

    color: var(--cyan);
    font-weight: 750;
    text-decoration: none;
}

.orbit-visual {
    position: relative;

    width: min(360px, 80vw);
    aspect-ratio: 1;

    margin: 0 auto;
}

.orbit,
.orbit-center {
    position: absolute;
    border-radius: 50%;
}

.orbit {
    inset: 10%;

    border:
        1px solid
        rgba(147,136,255,.22);

    animation:
        orbitSpin
        16s
        linear
        infinite;
}

.orbit-two {
    inset: 25%;
    animation-duration: 11s;
    animation-direction: reverse;
}

.orbit-dot {
    position: absolute;

    width: 12px;
    height: 12px;

    top: 50%;
    right: -6px;

    border-radius: 50%;

    background: var(--cyan);
    box-shadow:
        0 0 18px
        rgba(123,220,255,.6);
}

.orbit-two .orbit-dot {
    background: var(--moon);
}

.orbit-center {
    inset: 36%;

    display: grid;
    place-items: center;

    background:
        radial-gradient(
            circle,
            rgba(147,136,255,.25),
            rgba(147,136,255,.06)
        );

    border:
        1px solid
        var(--line);
}

.orbit-center span {
    font-size: 42px;
    color: var(--moon);
}

.orbit-center small {
    margin-top: -32px;

    color: var(--muted);
    font-size: 10px;
}

.age-table-wrap {
    overflow-x: auto;

    border:
        1px solid
        var(--line);

    border-radius: 18px;

    margin-bottom: 17px;
}

.age-table {
    width: 100%;

    border-collapse:
        collapse;

    background: var(--surface);
}

.age-table th,
.age-table td {
    padding:
        15px 17px;

    text-align: left;

    border-bottom:
        1px solid
        var(--line);
}

.age-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .7px;
}

.age-table tr:last-child td {
    border-bottom: 0;
}

.faq-list {
    display: grid;
    gap: 10px;
}

.faq-list details {
    border:
        1px solid
        var(--line);

    border-radius: 16px;

    background: var(--surface);
}

.faq-list summary {
    padding: 17px 19px;

    font-weight: 750;
    cursor: pointer;
}

.faq-list details p {
    margin:
        0 19px
        18px;

    color: var(--muted);
}

.sources-section {
    padding: 28px;

    border:
        1px solid
        var(--line);

    border-radius: 22px;

    background:
        linear-gradient(
            135deg,
            rgba(147,136,255,.10),
            rgba(123,220,255,.04)
        );
}

.sources-section a {
    color: var(--cyan);
}

.source-note {
    font-size: 13px;
}

.simple-page {
    min-height: 55vh;
    padding-top: 80px;
}

.simple-page h2 {
    margin-top: 35px;
}

.page-lead {
    max-width: 800px;
    font-size: 18px;
}

.wide-page {
    width:
        min(
            980px,
            calc(100% - 32px)
        );
}

.article-grid {
    display: grid;
    grid-template-columns:
        repeat(2, 1fr);

    gap: 13px;

    margin-top: 30px;
}

.article-grid article h2 {
    margin-top: 0;
}

.primary-link {
    display: inline-flex;

    margin-top: 16px;
    padding:
        12px 17px;

    border-radius: 13px;

    background:
        linear-gradient(
            100deg,
            var(--primary-2),
            var(--primary)
        );

    color: white;
    font-weight: 800;
    text-decoration: none;
}

.site-footer {
    border-top:
        1px solid
        var(--line);

    background:
        rgba(0,0,0,.07);
}

.footer-inner {
    width:
        min(
            1100px,
            calc(100% - 32px)
        );

    margin: 0 auto;

    padding:
        35px 0;

    display: grid;
    grid-template-columns:
        1.2fr
        1fr;

    gap: 25px;
}

.footer-brand {
    font-weight: 800;
    text-decoration: none;
}

.footer-inner > div p,
.medical-note,
.copyright {
    color: var(--muted);
    font-size: 12px;
}

.footer-inner nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.footer-inner nav a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;

    padding:
        6px 9px;

    color: var(--muted);
    text-decoration: none;
}

.medical-note,
.copyright {
    margin: 0;
}

.copyright {
    text-align: right;
}

@keyframes moonFloat {
    0%,
    100% {
        transform:
            translateY(0)
            rotate(-5deg);
    }

    50% {
        transform:
            translateY(-16px)
            rotate(2deg);
    }
}

@keyframes twinkle {
    from {
        opacity: .18;
        transform: scale(.7);
    }

    to {
        opacity: .85;
        transform: scale(1.2);
    }
}

@keyframes cloudDrift {
    from {
        transform:
            translateX(0);
    }

    to {
        transform:
            translateX(
                calc(100vw + 700px)
            );
    }
}

@keyframes resultRise {
    from {
        opacity: 0;
        transform:
            translateY(12px);
    }

    to {
        opacity: 1;
        transform:
            translateY(0);
    }
}

@keyframes orbitSpin {
    to {
        transform:
            rotate(360deg);
    }
}

@media (max-width: 820px) {
    .menu-toggle {
        display: flex;
        margin-left: auto;
    }

    .main-nav {
        display: none;

        position: absolute;

        top: calc(100% + 8px);
        left: 16px;
        right: 16px;

        padding: 9px;

        border:
            1px solid
            var(--line);

        border-radius: 16px;

        background:
            var(--surface-solid);

        box-shadow:
            var(--shadow);

        flex-direction: column;
        align-items: stretch;
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav a,
    .theme-toggle {
        width: 100%;
        min-height: 44px;
    }

    .hero {
        grid-template-columns: 1fr;

        padding-top: 65px;
        gap: 22px;
    }

    .hero h1 {
        letter-spacing: -2.4px;
    }

    .local-clock {
        width: max-content;
    }

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

    .setting-card {
        min-height: auto;
    }

    .result-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

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

    .formula-section {
        grid-template-columns: 1fr;
    }

    .orbit-visual {
        width: min(300px, 78vw);
    }

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

@media (max-width: 560px) {
    .header-inner {
        width:
            min(
                100% - 20px,
                1180px
            );
    }

    .brand {
        font-size: 16px;
    }

    .hero,
    .calculator-shell,
    .content-section,
    .formula-section,
    .age-section,
    .faq-section,
    .sources-section,
    .simple-page {
        width:
            calc(100% - 20px);
    }

    .hero {
        padding-top: 46px;
    }

    .hero h1 {
        font-size: 46px;
        letter-spacing: -2.1px;
    }

    .hero-lead {
        font-size: 16px;
    }

    .calculator-card {
        padding: 17px;
        border-radius: 20px;
    }

    .calculator-heading {
        display: block;
    }

    .sleep-status {
        display: inline-flex;
        margin-top: 12px;
    }

    .mode-tabs {
        grid-template-columns: 1fr;
    }

    .mode-tab {
        text-align: left;
    }

    .time-control {
        flex-direction: column;
    }

    .result-intro {
        display: block;
    }

    .result-actions {
        margin-top: 14px;
    }

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

    .result-card {
        display: grid;

        grid-template-columns:
            auto 1fr;

        column-gap: 14px;
        align-items: center;
    }

    .result-time,
    .result-day,
    .sleep-duration,
    .guidance-label {
        grid-column: 2;
    }

    .cycle-badge {
        grid-row:
            1 / span 4;

        align-self: center;
    }

    .result-time {
        margin-top: 0;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-inner nav {
        justify-content: flex-start;
    }

    .copyright {
        text-align: left;
    }
}

@media (
    prefers-reduced-motion: reduce
) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* =====================================================
   PHASE 2 ADVANCED SLEEP TOOLS
   ===================================================== */

.tool-hero,
.tools-directory,
.tool-workspace,
.answer-panel,
.tool-explainer,
.steps-section,
.tool-faq,
.related-section {
    width:
        min(
            1030px,
            calc(100% - 32px)
        );

    margin-left: auto;
    margin-right: auto;
}

.tool-hero {
    min-height: 345px;

    padding:
        82px 0
        42px;

    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        230px;

    gap: 48px;
    align-items: center;
}

.tool-hero-copy {
    max-width: 760px;
}

.tool-hero h1,
.tools-directory h1 {
    margin:
        8px 0
        16px;

    font-size:
        clamp(
            42px,
            7vw,
            68px
        );

    line-height: .98;
    letter-spacing: -3px;
}

.tool-hero p {
    margin: 0;

    max-width: 720px;

    color: var(--muted);
    font-size: 18px;
}

.tool-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin-top: 22px;
}

.tool-pills span {
    padding:
        7px 10px;

    border:
        1px solid
        var(--line);

    border-radius: 999px;

    background:
        rgba(255,255,255,.025);

    color: var(--muted);
    font-size: 12px;
}

.mini-orbit {
    position: relative;

    width: 210px;
    height: 210px;

    margin: auto;
}

.mini-orbit-ring {
    position: absolute;
    inset: 0;

    border:
        1px solid
        rgba(147,136,255,.28);

    border-radius: 50%;

    animation:
        orbitSpin
        17s
        linear
        infinite;
}

.mini-orbit-ring::after {
    content: "";

    position: absolute;

    width: 13px;
    height: 13px;

    top: 50%;
    right: -7px;

    border-radius: 50%;

    background: var(--cyan);

    box-shadow:
        0 0 22px
        rgba(123,220,255,.7);
}

.mini-orbit-moon {
    position: absolute;
    inset: 25%;

    display: grid;
    place-items: center;

    border:
        1px solid
        var(--line);

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(147,136,255,.22),
            rgba(147,136,255,.04)
        );

    color: var(--moon);
    font-size: 54px;
}

.tool-workspace {
    margin-bottom: 35px;
}

.phase2-tool {
    position: relative;

    padding: 28px;

    border:
        1px solid
        var(--line);

    border-radius: 25px;

    background:
        linear-gradient(
            145deg,
            rgba(24,33,62,.94),
            rgba(14,20,40,.92)
        );

    box-shadow: var(--shadow);

    overflow: hidden;
}

:root[data-theme="light"]
.phase2-tool {
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.97),
            rgba(242,246,255,.96)
        );
}

.phase2-tool::after {
    content: "";

    position: absolute;

    width: 280px;
    height: 280px;

    top: -180px;
    right: -120px;

    border-radius: 50%;

    background: var(--primary);

    filter: blur(90px);
    opacity: .13;

    pointer-events: none;
}

.phase2-form,
.phase2-results {
    position: relative;
    z-index: 1;
}

.primary-time-field {
    padding: 20px;

    border:
        1px solid
        var(--line);

    border-radius: 17px;

    background:
        rgba(255,255,255,.025);
}

.primary-time-field[hidden] {
    display: none;
}

.primary-time-field label {
    display: block;
    margin-bottom: 9px;

    font-weight: 750;
}

.primary-time-field
input[type="time"] {
    width: 100%;
}

.phase2-settings {
    display: grid;
    grid-template-columns:
        repeat(2, 1fr);

    gap: 12px;

    margin-top: 12px;
}

.phase2-settings.three {
    grid-template-columns:
        repeat(3, 1fr);
}

.phase2-settings.single {
    grid-template-columns: 1fr;
}

.phase2-setting {
    min-width: 0;

    padding: 18px;

    border:
        1px solid
        var(--line);

    border-radius: 16px;

    background:
        rgba(255,255,255,.022);
}

.phase2-setting > span {
    display: block;

    color: var(--muted);
    font-size: 13px;
}

.phase2-setting > strong {
    display: block;

    margin:
        5px 0
        9px;

    font-size: 22px;
}

.phase2-setting input {
    width: 100%;

    accent-color:
        var(--primary);
}

.phase2-setting small {
    display: block;

    margin-top: 4px;

    color: var(--muted);
    font-size: 10px;
}

.phase2-calculate {
    width: 100%;
    min-height: 56px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    margin-top: 14px;

    border: 0;
    border-radius: 14px;

    background:
        linear-gradient(
            100deg,
            var(--primary-2),
            var(--primary),
            #69bce8
        );

    color: white;

    font-weight: 850;

    cursor: pointer;

    transition:
        transform .18s ease,
        box-shadow .18s ease;

    box-shadow:
        0 13px 30px
        rgba(108,99,255,.24);
}

.phase2-calculate:hover {
    transform:
        translateY(-2px);

    box-shadow:
        0 18px 36px
        rgba(108,99,255,.31);
}

.phase2-results {
    margin-top: 26px;
    padding-top: 25px;

    border-top:
        1px solid
        var(--line);
}

.phase2-results[hidden] {
    display: none;
}

.phase2-result-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    align-items: flex-start;
}

.phase2-result-head h2 {
    margin:
        5px 0
        4px;

    font-size:
        clamp(
            26px,
            4vw,
            36px
        );

    letter-spacing: -1.2px;
}

.phase2-result-head p {
    max-width: 660px;

    margin: 0;

    color: var(--muted);
}

.phase2-result-actions {
    display: flex;
    gap: 7px;
}

.phase2-result-actions button {
    min-height: 40px;

    padding:
        8px 12px;

    border:
        1px solid
        var(--line);

    border-radius: 11px;

    background:
        var(--surface-solid);

    color: var(--text);

    cursor: pointer;
}

.phase2-result-grid {
    display: grid;
    grid-template-columns:
        repeat(4, 1fr);

    gap: 10px;

    margin-top: 19px;
}

.phase2-result-grid.three {
    grid-template-columns:
        repeat(3, 1fr);
}

.phase2-result-card {
    padding: 18px;

    border:
        1px solid
        var(--line);

    border-radius: 16px;

    background:
        var(--surface-solid);

    animation:
        resultRise
        .42s
        ease
        both;
}

.phase2-result-card span,
.phase2-result-card small {
    display: block;

    color: var(--muted);
}

.phase2-result-card span {
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.phase2-result-card strong {
    display: block;

    margin:
        12px 0
        7px;

    font-size:
        clamp(
            25px,
            4vw,
            34px
        );

    letter-spacing: -1px;
}

.phase2-result-card small {
    line-height: 1.45;
}

.phase2-result-note {
    margin:
        15px 0
        0;

    color: var(--muted);
    font-size: 11px;
}

.answer-panel,
.tool-explainer,
.steps-section,
.tool-faq,
.related-section {
    margin-bottom: 82px;
}

.answer-panel {
    padding: 26px;

    border:
        1px solid
        rgba(123,220,255,.19);

    border-radius: 20px;

    background:
        linear-gradient(
            135deg,
            rgba(123,220,255,.07),
            rgba(147,136,255,.08)
        );
}

.answer-panel h2,
.tool-explainer h2,
.steps-section h2,
.tool-faq h2,
.related-section h2 {
    margin:
        7px 0
        11px;

    font-size:
        clamp(
            28px,
            5vw,
            43px
        );

    line-height: 1.05;
    letter-spacing: -1.5px;
}

.answer-panel p,
.tool-explainer p {
    max-width: 820px;

    color: var(--muted);
}

.tool-explainer {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        240px;

    gap: 45px;
    align-items: center;
}

.accuracy-note {
    padding:
        11px 13px;

    border-left:
        3px solid
        var(--primary);

    background:
        rgba(147,136,255,.05);
}

.phase2-orbit {
    position: relative;

    width: 210px;
    height: 210px;

    display: grid;
    place-items: center;

    margin: auto;

    border:
        1px solid
        var(--line);

    border-radius: 50%;
}

.phase2-orbit span {
    color: var(--moon);
    font-size: 48px;
}

.phase2-orbit div {
    position: absolute;
    inset: 18%;

    border:
        1px dashed
        rgba(147,136,255,.34);

    border-radius: 50%;

    animation:
        orbitSpin
        10s
        linear
        infinite;
}

.tool-steps {
    display: grid;
    grid-template-columns:
        repeat(3, 1fr);

    gap: 12px;

    margin: 24px 0 0;
    padding: 0;

    list-style: none;
}

.tool-steps li {
    padding: 20px;

    border:
        1px solid
        var(--line);

    border-radius: 17px;

    background:
        var(--surface);
}

.tool-steps li > span {
    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background:
        rgba(147,136,255,.12);

    color: var(--primary);

    font-weight: 900;
}

.tool-steps p {
    margin:
        14px 0
        0;

    color: var(--muted);
}

.related-grid {
    display: grid;
    grid-template-columns:
        repeat(3, 1fr);

    gap: 11px;

    margin-top: 22px;
}

.related-tool {
    padding: 19px;

    border:
        1px solid
        var(--line);

    border-radius: 16px;

    background:
        var(--surface);

    text-decoration: none;

    transition:
        transform .18s ease,
        border .18s ease;
}

.related-tool:hover {
    transform:
        translateY(-3px);

    border-color:
        rgba(147,136,255,.4);
}

.related-tool strong,
.related-tool span {
    display: block;
}

.related-tool span {
    margin-top: 5px;

    color: var(--muted);
    font-size: 13px;
}

.nap-mode-row {
    display: grid;
    grid-template-columns:
        repeat(2, 1fr);

    gap: 10px;

    margin-bottom: 12px;
}

.radio-card {
    position: relative;

    min-height: 80px;

    display: flex;
    align-items: center;
    gap: 11px;

    padding: 15px;

    border:
        1px solid
        var(--line);

    border-radius: 15px;

    background:
        rgba(255,255,255,.02);

    cursor: pointer;
}

.radio-card input {
    accent-color:
        var(--primary);
}

.radio-card strong,
.radio-card small {
    display: block;
}

.radio-card small {
    margin-top: 2px;

    color: var(--muted);
}

.preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;

    margin-top: 12px;
}

.preset-row button {
    min-height: 38px;

    padding:
        7px 11px;

    border:
        1px solid
        var(--line);

    border-radius: 999px;

    background:
        var(--surface-solid);

    color: var(--text);

    cursor: pointer;
}

.nap-timeline {
    display: grid;
    grid-template-columns:
        1fr auto
        1fr auto
        1fr;

    align-items: center;
    gap: 11px;

    margin-top: 21px;
}

.nap-timeline div {
    padding: 17px;

    border:
        1px solid
        var(--line);

    border-radius: 15px;

    background:
        var(--surface-solid);

    text-align: center;
}

.nap-timeline span,
.nap-timeline strong {
    display: block;
}

.nap-timeline span {
    color: var(--muted);
    font-size: 11px;
}

.nap-timeline strong {
    margin-top: 4px;
    font-size: 23px;
}

.nap-timeline i {
    width: 26px;
    height: 1px;

    background:
        var(--line);
}

.duration-time-grid {
    display: grid;
    grid-template-columns:
        repeat(2, 1fr);

    gap: 11px;
}

.duration-summary {
    display: grid;
    grid-template-columns:
        repeat(3, 1fr);

    gap: 11px;

    margin-top: 20px;
}

.duration-summary article,
.cycle-summary > div {
    padding: 18px;

    border:
        1px solid
        var(--line);

    border-radius: 15px;

    background:
        var(--surface-solid);
}

.duration-summary article span,
.duration-summary article strong,
.cycle-summary span,
.cycle-summary strong {
    display: block;
}

.duration-summary article span,
.cycle-summary span {
    color: var(--muted);
    font-size: 11px;
}

.duration-summary article strong,
.cycle-summary strong {
    margin-top: 5px;
    font-size: 25px;
}

.duration-summary .highlight {
    border-color:
        rgba(130,231,189,.3);

    background:
        linear-gradient(
            145deg,
            rgba(130,231,189,.08),
            var(--surface-solid)
        );
}

.cycle-summary {
    display: grid;
    grid-template-columns:
        repeat(3, 1fr);

    gap: 10px;

    margin-top: 20px;
}

.compare-title {
    margin:
        28px 0
        0;
}

.tools-directory {
    padding:
        82px 0
        95px;
}

.tools-directory > .page-lead {
    max-width: 780px;
}

.directory-grid {
    display: grid;
    grid-template-columns:
        repeat(3, 1fr);

    gap: 12px;

    margin-top: 32px;
}

.directory-card {
    min-height: 245px;

    display: flex;
    flex-direction: column;

    padding: 22px;

    border:
        1px solid
        var(--line);

    border-radius: 19px;

    background: var(--surface);

    color: var(--text);
    text-decoration: none;

    transition:
        transform .2s ease,
        border .2s ease,
        box-shadow .2s ease;
}

.directory-card:hover {
    transform:
        translateY(-4px);

    border-color:
        rgba(147,136,255,.38);

    box-shadow:
        0 18px 40px
        rgba(0,0,0,.14);
}

.directory-card.featured {
    background:
        linear-gradient(
            145deg,
            rgba(147,136,255,.13),
            rgba(123,220,255,.06)
        );
}

.directory-icon {
    width: 46px;
    height: 46px;

    display: grid;
    place-items: center;

    border-radius: 13px;

    background:
        rgba(147,136,255,.10);

    color: var(--moon);
    font-size: 22px;
}

.directory-card h2 {
    margin:
        18px 0
        7px;

    font-size: 21px;
}

.directory-card p {
    margin:
        0 0
        16px;

    color: var(--muted);
}

.directory-card strong {
    margin-top: auto;

    color: var(--cyan);
    font-size: 13px;
}

.directory-explainer {
    max-width: 790px;

    margin-top: 55px;

    padding: 25px;

    border:
        1px solid
        var(--line);

    border-radius: 18px;

    background:
        rgba(255,255,255,.02);
}

.directory-explainer h2 {
    margin-top: 0;
}

.directory-explainer p {
    color: var(--muted);
}

@media (max-width: 820px) {
    .tool-hero {
        grid-template-columns: 1fr;

        padding-top: 60px;
    }

    .mini-orbit {
        display: none;
    }

    .phase2-settings,
    .phase2-settings.three {
        grid-template-columns: 1fr;
    }

    .phase2-result-grid,
    .phase2-result-grid.three {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .tool-explainer {
        grid-template-columns: 1fr;
    }

    .phase2-orbit {
        width: 180px;
        height: 180px;
    }

    .tool-steps,
    .related-grid {
        grid-template-columns: 1fr;
    }

    .directory-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .tool-hero,
    .tools-directory,
    .tool-workspace,
    .answer-panel,
    .tool-explainer,
    .steps-section,
    .tool-faq,
    .related-section {
        width:
            calc(100% - 20px);
    }

    .tool-hero {
        min-height: auto;

        padding:
            47px 0
            30px;
    }

    .tool-hero h1,
    .tools-directory h1 {
        font-size: 44px;
        letter-spacing: -2px;
    }

    .tool-hero p {
        font-size: 16px;
    }

    .phase2-tool {
        padding: 17px;
        border-radius: 20px;
    }

    .phase2-result-head {
        display: block;
    }

    .phase2-result-actions {
        margin-top: 13px;
    }

    .phase2-result-grid,
    .phase2-result-grid.three {
        grid-template-columns: 1fr;
    }

    .duration-time-grid,
    .duration-summary,
    .cycle-summary,
    .nap-mode-row {
        grid-template-columns: 1fr;
    }

    .nap-timeline {
        grid-template-columns: 1fr;
    }

    .nap-timeline i {
        width: 1px;
        height: 18px;

        margin: auto;
    }

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

    .directory-card {
        min-height: auto;
    }
}
