:root {
    --tracker-bg: #ffffff;
    --tracker-fg: #1a1a1a;
    --tracker-muted: #5f6368;
    --tracker-line: #dadce0;
    --tracker-warn: #b26a00;
    --stage-color: #1a73e8;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--tracker-bg);
    color: var(--tracker-fg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
}

.tracker {
    max-width: 32rem;
    margin: 0 auto;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    min-height: 100vh;
}

.tracker-boot {
    color: var(--tracker-muted);
}

.tracker-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0 1rem;
    border-bottom: 1px solid var(--tracker-line);
    margin-bottom: 1rem;
}

.tracker-head h1 {
    font-size: 1.25rem;
    margin: 0;
}

.tracker-logo {
    width: 2.75rem;
    height: 2.75rem;
    object-fit: contain;
}

.tracker-hint {
    color: var(--tracker-muted);
    font-size: 0.95rem;
    margin: 0.75rem 0;
}

.tracker-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tracker-row {
    width: 100%;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--tracker-line);
    border-radius: 0.75rem;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.tracker-row:active {
    background: rgba(0, 0, 0, 0.04);
}

.tracker-row-name {
    font-size: 1.5rem;
    font-weight: 600;
}

.tracker-row-time {
    color: var(--tracker-muted);
    font-variant-numeric: tabular-nums;
}

.tracker-card,
.tracker-track {
    border: 1px solid var(--tracker-line);
    border-radius: 0.75rem;
    padding: 1.25rem;
}

.tracker-neutral h1 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem;
}

.tracker-identifier {
    margin: 0 0 1.25rem;
    font-size: clamp(2.5rem, 14vw, 4.5rem);
    line-height: 1;
    font-weight: 700;
    word-break: break-word;
}

.tracker-stages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.tracker-stages li {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.625rem 0;
    color: var(--tracker-muted);
    position: relative;
}

.tracker-stages li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 0.6875rem;
    top: 2.25rem;
    bottom: -0.375rem;
    width: 2px;
    background: var(--tracker-line);
}

.tracker-stage-mark {
    width: 1.5rem;
    height: 1.5rem;
    flex: 0 0 auto;
    border: 2px solid var(--tracker-line);
    border-radius: 50%;
    background: var(--tracker-bg);
    z-index: 1;
}

.tracker-stages li.is-done {
    color: inherit;
}

.tracker-stages li.is-done .tracker-stage-mark {
    border-color: currentColor;
    background: currentColor;
}

.tracker-stages li.is-here {
    font-weight: 700;
}

.tracker-stages li.is-here .tracker-stage-mark {
    border-color: var(--stage-color);
    background: var(--stage-color);
    box-shadow: 0 0 0 0.3rem color-mix(in srgb, var(--stage-color) 25%, transparent);
}

/* The stage change is the only thing on this page worth animating: a guest who looks up a second
   late should still see that something moved, rather than a screen that was always like this. */
.tracker-stages li,
.tracker-stage-mark {
    transition:
        color 200ms cubic-bezier(0.22, 1, 0.36, 1),
        background-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
        border-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tracker-track {
    transition:
        background-color 240ms cubic-bezier(0.22, 1, 0.36, 1),
        color 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tracker-stage-label {
    font-size: 1.125rem;
}

.tracker-track-ready .tracker-stage-mark {
    border-color: currentColor;
}

.tracker-shout {
    margin: 1.5rem 0 0;
    font-size: clamp(1.75rem, 9vw, 2.75rem);
    font-weight: 800;
    line-height: 1.1;
    animation: tracker-arrive 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Rises once, on arrival. Not a loop and not an attention-getter — the shout is already the biggest
   thing on the screen; this only marks the moment it appeared. */
@keyframes tracker-arrive {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.tracker-thanks,
.tracker-counter {
    margin: 1.25rem 0 0;
    font-size: 1.25rem;
}

.tracker-button {
    margin-top: 1.25rem;
    min-height: 3rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid currentColor;
    border-radius: 0.75rem;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.tracker-button-strong {
    width: 100%;
    min-height: 3.75rem;
    font-size: 1.15rem;
    font-weight: 600;
    border-width: 2px;
}

/* The four messages (BPU-107). A column rather than a wrapping row: on a phone held one-handed the
   four have to be hit reliably, and side-by-side they would end up as four narrow targets exactly
   where a thumb is least accurate. */
.tracker-arrivals {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.tracker-arrival {
    margin-top: 0;
    width: 100%;
    min-height: 3.25rem;
    font-size: 1.05rem;
    text-align: left;
}

/* The one that was tapped. Marked by weight and a thicker edge as well as colour, because the
   surface takes its colours from the location and "the coloured one" may not be distinguishable. */
.tracker-arrival.is-chosen {
    border-width: 2px;
    font-weight: 700;
}

.tracker-arrival.is-chosen::before {
    content: "✓ ";
}

.tracker-arrival-other {
    opacity: 0.85;
}

/* Typing, for the situation the four taps do not cover. Below them on purpose: the ordinary case
   should still be one thumb on one button. */
.tracker-compose {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--tracker-line);
    border-radius: 0.75rem;
}

.tracker-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.95rem;
}

.tracker-field input,
.tracker-field textarea {
    font: inherit;
    color: inherit;
    background: var(--tracker-bg);
    border: 1px solid var(--tracker-line);
    border-radius: 0.5rem;
    padding: 0.625rem 0.75rem;
    min-height: 3rem;
    width: 100%;
    resize: vertical;
}

.tracker-field input:focus-visible,
.tracker-field textarea:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 2px;
}

.tracker-compose-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.tracker-compose-actions .tracker-button {
    margin-top: 0;
}

.tracker-compose-actions .tracker-button-strong {
    width: auto;
    min-height: 3rem;
    flex: 1 1 8rem;
}

.tracker-on-the-way {
    margin: 1.25rem 0 0;
    font-size: 1.15rem;
    font-weight: 600;
}

/* A sentence about the shop, deliberately quiet. It sits below the stages because it is context for
   the wait, not a second answer competing with the stage the order is actually in. */
.tracker-eta {
    margin: 1.25rem 0 0;
    font-size: 1rem;
    opacity: 0.85;
}

.tracker-button-quiet {
    border-color: transparent;
    text-decoration: underline;
    padding-left: 0;
    opacity: 0.85;
}

.tracker-freshness {
    margin: 1.25rem 0 0;
    color: var(--tracker-muted);
    font-size: 0.85rem;
}

.tracker-freshness.is-stale {
    color: var(--tracker-fg);
}

/* ── Keine Verbindung ──────────────────────────────────────────────────────────────────────── */

.tracker-offline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0 0;
    color: var(--tracker-fg);
    font-size: 0.95rem;
}

.tracker-offline-mark {
    width: 0.5rem;
    height: 0.5rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--tracker-warn);
    animation: tracker-pulse 2s ease-in-out infinite;
}

@keyframes tracker-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* ── Zwei Ausgänge, nur einer wirft etwas weg ──────────────────────────────────────────────── */

.tracker-exits {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.tracker-confirm {
    margin: 0.75rem 0 0;
    font-size: 0.95rem;
}

.tracker-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

/* ── Skelett ───────────────────────────────────────────────────────────────────────────────── */

.tracker-skeleton-identifier {
    height: 3.5rem;
    width: 60%;
    border-radius: 0.5rem;
    background: var(--tracker-line);
    margin-bottom: 1.5rem;
}

.tracker-skeleton-stages,
.tracker-skeleton-rows {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.tracker-skeleton-stage {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.tracker-skeleton-mark {
    width: 1.5rem;
    height: 1.5rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--tracker-line);
}

.tracker-skeleton-line {
    height: 1rem;
    width: 45%;
    border-radius: 0.25rem;
    background: var(--tracker-line);
}

.tracker-skeleton-row {
    height: 3.5rem;
    border-radius: 0.75rem;
    background: var(--tracker-line);
}

.tracker-skeleton-identifier,
.tracker-skeleton-mark,
.tracker-skeleton-line,
.tracker-skeleton-row {
    animation: tracker-breathe 1.6s ease-in-out infinite;
}

@keyframes tracker-breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.tracker-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;
}

/* ── Fokus ─────────────────────────────────────────────────────────────────────────────────── */

/* Own ring rather than the browser's: this surface takes its colours from the location's settings,
   so the default outline cannot be relied on to be visible against them. */
.tracker-row:focus-visible,
.tracker-button:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
    border-radius: 0.75rem;
}

@media (hover: hover) {
    .tracker-row:hover {
        border-color: currentColor;
    }
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1rem;
    background: #ffe082;
    color: #1a1a1a;
}

@media (prefers-color-scheme: dark) {
    :root {
        --tracker-bg: #121212;
        --tracker-fg: #f1f1f1;
        --tracker-muted: #9aa0a6;
        --tracker-line: #3c4043;
        --tracker-warn: #ffb74d;
    }

    .tracker-row:active {
        background: rgba(255, 255, 255, 0.06);
    }
}

/* Not optional. Everything above conveys state through colour and position as well as movement, so
   removing the movement removes nothing but the movement. */
@media (prefers-reduced-motion: reduce) {
    .tracker-stages li,
    .tracker-stage-mark,
    .tracker-track {
        transition: none;
    }

    .tracker-shout,
    .tracker-offline-mark,
    .tracker-skeleton-identifier,
    .tracker-skeleton-mark,
    .tracker-skeleton-line,
    .tracker-skeleton-row {
        animation: none;
    }
}
