/* ============================================================
   Myzone Vergleich — modern, funktional
   ============================================================ */
:root {
    --me: #f43f5e;
    --friend: #3b82f6;
    --gold: #eab308;
    --bg: #0e1013;
    --panel: #16191f;
    --panel-2: #1b1f27;
    --border: rgba(255, 255, 255, 0.075);
    --text: #eceef2;
    --muted: #8a919e;
    --radius: 16px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    color: var(--text);
    font-family: var(--font);
    font-feature-settings: "cv11", "ss01";
    line-height: 1.5;
    background:
        radial-gradient(1000px 500px at 20% -10%, rgba(244, 63, 94, 0.05), transparent 60%),
        radial-gradient(1000px 500px at 80% -10%, rgba(59, 130, 246, 0.05), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
::selection { background: rgba(244, 63, 94, 0.35); }

/* ---------- Header ---------- */
.site-header {
    background: rgba(14, 16, 19, 0.8);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f43f5e, #be123c);
    color: #fff;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-text small { color: var(--muted); font-size: 0.75rem; }
.logout-link { color: var(--muted); text-decoration: none; font-size: 0.86rem; font-weight: 500; }
.logout-link:hover { color: var(--me); }

main.wrap { padding-top: 28px; padding-bottom: 56px; }

/* ---------- Monatsnavigation (Pill) ---------- */
.month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: max-content;
    margin: 0 auto 26px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px;
}
.month-title {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
    min-width: 190px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.mnav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--muted);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}
.mnav-btn svg { width: 18px; height: 18px; }
.mnav-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.mnav-btn.disabled { opacity: 0.25; pointer-events: none; }

.notice {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    border-radius: 12px;
    padding: 11px 16px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 0.9rem;
}

/* ---------- Kopf-an-Kopf Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 30px;
    margin-bottom: 22px;
}
.hero-person { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero-person:last-child { align-items: flex-end; text-align: right; }
.hero-id { display: flex; align-items: center; gap: 9px; }
.hero-person:last-child .hero-id { flex-direction: row-reverse; }
.hero-name { font-weight: 600; font-size: 0.98rem; }
.pdot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pdot.me { background: var(--me); }
.pdot.friend { background: var(--friend); }
.lead-chip {
    background: rgba(234, 179, 8, 0.12);
    color: var(--gold);
    border: 1px solid rgba(234, 179, 8, 0.3);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
}
.hero-score {
    font-size: clamp(2.4rem, 6vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.hero-score small {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.02em;
    margin-left: 8px;
}
.hero-score.me { color: var(--me); }
.hero-score.friend { color: var(--friend); }
.hero-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 6px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.delta { font-size: 1.35rem; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.delta-label {
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
}
.goal { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 300px; }
.goal-track {
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}
.goal-fill { height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.goal-fill.me { background: var(--me); }
.goal-fill.friend { background: var(--friend); }
.goal-label { font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Statistik-Karten ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.card {
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 17px 15px;
}
.card-label {
    margin: 0 0 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.01em;
}
.card-rows { display: flex; flex-direction: column; gap: 7px; }
.card-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.card-name {
    color: var(--muted);
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-value {
    margin-left: auto;
    font-weight: 600;
    font-size: 0.97rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.card-value.is-winner { font-weight: 800; }
.card-value.is-winner::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    margin-left: 7px;
    vertical-align: 2px;
}
.ratio {
    display: flex;
    height: 4px;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 13px;
    background: rgba(255, 255, 255, 0.06);
}
.ratio-me { background: var(--me); }
.ratio-friend { background: var(--friend); }

/* ---------- Diagramme ---------- */
.charts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 22px; }
.panel {
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.panel h2 { margin: 0 0 16px; font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; }
.panel h2 span { color: var(--muted); font-weight: 500; font-size: 0.82rem; }
.chart-box { position: relative; height: 270px; }
.zone-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 14px;
    justify-content: center;
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--muted);
}
.zone-legend span { display: inline-flex; align-items: center; gap: 6px; }
.zone-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ---------- Trainingseinheiten ---------- */
.panel-list {
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.workouts h2 { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; }
.count {
    background: rgba(255, 255, 255, 0.07);
    color: var(--muted);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 9px;
    font-variant-numeric: tabular-nums;
}
.workout-list { display: flex; flex-direction: column; }
.workout {
    display: flex;
    gap: 14px;
    padding: 15px 2px;
    border-bottom: 1px solid var(--border);
}
.workout:last-child { border-bottom: none; }
.workout-date {
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.15;
}
.workout-date.me { background: rgba(244, 63, 94, 0.1); }
.workout-date.friend { background: rgba(59, 130, 246, 0.1); }
.workout-date strong { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.workout-date span { font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.workout-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.workout-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.workout-activity { font-weight: 600; font-size: 0.92rem; }
.person {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}
.person.me { background: rgba(244, 63, 94, 0.12); color: #fb8ba0; }
.person.friend { background: rgba(59, 130, 246, 0.12); color: #93bbfc; }
.workout-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    color: var(--muted);
    font-size: 0.83rem;
    font-variant-numeric: tabular-nums;
}
.workout-stats .meps { color: var(--text); font-weight: 700; }
.zone-strip {
    display: flex;
    width: 100%;
    max-width: 320px;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    margin-top: 3px;
}
.zone-strip span { display: block; height: 100%; }
.empty { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.76rem; margin: 12px 0 0; opacity: 0.75; }

/* ---------- Login / Fehler ---------- */
.login-wrap { display: flex; justify-content: center; padding: 56px 0; }
.login-card {
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.login-card h1 { margin: 0; font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 8px; color: var(--muted); font-size: 0.92rem; }
.login-card a { color: var(--friend); }
.login-card label { font-size: 0.84rem; font-weight: 600; }
.login-card input {
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: var(--font);
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}
.login-card input:focus { outline: 2px solid var(--me); outline-offset: 1px; border-color: transparent; }
.login-card button {
    margin-top: 6px;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #f43f5e, #be123c);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
}
.login-card button:hover { filter: brightness(1.08); }
.login-error {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #fda4af;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.88rem;
}

/* ---------- Lade-Zustand ---------- */
.loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 70px 20px;
    max-width: 480px;
    margin: 0 auto;
}
.spinner {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--me);
    animation: spin 0.9s linear infinite;
    margin-bottom: 22px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap h1 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 10px; }
.loading-wrap p { color: var(--muted); font-size: 0.92rem; margin: 0; }
.loading-slow { margin-top: 14px !important; }
.loading-slow a { color: var(--friend); }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.78rem;
    padding: 20px 0 34px;
    text-align: center;
    opacity: 0.85;
}

/* ---------- Mobil ---------- */
@media (max-width: 760px) {
    .charts { grid-template-columns: 1fr; }
    .month-title { min-width: 150px; font-size: 0.95rem; }
    .hero { grid-template-columns: 1fr; gap: 22px; padding: 24px 22px; }
    .hero-divider {
        flex-direction: row;
        gap: 8px;
        padding: 12px 0 0;
        border: none;
        border-top: 1px solid var(--border);
        order: 3;
    }
    .hero-person:last-child { align-items: flex-start; text-align: left; }
    .hero-person:last-child .hero-id { flex-direction: row; }
    .goal { max-width: none; }
    .cards { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
    .card { padding: 13px 14px 13px; }
    .card-value { font-size: 0.9rem; }
    .chart-box { height: 240px; }
}

@media (max-width: 420px) {
    .cards { grid-template-columns: 1fr 1fr; }
    .hero-score { font-size: 2.3rem; }
}
