/* ===========================================================================
   App-Layout mechs.1337.hamburg — alles, was NICHT ins portable Design-System
   gehört: Kopfzeile, Sprungleiste, Regel-Abschnitte, Fraktionskarten,
   Bemalschritte, Druck. Braucht tokens/components/schraeg.css.
   =========================================================================== */

/* --- Kopfzeile ------------------------------------------------------------ */
.site-head { padding: 0.9rem 0; }
.site-head .wrap {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.8rem;
}
.kopf-knoepfe { display: flex; gap: 0.5rem; flex: none; }
.btn-icon { min-width: 44px; padding: 0.5rem 0.6rem; }
#tisch-btn[hidden] { display: none; }
#tisch-btn[aria-pressed="true"] {
    background: var(--accent-tint);
    border-color: var(--accent);
    color: var(--accent-deep);
}
@media (max-width: 480px) {
    .brand { font-size: 1.02rem; gap: 0.45rem; }
    .brand img { width: 28px; height: 28px; }
}
/* Mit zwei Kopfknöpfen wird es auf 375 px eng: Marke und Knöpfe rücken
   zusammen, damit der Cursor der Wortmarke nicht in die zweite Zeile fällt. */
@media (max-width: 420px) {
    .brand { font-size: 0.95rem; gap: 0.4rem; }
    .site-head .wrap { gap: 0.5rem; }
    .kopf-knoepfe { gap: 0.35rem; }
    .btn-icon { padding: 0.5rem 0.45rem; }
}

/* --- Start-Kacheln -------------------------------------------------------- */
.kachel {
    display: block; padding: 1.1rem 1.2rem;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink); text-decoration: none;
}
.kachel:hover { border-color: var(--accent); text-decoration: none; }
.kachel strong { font-family: var(--mono); display: block; margin-bottom: 0.2rem; }
.kachel span { color: var(--muted); font-size: 0.88rem; }

/* --- Unterreiter (Regeln | Werkzeuge) ------------------------------------- */
.tab-zeile { display: flex; gap: 0.5rem; margin-top: 1.1rem; }
.tab-zeile a {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0.4rem 1rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface);
    font-family: var(--mono); font-size: 0.85rem; font-weight: 600;
    color: var(--muted); text-decoration: none;
}
.tab-zeile a:hover { color: var(--ink); text-decoration: none; }
.tab-zeile a[aria-current="page"] {
    border-color: var(--accent);
    background: var(--accent-tint);
    color: var(--accent-deep);
}

/* --- Sprungleiste (Regelseiten) ------------------------------------------- */
.sprungleiste {
    position: sticky; top: 0; z-index: 40;
    display: flex; gap: 0.45rem;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 0.55rem 1.2rem;
    margin: 0 -1.2rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
}
.sprungleiste::-webkit-scrollbar { display: none; }
.sprungleiste a {
    flex: none;
    display: inline-flex; align-items: center;
    min-height: 40px; padding: 0.3rem 0.7rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--muted); text-decoration: none;
}
.sprungleiste a:hover { color: var(--ink); border-color: var(--muted); text-decoration: none; }

/* --- Regel-Abschnitte: aufklappbare Karten -------------------------------- */
details.card { padding: 0; }
details.card summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: baseline; gap: 0.6rem;
    padding: 1rem 1.2rem; min-height: 44px;
    font-family: var(--mono); font-weight: 700; font-size: 1rem;
}
details.card summary::-webkit-details-marker { display: none; }
details.card summary::before {
    content: "+"; color: var(--accent-deep); width: 1em; flex: none;
}
details.card[open] summary::before { content: "\2212"; }
details.card summary .thema-tag {
    margin-left: auto; flex: none;
    font-size: 0.66rem; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.08em;
}
details.card > .inhalt { padding: 0 1.2rem 1.2rem; }
details.card h3 { font-size: 0.95rem; margin: 1.1rem 0 0.4rem; }
details.card h3:first-child { margin-top: 0; }

/* --- Phasen-Schiene (Rundenablauf) ---------------------------------------- */
.phasen { list-style: none; margin: 0; padding: 0; }
.phasen li { position: relative; padding: 0 0 1.1rem 3.2rem; }
.phasen li::before {
    content: ""; position: absolute; left: 1.1rem; top: 2.5rem; bottom: 0.2rem;
    width: 1px; background: var(--line);
}
.phasen li:last-child { padding-bottom: 0; }
.phasen li:last-child::before { display: none; }
.phasen .no {
    position: absolute; left: 0; top: 0;
    width: 2.2rem; height: 2.2rem;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--mono); font-weight: 700;
    background: var(--surface); border: 1px solid var(--accent);
    color: var(--accent-deep); border-radius: 2px;
}
.phasen .ph { font-family: var(--mono); font-weight: 700; }
.phasen .ph em { font-style: normal; color: var(--muted); font-weight: 400; }
.phasen p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.92rem; }

/* --- Merkwort-Formel (GATOR / SATOR) -------------------------------------- */
.formel { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: stretch; margin: 0.8rem 0; }
.formel .term {
    flex: 1 1 100px; min-width: 96px;
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 0.5rem 0.6rem; background: var(--paper);
}
.formel .k {
    font-family: var(--mono); font-weight: 700; font-size: 1.4rem;
    color: var(--accent-deep); display: block; line-height: 1;
}
.formel .v {
    font-family: var(--mono); font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    display: block; margin-top: 0.3rem;
}
.formel .d { font-size: 0.78rem; color: var(--muted); display: block; margin-top: 0.15rem; line-height: 1.35; }
.formel .op { align-self: center; font-family: var(--mono); color: var(--muted); }
.formel-hinweis {
    font-family: var(--mono); font-size: 0.8rem; color: var(--muted);
    border-left: 3px solid var(--accent); padding-left: 0.7rem; margin: 0.8rem 0;
}

/* --- Hitze-Karten: Warnstreifen als Oberkante ----------------------------- */
.hazard-kante {
    height: 8px; margin: -1.4rem -1.4rem 1rem;
    border: 0; border-bottom: 1px solid var(--accent); border-radius: 0;
}
details.card .hazard-kante { margin: 0 0 1rem; }

/* --- Callout -------------------------------------------------------------- */
.callout {
    border-left: 4px solid var(--accent); background: var(--surface);
    padding: 0.9rem 1.1rem; margin: 1.2rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.callout strong { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.85rem; }
.callout ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.callout li { margin-bottom: 0.25rem; }

/* --- Unit-Card-Legende ---------------------------------------------------- */
.legende {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; background: var(--surface);
}
.legende > div { padding: 0.7rem 0.8rem; border: 0 solid var(--line); border-right-width: 1px; border-bottom-width: 1px; }
.legende b { font-family: var(--mono); color: var(--accent-deep); display: block; }
.legende span { font-size: 0.85rem; color: var(--muted); display: block; margin-top: 0.1rem; line-height: 1.4; }

/* --- Kompakte Listen in Karten -------------------------------------------- */
ul.eng { margin: 0.4rem 0 0; padding-left: 1.1rem; }
ul.eng li { margin-bottom: 0.3rem; }
td.zahl { text-align: right; white-space: nowrap; font-family: var(--mono); font-weight: 600; padding-right: 0; }

/* --- Filter / Suche ------------------------------------------------------- */
.filterzeile { margin: 1rem 0 1.4rem; }
.filterzeile input[type="search"] { font-size: 1rem; }
.kein-treffer { color: var(--muted); font-family: var(--mono); font-size: 0.9rem; }

/* --- Fraktionsbrowser ----------------------------------------------------- */
.f-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1rem; }
.f-karte { margin-bottom: 0; }
.f-kopf { display: flex; justify-content: space-between; gap: 0.8rem; align-items: flex-start; }
.f-code {
    font-family: var(--mono); font-size: 0.7rem; font-weight: 700;
    background: var(--ink); color: var(--paper);
    padding: 0.12rem 0.45rem; border-radius: 2px;
    display: inline-block; margin-bottom: 0.35rem;
    letter-spacing: 0.06em;
}
.f-kopf h3 { margin: 0; font-size: 1.05rem; line-height: 1.25; }
.f-haus { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.85rem; font-style: italic; }
.f-farben { display: flex; gap: 0.35rem; flex: none; }
.f-farbe { width: 26px; height: 26px; border-radius: 2px; border: 1px solid var(--line); }
.f-legende { list-style: none; margin: 0.9rem 0; padding: 0.55rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.f-legende li { display: flex; align-items: center; gap: 0.5rem; padding: 0.18rem 0; font-size: 0.85rem; }
.f-legende .f-farbe { width: 14px; height: 14px; }
.f-legende .rolle {
    font-family: var(--mono); font-size: 0.66rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted); width: 3.6rem; flex: none;
}
.f-legende .hex { margin-left: auto; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); letter-spacing: 0.03em; }
.f-karte .f-text { margin: 0 0 0.6rem; font-size: 0.92rem; }
.f-karte details { border-top: 1px solid var(--line); margin-top: 0.8rem; padding-top: 0.6rem; }
.f-karte details summary {
    list-style: none; cursor: pointer; min-height: 44px;
    display: flex; align-items: center; gap: 0.5rem;
    font-family: var(--mono); font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent-deep);
}
.f-karte details summary::-webkit-details-marker { display: none; }
.f-karte details summary::before { content: "+"; }
.f-karte details[open] summary::before { content: "\2212"; }
.f-meta { margin: 0.5rem 0 0; font-size: 0.85rem; }
.f-meta .tag-zeile {
    display: block; font-family: var(--mono); font-size: 0.66rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-deep);
    margin-bottom: 0.15rem;
}
.f-warn { margin: 0.7rem 0 0; font-size: 0.85rem; border-left: 3px solid var(--accent); padding-left: 0.7rem; color: var(--muted); }
.f-kurz { background: var(--paper); }
.f-kurz .f-text { color: var(--muted); }

/* --- Bemalanleitung ------------------------------------------------------- */
.schritte { list-style: none; margin: 0; padding: 0; }
.schritte li { display: flex; gap: 1rem; padding: 1.1rem 0; border-top: 1px solid var(--line); }
.schritte li:first-child { border-top: 0; }
.schritte .nr {
    font-family: var(--mono); font-weight: 700; font-size: 1.5rem;
    color: var(--accent-deep); width: 2.6rem; flex: none; line-height: 1.2;
}
.schritte h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.schritte p { margin: 0 0 0.5rem; font-size: 0.93rem; }
.schritte .tip { border-left: 3px solid var(--line); padding-left: 0.7rem; color: var(--muted); font-size: 0.86rem; margin: 0.5rem 0 0; }
.schritte .haken { flex: none; align-self: flex-start; margin-top: 0.3rem; }
.schritte .haken input { width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; }
.schritte li.erledigt h3, .schritte li.erledigt p { color: var(--muted); }
.schritte li.erledigt .nr { color: var(--muted); text-decoration: line-through; }

/* --- „Nach oben" ---------------------------------------------------------- */
.nach-oben {
    position: fixed; right: 0.9rem;
    bottom: calc(72px + env(safe-area-inset-bottom));
    z-index: 45;
    width: 44px; height: 44px;
    display: none; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink); font-family: var(--mono); font-size: 1.1rem;
    cursor: pointer;
}
.nach-oben.sichtbar { display: flex; }

/* --- Update-Hinweis (neue Service-Worker-Version) ------------------------- */
.update-hinweis {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 60;
    display: flex; gap: 0.7rem; align-items: center;
    margin: 0; white-space: nowrap;
}

/* --- Fußzeile ------------------------------------------------------------- */
.site-foot { color: var(--muted); font-size: 0.85rem; }
.site-foot a { color: var(--muted); text-decoration: underline; }
.regelstand { font-family: var(--mono); font-size: 0.75rem; }

/* --- Druck: jede Regelseite ein brauchbares Handout ----------------------- */
@media print {
    body { background: #fff; color: #000; }
    .bottom-nav, .kopf-knoepfe, .sprungleiste, .nach-oben, .filterzeile,
    .update-hinweis { display: none !important; }
    body.schraeg .stage::before, body.schraeg main > .hero::before,
    body.schraeg .site-foot::before { display: none; }
    details.card { break-inside: avoid; }
    details.card summary::before { display: none; }
    .card, .callout, .legende { border-color: #999; background: #fff; }
    a { color: inherit; text-decoration: none; }
}
