/* Spielerle – Prototyp-Styling (Etappe 6). Funktional, nicht designt. */

:root {
    --bg: #f4f4f5;
    --panel: #ffffff;
    --border: #d4d4d8;
    --ink: #1f2937;
    --muted: #6b7280;
    --accent: #1d4ed8;

    /* Semantische Feedback-Farben */
    --ok-ink: #15803d;
    --ok-bg: #dcfce7;
    --ok-border: #86efac;
    --warn-ink: #b45309;
    --warn-bg: #fef3c7;
    --warn-border: #fcd34d;
    --flat-bg: #f1f5f9;
    --flat-border: #e2e8f0;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    overflow-wrap: break-word;
}

.wrap {
    max-width: 46rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

h1 {
    font-size: 1.5rem;
    margin: 0;
}

.puzzle {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 400;
}

.controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

select,
input[type="text"],
button {
    font: inherit;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--panel);
    color: inherit;
}

button {
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status {
    font-weight: 600;
    margin: 1rem 0 0.25rem;
}

.error {
    margin: 0.25rem 0;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.panel {
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.panel h2 {
    font-size: 1rem;
    margin: 0 0 0.75rem;
}

.muted {
    color: var(--muted);
    font-weight: 400;
    font-size: 0.9rem;
}

/* Stationen – Karriere-Timeline */

.stints {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.stint {
    position: relative;
    padding: 0.75rem 0.875rem 0.75rem 3rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Verbindungslinie zwischen den Timeline-Knoten */
.stint:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 1.55rem;
    top: 1.55rem;
    width: 2px;
    margin-left: -1px;
    height: calc(100% + 0.75rem);
    background: var(--border);
}

.stint-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 0.5rem;
}

.stint-order {
    position: absolute;
    left: 0.75rem;
    top: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--club-color, #888);
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 3px var(--panel);
    z-index: 1;
}

.stint-club {
    font-weight: 700;
    font-size: 1rem;
}

.stint-years {
    color: var(--muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.badge {
    align-self: center;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    background: var(--warn-bg);
    color: var(--warn-ink);
    border: 1px solid var(--warn-border);
}

.stint-titles {
    margin: 0.5rem 0 0;
    padding: 0.5rem 0 0;
    border-top: 1px dashed var(--border);
    list-style: none;
    font-size: 0.85rem;
    color: var(--muted);
    display: grid;
    gap: 0.15rem;
}

/* Autocomplete */

.combo {
    position: relative;
}

.combo input[type="text"] {
    width: 100%;
}

.suggestions {
    position: absolute;
    z-index: 10;
    left: 0;
    right: 0;
    margin: 0.15rem 0 0;
    padding: 0;
    list-style: none;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    max-height: 14rem;
    overflow-y: auto;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.suggestion {
    padding: 0.6rem;
    cursor: pointer;
}

.suggestion.active,
.suggestion:hover {
    background: #eef2ff;
}

#guessButton {
    margin-top: 0.6rem;
}

/* Verlauf */

.history {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.guess-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.35rem 0.6rem;
    padding: 0.6rem 0.7rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.guess-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.guess-name {
    font-weight: 700;
}

.chips {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.chip {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--flat-bg);
    color: var(--muted);
    border: 1px solid var(--flat-border);
    white-space: nowrap;
}

.chip--ok {
    background: var(--ok-bg);
    color: var(--ok-ink);
    border-color: var(--ok-border);
}

.chip--warn {
    background: var(--warn-bg);
    color: var(--warn-ink);
    border-color: var(--warn-border);
}

.chip--no {
    background: var(--flat-bg);
    color: var(--muted);
    border-color: var(--flat-border);
}

/* Ergebnis */

.result .share {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 0.5rem 0;
}

.result button {
    width: 100%;
}

/* Mobile */

@media (max-width: 40rem) {
    .wrap {
        padding: 1rem 0.875rem 3rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    .topbar {
        gap: 0.5rem;
    }

    .controls {
        width: 100%;
        gap: 0.5rem;
    }

    .controls label {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
        flex: 1 1 0;
        font-size: 0.85rem;
        color: var(--muted);
    }

    .controls #mode {
        width: 100%;
    }

    .controls #newRound {
        flex: 1 1 0;
        align-self: end;
    }

    .panel {
        margin-top: 1rem;
        padding: 0.875rem;
    }

    .stint {
        padding-left: 2.75rem;
    }

    #guessButton {
        width: 100%;
    }
}
