@font-face {
    font-family: Gabarito;
    src: url("../fonts/gabarito.woff2") format("woff2");
    font-weight: 400 900;
    font-display: swap;
}

:root {
    color-scheme: light dark;

    --paper: #f2f7ef;
    --surface: #fff;
    --ink: #14291d;
    --muted: #4e6355;
    --line: #cbd8c8;
    --tomato: #d92b1c;
    --on-tomato: #fff;
    --leaf: #236b35;
    --on-leaf: #fff;
    --danger: #b3200f;

    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2.5rem;

    --radius-field: 0.875rem;
    --radius-block: 1.75rem;
    --tap: 3.25rem;
    --nav-height: 4.75rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0e1f16;
        --surface: #17301f;
        --ink: #edf5e9;
        --muted: #a6bba9;
        --line: #2f4a38;
        --tomato: #ff6b54;
        --on-tomato: #2b0500;
        --leaf: #7fcb6b;
        --on-leaf: #0e1f16;
        --danger: #ff8f7d;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Gabarito, system-ui, sans-serif;
    font-size: 1.125rem;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
}

main {
    max-width: 30rem;
    margin: 0 auto;
    padding: var(--space-3) var(--space-2) var(--space-4);
}

.has-nav main {
    padding-bottom: calc(var(--nav-height) + var(--space-4) + env(safe-area-inset-bottom));
}

h1 {
    margin: var(--space-2) 0;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.01em;
}

h2 {
    margin: var(--space-4) 0 var(--space-1);
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.2;
}

small {
    color: var(--muted);
    font-size: 0.9375rem;
}

a {
    color: var(--leaf);
    font-weight: 600;
    text-underline-offset: 0.15em;
}

:focus-visible {
    outline: 3px solid var(--leaf);
    outline-offset: 2px;
}

code {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 1rem;
    overflow-wrap: anywhere;
}

/* Anmeldeseiten ohne Navigation */
.brand {
    max-width: 30rem;
    margin: 0 auto;
    padding: var(--space-4) var(--space-2) 0;
}

.brand img {
    display: block;
    width: 6rem;
    height: 6rem;
}

/* Formulare */
label {
    display: block;
    margin-top: var(--space-2);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

input:not([type="hidden"]) {
    width: 100%;
    min-height: var(--tap);
    padding: 0 var(--space-2);
    border: 2px solid var(--line);
    border-radius: var(--radius-field);
    background: var(--surface);
    color: inherit;
    font: inherit;
}

input:focus-visible {
    border-color: var(--leaf);
    outline-width: 1px;
    outline-offset: 0;
}

button,
.button {
    display: block;
    width: 100%;
    min-height: var(--tap);
    margin-top: var(--space-3);
    padding: 0.75rem var(--space-3);
    border: 0;
    border-radius: 999px;
    background: var(--tomato);
    color: var(--on-tomato);
    font: inherit;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

button.secondary {
    width: auto;
    min-height: 2.75rem;
    margin-top: 0;
    padding: 0.25rem var(--space-2);
    border: 2px solid var(--line);
    background: transparent;
    color: inherit;
    font-weight: 600;
}

.notice,
.error {
    padding: 0.75rem var(--space-2);
    border-radius: var(--radius-field);
    background: var(--surface);
}

.error,
form ul {
    color: var(--danger);
    font-weight: 600;
}

form ul {
    margin: 0.25rem 0;
    padding: 0;
    list-style: none;
}

/* Listen */
.codes,
.list,
.links {
    padding: 0;
    list-style: none;
}

.codes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: var(--space-1);
}

.list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: var(--tap);
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--line);
}

.links li {
    border-bottom: 1px solid var(--line);
}

.links a {
    display: block;
    padding: 0.75rem 0;
    text-decoration: none;
}

.links small {
    display: block;
    margin-top: -0.625rem;
    padding-bottom: 0.625rem;
}

.qr {
    display: block;
    width: 15rem;
    height: 15rem;
    margin: var(--space-2) auto;
    padding: 0.5rem;
    border-radius: var(--radius-field);
    background: #fff;
}

.prose {
    white-space: pre-line;
}

.sketch,
.exercises img {
    border-radius: var(--radius-field);
}

.sketch {
    display: block;
    width: 100%;
    height: auto;
    margin: var(--space-2) 0;
}

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

.exercises a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
}

.exercises img {
    flex: none;
}

.exercises small {
    display: block;
    font-weight: 400;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin: var(--space-2) 0;
    padding: 0;
    list-style: none;
}

.chips a {
    display: block;
    padding: 0.5rem var(--space-2);
    border-radius: 999px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.chips a[aria-current] {
    background: var(--leaf);
    color: var(--on-leaf);
}

.day {
    margin-top: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-block);
    background: var(--surface);
}

.day h2 {
    margin: 0 0 var(--space-1);
}

.day h2 a {
    color: inherit;
    text-decoration: none;
}

.planned {
    margin: 0;
}

.planned li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--line);
}

.planned li > a {
    flex: 1 1 100%;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
}

.planned img {
    width: 3.5rem;
    height: auto;
}

.row-actions {
    display: flex;
    gap: 0.375rem;
    margin-left: auto;
}

.row-actions .swap {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 var(--space-2) 0 0.75rem;
    border: 2px solid var(--line);
    border-radius: 999px;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.swap svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Sonst greift die Fehlerfarbe für Listen in Formularen. */
.swap-list {
    color: var(--ink);
    font-weight: 400;
}

.swap-list button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 0.5rem 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-weight: 400;
    text-align: left;
}

.swap-list img {
    flex: none;
    border-radius: var(--radius-field);
}

.move {
    display: flex;
    flex: none;
    gap: 0.375rem;
}

.move button {
    width: 2.75rem;
    padding: 0;
}

button:disabled {
    opacity: 0.35;
    cursor: default;
}

button.wide {
    width: 100%;
    margin-top: var(--space-2);
}

.button.quiet {
    margin-top: var(--space-2);
    background: var(--paper);
    color: var(--ink);
}

.plan-links {
    margin-top: var(--space-4);
}

select,
textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 0.75rem var(--space-2);
    border: 2px solid var(--line);
    border-radius: var(--radius-field);
    background: var(--surface);
    color: inherit;
    font: inherit;
}

/* Training */
.work {
    margin-top: var(--space-2);
    padding: 0.75rem;
    border-radius: var(--radius-block);
    background: var(--surface);
    scroll-margin-top: 5.5rem;
}

.work summary {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.work summary::-webkit-details-marker {
    display: none;
}

.work summary img {
    flex: none;
    width: 3.5rem;
    height: auto;
    border-radius: var(--radius-field);
}

.work summary small {
    display: block;
    font-weight: 400;
}

.work[open] summary img {
    width: 6rem;
}

.set {
    display: grid;
    grid-template-columns: 1.5rem 1fr 1fr 5.25rem;
    gap: 0.25rem 0.5rem;
    align-items: end;
    margin-top: var(--space-2);
    padding-bottom: 0.625rem;
    border-bottom: 1px solid var(--line);
}

.set label {
    margin: 0;
    color: var(--muted);
    font-size: 0.875rem;
}

.set input:not([type="hidden"]) {
    padding: 0 0.625rem;
    color: var(--ink);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
}

.set button {
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: var(--tap);
}

.set-number {
    align-self: center;
    margin-top: 1.25rem;
    color: var(--muted);
    font-weight: 700;
}

.set-last {
    grid-column: 2 / -1;
}

.set.done input:not([type="hidden"]) {
    border-color: transparent;
    background: var(--paper);
}

.rest {
    position: sticky;
    top: var(--space-1);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 0.5rem 0.5rem 0.5rem var(--space-2);
    border-radius: 999px;
    background: var(--leaf);
    color: var(--on-leaf);
    font-size: 1.25rem;
}

.rest.over {
    background: var(--tomato);
    color: var(--on-tomato);
}

.rest button {
    border-color: currentcolor;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-1);
    margin: var(--space-2) 0;
}

.stats div {
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius-field);
    background: var(--surface);
    text-align: center;
}

.stats dt {
    color: var(--muted);
    font-size: 0.875rem;
}

.stats dd {
    margin: 0;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.inline {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem var(--space-1);
    align-items: center;
}

.inline label {
    grid-column: 1 / -1;
    margin: 0;
}

/* Fest über der Navigation, damit der Hinweis auch beim Scrollen zu sehen ist. */
.sync {
    position: fixed;
    right: var(--space-1);
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + var(--space-1));
    left: var(--space-1);
    z-index: 1;
    max-width: 29rem;
    margin: 0 auto;
    padding: 0.625rem var(--space-2);
    border-radius: var(--radius-field);
    background: var(--ink);
    color: var(--paper);
    font-weight: 700;
    text-align: center;
}

[data-finish-offline] {
    margin-top: var(--space-2);
}

.chart {
    display: block;
    width: 100%;
    height: auto;
}

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

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

.chart-dot {
    fill: var(--leaf);
    stroke: var(--paper);
    stroke-width: 2;
}

.chart-label {
    fill: var(--ink);
    font-size: 12px;
    font-weight: 700;
}

.chart-label-end {
    text-anchor: end;
}

a.plain {
    color: inherit;
    text-decoration: none;
}

.tile small {
    display: block;
    margin-top: 0.25rem;
    color: inherit;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.25;
}

.tile span {
    padding-right: var(--space-1);
}

.run-week {
    margin: 0 0 var(--space-1);
    color: var(--muted);
    font-size: 0.9375rem;
}

.run-next h2 {
    margin-bottom: 0.25rem;
}

.run-position {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-1);
    margin-top: var(--space-2);
}

.run-position button {
    width: 100%;
}

h3 {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.25;
}

.units {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-1);
    margin-top: var(--space-2);
}

.units button {
    width: 100%;
}

.units button[aria-pressed="true"],
.methods button[aria-pressed="true"] {
    border-color: var(--leaf);
    background: var(--leaf);
    color: var(--on-leaf);
}

.work .inline {
    margin-top: var(--space-2);
}

.raise {
    margin: var(--space-2) 0 0;
    padding: 0.75rem var(--space-2);
    border-radius: var(--radius-field);
    background: var(--tomato);
    color: var(--on-tomato);
    font-weight: 700;
}

.methods button {
    padding: 0.75rem var(--space-2);
    border-radius: var(--radius-block);
    text-align: left;
}

.methods small {
    display: block;
    color: inherit;
    font-weight: 400;
}

.next-up {
    margin-left: var(--space-1);
    color: var(--danger);
    font-size: 0.9375rem;
    font-weight: 700;
}

.choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-1);
}

.choice button {
    width: 100%;
}

.choice button[aria-pressed="true"] {
    border-color: var(--leaf);
    background: var(--leaf);
    color: var(--on-leaf);
}

.invite-link {
    display: block;
    padding: 0.75rem var(--space-2);
    border-radius: var(--radius-field);
    background: var(--surface);
    user-select: all;
}

/* Startseite: zwei große Flächen, mit dem Daumen im Gym und unterwegs gut zu treffen */
.tiles {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.tile {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    min-height: 11rem;
    padding: var(--space-3);
    border-radius: var(--radius-block);
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
}

.tile svg {
    width: 4.5rem;
    height: 4.5rem;
    stroke-width: 1.5;
}

.tile-gym {
    background: var(--leaf);
    color: var(--on-leaf);
}

.tile-run {
    background: var(--tomato);
    color: var(--on-tomato);
}

.icon {
    fill: none;
    stroke: currentcolor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

/* Navigation */
.tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding-bottom: env(safe-area-inset-bottom);
}

.tabbar ul {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-width: 30rem;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    height: var(--nav-height);
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.tabbar span {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
}

.tabbar svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Der aktive Punkt ist eine kleine Tomate. */
.tabbar a[aria-current="page"] {
    color: var(--ink);
    font-weight: 800;
}

.tabbar a[aria-current="page"] span {
    background: var(--tomato);
    color: var(--on-tomato);
}
