:root {
    --bg: #0b0b0a;
    --panel: #121310;
    --panel-strong: #181a15;
    --text: #f1efe8;
    --muted: #99998f;
    --dim: #686960;
    --line: #2b2d27;
    --green: #b7e36a;
    --green-dark: #26351a;
    --coral: #ff6b4a;
    --blue: #7dcff2;
    --serif: "Instrument Serif", Georgia, serif;
    --sans: "DM Sans", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color: var(--text);
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button,
a {
    color: inherit;
}

button {
    cursor: pointer;
}

a {
    text-underline-offset: 4px;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.gate {
    display: grid;
    min-height: 100svh;
    grid-template-rows: auto 1fr auto;
    padding: 34px 4vw;
}

.gate-wordmark,
.wordmark {
    font-family: var(--serif);
    font-size: 26px;
    text-decoration: none;
}

.gate-form {
    width: min(100%, 520px);
    align-self: center;
    justify-self: center;
}

.kicker {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.gate h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: 82px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 0.88;
}

.gate-copy {
    margin: 24px 0 40px;
    color: var(--muted);
    font-family: var(--serif);
    font-size: 23px;
}

.gate-form input {
    width: 100%;
    height: 56px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 4px;
    outline: 0;
    background: var(--panel);
    color: var(--text);
}

.gate-form input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(183, 227, 106, 0.1);
}

.gate-form button {
    width: 100%;
    height: 52px;
    margin-top: 10px;
    border: 0;
    border-radius: 4px;
    background: var(--green);
    color: #10120d;
    font-weight: 600;
}

.gate-error {
    display: none;
    margin: 12px 0 0;
    color: var(--coral);
    font-size: 13px;
}

.gate-error.visible {
    display: block;
}

.gate-nav {
    display: flex;
    gap: 22px;
    justify-content: flex-end;
}

.gate-nav a {
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
}

.topbar {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 0 4vw;
    border-bottom: 1px solid var(--line);
}

.tool-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.tool-nav a,
.tool-nav button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 11px;
    text-decoration: none;
}

.tool-nav a:hover,
.tool-nav button:hover {
    color: var(--text);
}

.dashboard {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 82px 0 120px;
}

.page-heading {
    display: grid;
    grid-template-columns: 1.5fr 0.5fr;
    gap: 60px;
    align-items: end;
    margin-bottom: 52px;
}

.page-heading h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: 112px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 0.82;
}

.heading-meta {
    padding-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.heading-meta p {
    margin: 6px 0 0;
}

.sync-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sync-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(183, 227, 106, 0.09);
}

.sync-line.error .sync-dot {
    background: var(--coral);
    box-shadow: 0 0 0 4px rgba(255, 107, 74, 0.09);
}

.today-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--line);
}

.today-session,
.readiness-panel {
    background: var(--panel);
}

.today-session {
    min-height: 385px;
    padding: 38px;
}

.session-topline {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 11px;
}

.today-session h2 {
    max-width: 760px;
    margin: 64px 0 18px;
    font-family: var(--serif);
    font-size: 60px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 0.95;
}

.session-detail {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.session-actual {
    display: flex;
    gap: 18px;
    margin-top: 42px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--text);
    font-size: 12px;
}

.actual-label {
    color: var(--green);
    font-weight: 600;
    text-transform: uppercase;
}

.readiness-panel {
    display: flex;
    min-height: 385px;
    flex-direction: column;
    justify-content: space-between;
    padding: 34px;
}

.readiness-ring {
    --ready: 0%;
    position: relative;
    display: grid;
    width: 152px;
    height: 152px;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--green) var(--ready), var(--line) 0);
}

.readiness-ring::before {
    position: absolute;
    width: 126px;
    height: 126px;
    border-radius: 50%;
    background: var(--panel);
    content: "";
}

.readiness-ring > div {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 9px;
    align-items: center;
}

.readiness-ring strong {
    font-family: var(--serif);
    font-size: 54px;
    font-weight: 400;
    line-height: 0.7;
}

.readiness-ring span {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.readiness-panel h2 {
    margin: 0 0 8px;
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 400;
}

.readiness-panel p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.metric {
    min-height: 176px;
    padding: 24px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.metric-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin: 31px 0 20px;
    font-family: var(--serif);
    font-size: 43px;
    font-weight: 400;
    line-height: 1;
}

.metric p {
    margin: 0;
    color: var(--dim);
    font-size: 11px;
}

.progress {
    height: 3px;
    overflow: hidden;
    background: var(--line);
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--green);
    transition: width 700ms ease;
}

.progress-coral span {
    background: var(--coral);
}

.section-block {
    margin-top: 120px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.section-heading h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: 50px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
}

.section-heading > p {
    max-width: 280px;
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    text-align: right;
}

.week-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.week-day {
    position: relative;
    min-height: 202px;
    padding: 18px 15px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.week-day.today {
    background: var(--panel);
}

.week-day.complete::after {
    position: absolute;
    top: 18px;
    right: 14px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    content: "";
}

.week-date {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.week-day h3 {
    margin: 36px 0 8px;
    font-family: var(--serif);
    font-size: 23px;
    font-weight: 400;
    line-height: 1;
}

.week-day p {
    margin: 0;
    color: var(--dim);
    font-size: 10px;
    line-height: 1.45;
}

.week-status {
    position: absolute;
    right: 14px;
    bottom: 14px;
    left: 15px;
    color: var(--muted);
    font-size: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 16px;
}

.calendar-legend,
.calendar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
}

.calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dim);
}

.legend-dot.strava {
    background: var(--green);
}

.legend-dot.gcal {
    background: var(--blue);
}

.calendar-actions button,
.calendar-actions label {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 9px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.calendar-actions button:hover,
.calendar-actions label:hover {
    border-color: var(--green);
    color: var(--text);
}

.calendar-shell {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 5px;
    outline: 0;
}

.calendar-shell:focus-visible {
    box-shadow: 0 0 0 3px rgba(183, 227, 106, 0.1);
}

.training-calendar {
    width: 100%;
    min-width: 1260px;
    border-collapse: collapse;
    table-layout: fixed;
}

.training-calendar th {
    height: 44px;
    padding: 0 14px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    color: var(--muted);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
}

.training-calendar th:last-child,
.training-calendar td:last-child {
    border-right: 0;
}

.training-calendar td {
    position: relative;
    height: 310px;
    padding: 14px;
    vertical-align: top;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.training-calendar tr:last-child td {
    border-bottom: 0;
}

.training-calendar td.past {
    background: #0e0f0c;
}

.training-calendar td.today {
    background: var(--panel-strong);
    box-shadow: inset 0 3px 0 var(--green);
}

.training-calendar td.strava-verified {
    background: rgba(183, 227, 106, 0.035);
}

.calendar-date {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.calendar-date strong {
    color: var(--text);
    font-weight: 500;
}

.workout-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 16px 0 12px;
}

.workout-tag {
    display: inline-flex;
    min-height: 20px;
    align-items: center;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 2px;
    color: var(--muted);
    font-size: 7px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.workout-tag.run,
.workout-tag.race {
    border-color: rgba(255, 107, 74, 0.42);
    color: var(--coral);
}

.workout-tag.strength,
.workout-tag.row,
.workout-tag.stairs {
    border-color: rgba(183, 227, 106, 0.35);
    color: var(--green);
}

.workout-tag.bike,
.workout-tag.swim {
    border-color: rgba(125, 207, 242, 0.4);
    color: var(--blue);
}

.calendar-workout-title {
    margin: 0 0 8px;
    font-family: var(--serif);
    font-size: 21px;
    font-weight: 400;
    line-height: 1.05;
}

.calendar-workout-detail {
    margin: 0;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

.calendar-integrations {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 15px;
}

.integration-block {
    padding: 8px;
    border-left: 2px solid var(--line);
    background: rgba(255, 255, 255, 0.018);
}

.integration-block.strava {
    border-left-color: var(--green);
}

.integration-block.gcal {
    border-left-color: var(--blue);
}

.integration-source {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 7px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.integration-block a,
.integration-block strong {
    display: block;
    color: var(--text);
    font-family: var(--serif);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.15;
    text-decoration: none;
}

.integration-block p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.4;
}

.integration-block details {
    margin-top: 5px;
}

.integration-block summary {
    color: var(--dim);
    cursor: pointer;
    font-size: 7px;
    text-transform: uppercase;
}

.calendar-export-link {
    position: absolute;
    right: 12px;
    bottom: 11px;
    color: var(--muted);
    font-size: 8px;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-transform: uppercase;
}

.calendar-export-link:hover {
    color: var(--green);
}

.trend-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.trend-panel {
    padding: 26px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.trend-meta {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

.trend-meta div {
    display: flex;
    flex-direction: column;
}

.trend-meta span {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.trend-meta strong {
    margin-top: 4px;
    font-family: var(--serif);
    font-size: 34px;
    font-weight: 400;
}

.trend-panel svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-grid {
    stroke: var(--line);
    stroke-width: 1;
}

.chart-line {
    fill: none;
    stroke: var(--green);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.chart-line.sleep {
    stroke: var(--blue);
}

.chart-area {
    fill: rgba(183, 227, 106, 0.06);
}

.chart-area.sleep {
    fill: rgba(125, 207, 242, 0.06);
}

.chart-dot {
    fill: var(--panel);
    stroke: var(--green);
    stroke-width: 2;
}

.chart-dot.sleep {
    stroke: var(--blue);
}

.plan-tools {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.5fr);
    gap: 70px;
}

.compact-heading {
    margin-top: 0;
}

.upcoming-item {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 24px;
    align-items: start;
    padding: 22px 0;
    border-top: 1px solid var(--line);
}

.upcoming-item:last-child {
    border-bottom: 1px solid var(--line);
}

.upcoming-date {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.08em;
    line-height: 1.5;
    text-transform: uppercase;
}

.upcoming-item h3 {
    margin: -3px 0 7px;
    font-family: var(--serif);
    font-size: 27px;
    font-weight: 400;
}

.upcoming-item p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.calendar-link {
    font-size: 16px;
    text-decoration: none;
}

.utility-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.utility-panel {
    padding: 26px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.utility-panel h3 {
    margin: 28px 0 18px;
    font-family: var(--serif);
    font-size: 27px;
    font-weight: 400;
}

.utility-panel ol {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.8;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    border-radius: 4px;
}

.segmented button {
    height: 34px;
    border: 0;
    border-right: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 11px;
}

.segmented button:last-child {
    border-right: 0;
}

.segmented button.active {
    background: var(--green);
    color: #10120d;
}

.utility-panel label {
    display: block;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 10px;
}

.pace-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}

.pace-input input,
.pace-input button {
    height: 42px;
    border: 1px solid var(--line);
}

.pace-input input {
    min-width: 0;
    padding: 0 12px;
    outline: 0;
    background: var(--bg);
    color: var(--text);
}

.pace-input button {
    padding: 0 14px;
    background: var(--text);
    color: var(--bg);
    font-size: 10px;
}

.pace-results {
    margin: 26px 0 0;
}

.pace-results div {
    display: flex;
    justify-content: space-between;
    padding: 9px 0;
    border-top: 1px solid var(--line);
}

.pace-results dt {
    color: var(--muted);
    font-size: 10px;
}

.pace-results dd {
    margin: 0;
    font-family: var(--serif);
    font-size: 20px;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    padding: 28px 4vw;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-size: 10px;
}

.footer div {
    display: flex;
    gap: 20px;
}

.footer a {
    color: var(--muted);
    text-decoration: none;
}

@media (max-width: 980px) {
    .page-heading h1 {
        font-size: 88px;
    }

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

    .readiness-panel {
        min-height: 0;
        flex-direction: row;
        gap: 40px;
        align-items: center;
    }

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

    .week-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .trend-grid,
    .plan-tools {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .gate {
        padding: 24px 20px;
    }

    .gate h1 {
        font-size: 59px;
    }

    .gate-nav {
        justify-content: flex-start;
    }

    .topbar {
        min-height: 104px;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        justify-content: center;
        padding: 18px 20px 0;
    }

    .tool-nav {
        width: 100%;
        gap: 20px;
        padding-bottom: 14px;
        overflow-x: auto;
    }

    .dashboard {
        width: calc(100% - 36px);
        padding-top: 62px;
    }

    .page-heading {
        grid-template-columns: 1fr;
        gap: 24px;
        margin-bottom: 38px;
    }

    .page-heading h1 {
        font-size: 64px;
    }

    .heading-meta {
        text-align: left;
    }

    .today-session {
        min-height: 0;
        padding: 25px 22px;
    }

    .today-session h2 {
        margin-top: 45px;
        font-size: 43px;
    }

    .readiness-panel {
        align-items: flex-start;
        flex-direction: column;
        padding: 24px 22px;
    }

    .readiness-ring {
        width: 124px;
        height: 124px;
    }

    .readiness-ring::before {
        width: 104px;
        height: 104px;
    }

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

    .metric {
        min-height: 148px;
    }

    .section-block {
        margin-top: 90px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
    }

    .section-heading h2 {
        font-size: 42px;
    }

    .section-heading > p {
        text-align: left;
    }

    .calendar-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .calendar-shell::before {
        display: block;
        padding: 10px 12px;
        border-bottom: 1px solid var(--line);
        color: var(--muted);
        content: "Swipe horizontally to view all seven days";
        font-size: 8px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .week-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .week-day {
        min-height: 178px;
    }

    .upcoming-item {
        grid-template-columns: 65px minmax(0, 1fr) auto;
        gap: 14px;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
