/* ==========================================================================
   Card Styles
   Die Flaeche, Stat cards, card badges (yellow/red), gradient headers
   ========================================================================== */

/* ==========================================================================
   Die Flaeche einer Karte
   Sechs gibt es, mehr nicht: die neutrale, die invertierte und die vier
   Rollen, die eine Aussage tragen. `primary` und `secondary` sind keine
   Karte — die eine sagt "ausgewaehlt", die andere "zurueckgenommen", und
   keines von beidem ist ein Grund fuer eine eigene Flaeche (#706).

   Jede traegt denselben Zweiton wie die Subtle-Flaechen in base.css, nur aus
   ihren eigenen zwei Tokens gemischt. Bis #736 brachen die beiden Toene hart
   bei 50 % — eine Diagonale quer ueber jede Karte, die als Faltung gedacht
   war und auf einer grossen Flaeche wie ein Fehler aussah. Sie laufen jetzt
   von Ecke zu Ecke weich ineinander: der Unterschied bleibt, die Kante geht.
   Den zweiten Ton mischt die Karte sich selbst, ausser der Modus reicht ihr
   einen fertigen herein (--app-card-lift): auf dunklem Grund tut er das,
   weil die Karte dort auf demselben Bogen steht wie der Kopf einer Tabelle.

   Weil die Flaeche die Karte traegt, muss der Rahmen das nicht mehr — leise
   bleibt er darum in allen sechs, aber eine farbige Karte zieht ihn in ihre
   eigene Farbe: das Hellgrau an einer roten Karte war der eine Strich, der
   nicht mitsprach. Auf dunklem Grund geht er nach oben statt nach unten,
   weil unter dem Grund der App kein Schritt mehr frei ist (base.css).
   Die erste `background`-Zeile ist der Rueckfall fuer WebViews ohne
   color-mix.
   ========================================================================== */

.card {
    /* Gemischt wird mit dem Akzent, nicht mit der Tinte: die Tinte ist fast
       unbunt, und 6 % davon auf Weiss ergaben ein Grau, das neben dem Petrol
       der App wie ein Fremdkoerper stand (#730). */
    --app-card-tone: var(--app-card-lift, color-mix(in srgb, var(--app-card-bg) 94%, var(--app-accent)));
    --bs-card-bg: var(--app-card-bg);
    --bs-card-border-color: var(--app-card-border);

    background: var(--app-card-bg);
    background: linear-gradient(136deg,
        var(--app-card-bg) 0%,
        var(--app-card-tone) 100%);
}

/* Die vier Rollen. Der zweite Ton sind dieselben 86 %, die eine
   `.bg-<rolle>-subtle` ausserhalb einer Karte auch traegt, und der Rahmen
   ist die `-border-subtle`-Kante, die zu genau dieser Flaeche gehoert: sie
   steht zu ihr im selben kleinen Schritt wie das Hellgrau zur weissen Karte
   (1,2 bis 1,4), ist also genauso leise — nur eben in der Farbe der Rolle. */
.card--info {
    --app-card-bg: var(--bs-info-bg-subtle);
    --app-card-tone: color-mix(in srgb, var(--bs-info-bg-subtle) 86%, var(--bs-info));
    --app-card-border: var(--bs-info-border-subtle);
}

.card--success {
    --app-card-bg: var(--bs-success-bg-subtle);
    --app-card-tone: color-mix(in srgb, var(--bs-success-bg-subtle) 86%, var(--bs-success));
    --app-card-border: var(--bs-success-border-subtle);
}

.card--warning {
    --app-card-bg: var(--bs-warning-bg-subtle);
    --app-card-tone: color-mix(in srgb, var(--bs-warning-bg-subtle) 86%, var(--bs-warning));
    --app-card-border: var(--bs-warning-border-subtle);
}

.card--danger {
    --app-card-bg: var(--bs-danger-bg-subtle);
    --app-card-tone: color-mix(in srgb, var(--bs-danger-bg-subtle) 86%, var(--bs-danger));
    --app-card-border: var(--bs-danger-border-subtle);
}

/* Auf dunklem Grund waren die vier Rollen eigene Farbflaechen — Senf,
   Moosgruen, Tuerkis — und die Warnkarte biss sich mit dem Petrol der Seite
   und mit dem Akzent-Knopf darin (16.11.2026). Dort steht jede jetzt auf dem
   Bogen der neutralen Karte und nimmt ihre Rolle nur als Hauch an: genug,
   um sie zu erkennen, zu wenig, um gegen den Grund zu stehen. */
[data-bs-theme=dark] :is(.card--info, .card--success, .card--warning, .card--danger) {
    --app-card-bg: color-mix(in srgb, var(--app-dark-sheet) 88%, var(--app-card-role));
    --app-card-tone: color-mix(in srgb, var(--app-dark-sheet-lift) 74%, var(--app-card-role));
    --app-card-border: color-mix(in srgb, var(--app-dark-sheet) 70%, var(--app-card-role));
}

[data-bs-theme=dark] .card--info {
    --app-card-role: var(--bs-info);
}

[data-bs-theme=dark] .card--success {
    --app-card-role: var(--bs-success);
}

[data-bs-theme=dark] .card--warning {
    --app-card-role: var(--bs-warning);
}

[data-bs-theme=dark] .card--danger {
    --app-card-role: var(--bs-danger);
}


/* Player Modal Stat Cards

   The markup carries `data-bs-theme="inverted"`, and that hands down variables
   only — it sets the ink and paints nothing (see base.css). The card has to
   paint its own surface, which these two lines do: on the inverted theme they
   resolve to the dark object in both colour modes.

   Without the background the near-white ink stood on the modal's white
   surface and the numbers were all but unreadable. The ink was a fixed
   `--app-white-rgb` on top of that, which is the kind of hard-coded colour the
   dark-mode rule forbids; `--bs-body-color` is what the theme already sets.
   Found while adding the oversea-club card (#723). */
.stat-card {
    border-radius: 12px;
    width: 108px;
    height: 108px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

@media (max-width: 443px) {
    .stat-card {
        width: 90px;
        height: 90px;
    }
}

.stat-card-label {
    font-size: 14px;
    text-transform: uppercase;
    opacity: 0.7;
}

.stat-card-value {
    font-size: 28px;
    font-weight: bold;
}

/* Freshness is the one stat card that colours its value from a threshold
   rather than a tier (the level card uses `.level-tier--*`). The values used
   to be written inline from JS, which is how the green slipped past
   `successGreen.test.js` and kept Bootstrap 4's older, duller tone — out here
   it takes the theme's green like everything else (#706). */
.stat-card-value--fresh-good {
    color: var(--bs-success);
}

.stat-card-value--fresh-ok {
    color: var(--bs-warning);
}

.stat-card-value--fresh-low {
    color: var(--bs-danger);
}

/* ==========================================================================
   Card Badges (Yellow/Red Cards)
   ========================================================================== */

.card-badge {
    display: inline-block;
    width: 14px;
    height: 20px;
    border-radius: 2px;
    margin-right: 2px;
    vertical-align: middle;
}

/* Nicht die Warnrolle: eine gelbe Karte ist gelb (#706). */
.card-badge--yellow {
    background: var(--app-card-yellow);
    position: relative;
}

.card-badge--red {
    background: var(--bs-danger);
}

.card-badge__count {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: bold;
    color: rgb(var(--app-black-rgb));
}

/* ==========================================================================
   Collapsible Cards
   Card whose header folds the body away (game details overlay)
   ========================================================================== */

.collapsible-card-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    border-width: 0 0 1px;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.collapsible-card-chevron {
    flex: 0 0 auto;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.collapsible-card.is-collapsed .collapsible-card-chevron {
    transform: rotate(-90deg);
}

.collapsible-card.is-collapsed > .collapsible-card-toggle {
    border-bottom-width: 0;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.collapsible-card.is-collapsed > .collapsible-card-content {
    display: none;
}

/* ==========================================================================
   Onboarding quest strip (#594)
   Seit #707 ist sie nur noch der Anreisser auf dem Dashboard: Trikot, Gruss,
   „Los geht's". Die Fuehrung Schritt fuer Schritt macht der Streifen am
   unteren Bildschirmrand (components/onboarding-overlay.css), und zwei
   Leisten uebereinander sagten dieselbe Sache zweimal.

   Seit #706 ist der Streifen eine invertierte Karte, und was darin Farbe
   traegt, traegt sie aus seiner Rolle: der Aufruf ist ein `btn-info`, die
   Belohnung eine `bg-warning`-Plakette, die Laufschritte sind Buttons in
   Erfolg, Akzent und Neutral. Hier bleibt nur noch das Raster.
   ========================================================================== */

.quest-strip {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "shirt main side";
    align-items: center;
    gap: 0.85rem 1rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
}

/* ── The shirt: the signature element ──────────────────────────────────── */

.quest-strip__shirt {
    grid-area: shirt;
    position: relative;
    display: grid;
    place-items: center;
    width: 3.1rem;
    height: 3.1rem;
    border-radius: 0.75rem 0.75rem 1.4rem 1.4rem;
    background: linear-gradient(180deg,
        var(--bs-info),
        color-mix(in srgb, var(--bs-info) 55%, var(--app-card-bg)));
    box-shadow: 0 0.35rem 0.9rem rgba(var(--bs-info-rgb), 0.35);
    overflow: hidden;
}

/* The collar notch, so the block reads as a jersey rather than a rounded box.
   It is the card's own ground punched back out of the shirt. */
.quest-strip__shirt::before {
    content: "";
    position: absolute;
    top: -0.55rem;
    width: 1.5rem;
    height: 1.1rem;
    border-radius: 0 0 1rem 1rem;
    background: var(--app-card-bg);
}

/* Floodlight catching the shirt — the one animated moment, once on render. */
.quest-strip__shirt::after {
    content: "";
    position: absolute;
    inset: -50%;
    background: linear-gradient(105deg, transparent 42%, rgba(var(--app-white-rgb), 0.55) 50%, transparent 58%);
    transform: translateX(-120%);
    animation: quest-floodlight 1.1s ease-out 0.25s 1;
}

@keyframes quest-floodlight {
    to {
        transform: translateX(120%);
    }
}

/* Das Trikot traegt den Doktorhut: die Karte ist der Einstieg ins Tutorial,
   keine Nummer in einer Reihe (#707). */
.quest-strip__shirt-icon {
    position: relative;
    font-size: 1.4rem;
    color: var(--app-ink-on-accent);
}

/* ── The called-out task ───────────────────────────────────────────────── */

.quest-strip__main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.quest-strip__eyebrow {
    font-size: 0.7rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--bs-info-text-emphasis);
}

/* Eine Ueberschrift seit #706 — ihre Zeile steht hier, nicht ihre Farbe. */
.quest-strip__task {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.25;
}

/* The dashboard teaser's second line — a plain caption under the headline,
   not shouty like the eyebrow above a real quest. */
.quest-strip__subtitle {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

/* ── Call to action ────────────────────────────────────────────────────── */

.quest-strip__side {
    grid-area: side;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
}

.quest-strip__go {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

/* ── Narrow screens: the call to action gets its own full-width row ─────── */

@media (max-width: 575.98px) {
    .quest-strip {
        grid-template-areas:
            "shirt main"
            "side  side";
        grid-template-columns: auto 1fr;
        /* Whatever follows on a page is usually a `.nav-pills` tab strip, which
           on narrow screens is pulled up by `margin: -2rem` so it can scroll
           edge to edge (see buttons.css). That pull swallowed this card's whole
           bottom margin and left the tabs sitting flush against it, while
           desktop looked right (#594 follow-up). Carry the pull here rather
           than weakening the tab strip, which every page depends on. */
        margin: 0 -2rem;
        border-radius: 0;
    }

    .quest-strip__side {
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        width: 100%;
    }
}

/* Mobile web: `#page` pads its content by 2rem, and up to 768px the tab strip
   below cancels that with `margin-top: -2rem` (buttons.css). The card has to
   do the same at its top, or it hangs 2rem under the info bar, and hand the
   2rem back at its bottom, or the tabs slide over it. The native app hosts the
   card outside `#page` and needs none of this. */
@media screen and (max-width: 768px) {
    .game-layout .quest-strip {
        margin: -2rem -2rem 2rem;
        border-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .quest-strip__shirt::after {
        animation: none;
        opacity: 0;
    }
}

/* ==========================================================================
   Onboarding step dialog (#594 follow-up)
   What the quest strip's button opens when there is nowhere to navigate to:
   the sub-steps at a size worth reading, each with the sentence that says how
   to get it. Lives here next to the strip it belongs to.
   ========================================================================== */

.onboarding-steps__intro {
    margin-bottom: 1rem;
    color: var(--bs-secondary-color);
}

.onboarding-steps__list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.onboarding-steps__item {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.onboarding-steps__icon {
    flex: 0 0 auto;
    margin-top: 0.2rem;
    font-size: 1.15rem;
    color: var(--bs-secondary-color);
}

.onboarding-steps__item--done .onboarding-steps__icon {
    color: var(--bs-info);
}

.onboarding-steps__text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.onboarding-steps__label {
    font-family: var(--app-font-display);
    font-size: 1.05rem;
    line-height: 1.25;
}

/* Done is context, not the thing to read: the open steps are what the manager
   opened this dialog for, so the finished ones step back rather than lighting
   up brighter than them. */
.onboarding-steps__item--done .onboarding-steps__label {
    text-decoration: line-through;
    opacity: 0.6;
}

.onboarding-steps__help {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--bs-secondary-color);
}

.onboarding-steps__item--done .onboarding-steps__help {
    opacity: 0.6;
}

/* Eine Warnmeldung seit #706 — Flaeche, Tinte und Rahmen bringt die Rolle
   mit, hier steht nur die Zeile. */
.onboarding-steps__reward {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 1.2rem 0 1rem;
}

.onboarding-steps__reward-caption {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.3px;
    opacity: 0.85;
}
