/* Bausteine „Inlay“: Knöpfe, Umschalter, Tonart-Knöpfe, Kapseln, Regler, Bewertung,
   Kartenstand, Karten, Schalter, Felder. Erzeugt meist über js/ui/components.js. */

/* ---------- Knöpfe ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
    min-height: 48px; padding: 0 var(--s5);
    border: 1px solid var(--line-ctl); border-radius: var(--r-round);
    background: transparent; color: var(--text);
    font-size: var(--fs-text); font-weight: 500; line-height: 1.2; text-decoration: none;
    cursor: pointer; white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--text-muted); background: var(--text-soft); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: default; opacity: .55; }
.btn:disabled:hover { background: transparent; border-color: var(--line-ctl); }
.btn--primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.06); }
:root[data-theme="light"] .btn--primary:hover { filter: brightness(1.12); }
.btn--bone { border-color: var(--text); background: var(--text); color: var(--bg); }
.btn--bone:hover { background: var(--text); border-color: var(--text); filter: brightness(1.05); }
.btn--text {
    min-height: var(--tap); padding: 0 var(--s2); border: 0; background: transparent;
    color: var(--text-muted); text-decoration: underline; text-underline-offset: 4px;
}
.btn--text:hover { background: transparent; color: var(--text); }
.btn--sm { min-height: 40px; padding: 0 var(--s4); font-size: 14px; }
.btn--lg { min-height: 64px; padding: 0 var(--s6); font-size: var(--fs-large); font-weight: 600; }
.btn--block { width: 100%; }
.btn .ico { flex: none; }
.btn--locked { color: var(--text-muted); }

/* runder Symbolknopf (Schließen, Account) */
.iconbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--tap); height: var(--tap); flex: none; padding: 0;
    border: 1px solid var(--line-ctl); border-radius: var(--r-round);
    background: transparent; color: var(--text); cursor: pointer;
}
.iconbtn:hover { background: var(--text-soft); }

/* Textlink mit Pfeil („Fortschritt ansehen →“) */
.link {
    white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px; padding: 0; min-height: 32px;
    border: 0; background: none; color: var(--text); font-size: var(--fs-text); font-weight: 600;
    cursor: pointer; text-decoration: none;
}
.link:hover { color: var(--accent); }
.link--muted { color: var(--text-muted); font-weight: 400; text-decoration: underline; text-underline-offset: 4px; }
.link--muted:hover { color: var(--text); }

/* ---------- Umschalter (Segmente in einer Kapsel) ---------- */
.seg {
    display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 3px;
    border: 1px solid var(--line-ctl); border-radius: var(--r-round);
    max-width: 100%;
}
.seg > button {
    min-height: 36px; padding: 0 var(--s4); border: 0; border-radius: var(--r-round);
    background: transparent; color: var(--text); font-size: 14px; font-weight: 500;
    cursor: pointer; white-space: nowrap;
}
.seg > button:hover { background: var(--text-soft); }
.seg > button.active { background: var(--accent); color: var(--on-accent); }
.seg--bone > button.active { background: var(--text); color: var(--bg); }

/* ---------- Tonart-Knöpfe (rund) ---------- */
.keybtns { display: flex; flex-wrap: wrap; gap: var(--s2); }
.keybtn {
    width: var(--tap); height: var(--tap); flex: none; padding: 0;
    border: 1px solid var(--line-ctl); border-radius: var(--r-round);
    background: transparent; color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer;
}
.keybtn:hover { background: var(--text-soft); }
.keybtn.active { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* ---------- Kapseln (einzelne Auswahlknöpfe, z. B. „Bund 4–8“, Tonarten ausgeschrieben) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
    min-height: var(--tap); padding: 0 var(--s4);
    border: 1px solid var(--line-ctl); border-radius: var(--r-round);
    background: transparent; color: var(--text); font-size: 14px; font-weight: 500;
    cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--text-soft); }
.chip.active { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.chips--bone .chip.active { border-color: var(--text); background: var(--text); color: var(--bg); }

/* Zu breite Reihen auf dem Smartphone seitlich wischbar */
.scroll-x { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > .chips, .scroll-x > .keybtns { flex-wrap: nowrap; }

/* ---------- Regler „− Zahl +“ ---------- */
.stepper { display: inline-flex; align-items: center; gap: 14px; }
.stepper__btn {
    width: var(--tap); height: var(--tap); padding: 0; flex: none;
    border: 1px solid var(--line-ctl); border-radius: var(--r-round);
    background: transparent; color: var(--text); font-size: 20px; line-height: 1; cursor: pointer;
}
.stepper__btn:hover { background: var(--text-soft); }
.stepper__btn:disabled { opacity: .4; cursor: default; background: transparent; }
.stepper__num { min-width: 32px; text-align: center; font-size: var(--fs-title3); font-weight: 600; }

/* ---------- Bewertung ---------- */
.rating { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.rating__btn {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 60px; padding: var(--s2);
    border: 1px solid var(--line-ctl); border-radius: var(--r-input);
    background: transparent; color: var(--text); font-size: var(--fs-small); font-weight: 500; cursor: pointer;
}
.rating__btn:hover { background: var(--text-soft); }
.rating__btn.active { border-color: var(--accent); background: var(--accent-soft); }
.rating__txt { display: flex; flex-direction: column; }
.rating__hint { font-size: var(--fs-small); color: var(--text-muted); font-weight: 400; }
.rate-ico__ring { stroke: var(--line-ctl); }
.rate-ico__ring.on { stroke: var(--accent); }
.rate-ico__fill { fill: var(--accent); }
.rating--large { gap: var(--s3); }
.rating--large .rating__btn {
    flex-direction: row; justify-content: flex-start; gap: var(--s4);
    min-height: 96px; padding: var(--s5); border-radius: var(--r-card); background: var(--surface);
    text-align: left;
}
.rating--large .rating__word { font-size: var(--fs-title3); font-weight: 500; line-height: 1.2; }
.rating--large .rating__btn.active { background: var(--accent-soft); }
.rating--locked .rating__btn { cursor: default; }
.rating--locked .rating__btn:hover { background: transparent; }
.rating--locked .rating__btn.active, .rating--locked .rating__btn.active:hover { background: var(--accent-soft); }
.rating--locked .rating__btn:not(.active) { opacity: .45; }
.rating--inline { display: inline-flex; flex-wrap: wrap; }
.rating--inline .rating__btn { flex-direction: row; min-height: var(--tap); border-radius: var(--r-round); padding: 0 var(--s4); gap: var(--s2); font-size: 14px; }

/* ---------- Kartenstand: drei Segmente plus Wort ---------- */
.cardstate { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-small); color: var(--text-muted); }
.cardstate__segs { display: inline-flex; gap: 3px; }
.cardstate__segs i { display: block; width: 18px; height: 6px; border-radius: 3px; background: var(--line-fine); }
.cardstate__segs i.on { background: var(--accent); }

/* ---------- Karten und Flächen ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line-fine); border-radius: var(--r-card);
    padding: var(--pad-card);
}
.card--plain { background: transparent; }
.card--accent { border-color: var(--accent); }
.divider { height: 1px; background: var(--line-fine); border: 0; margin: 0; }

/* Einstellungsblock: Zeilen „Beschriftung · Bedienelement“, linksbündig untereinander */
.fields { display: flex; flex-direction: column; gap: var(--s3); }
.field { display: grid; grid-template-columns: 136px minmax(0, 1fr); align-items: center; gap: var(--s4); min-height: 48px; }
.field__label { font-size: var(--fs-small); color: var(--text-muted); }
.field__ctl { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }

/* ---------- Schalter (an/aus) ---------- */
.switch { display: inline-flex; align-items: center; gap: var(--s3); min-height: var(--tap); cursor: pointer; font-size: 14px; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
    position: relative; width: 40px; height: 24px; flex: none; border-radius: var(--r-round);
    background: var(--line-fine); border: 1px solid var(--line-ctl); transition: background-color .15s;
}
.switch__track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--text-muted); transition: transform .15s, background-color .15s;
}
.switch input:checked + .switch__track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: var(--on-accent); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Fortschrittsbalken ---------- */
.bar { position: relative; height: 6px; border-radius: 3px; background: var(--line-fine); overflow: visible; }
.bar__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.bar__mark { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--text); }

/* ---------- Häkchen-Kreis (erfüllt / offen) ---------- */
.okdot { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-ctl); }
.okdot.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.okdot .ico { width: 13px; height: 13px; stroke-width: 2.6; }

/* ---------- Kopf einer Seite (Titel links, Umschalter rechts) ---------- */
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; padding-top: var(--s7); }
.pagehead__text { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.pagehead__sub { color: var(--text-muted); font-size: var(--fs-large); line-height: 1.45; }
.section { padding-top: var(--s7); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.note { font-size: var(--fs-small); color: var(--text-muted); }
/* Wischbare Bereiche dürfen als Flex- oder Grid-Element nicht auf Inhaltsbreite wachsen */
.scroll-x, .fb-scroll { min-width: 0; max-width: 100%; }
.card > * { min-width: 0; }

/* Bereite Herausforderung: Knopf pulsiert leicht (Ring in der Signalfarbe, kaum Vergrößerung) */
.btn--pulse { animation: btnPulse 1.8s ease-in-out infinite; }
.btn--pulse:hover, .btn--pulse:focus-visible { animation: none; }
@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-strong); transform: scale(1); }
    50% { box-shadow: 0 0 0 12px transparent; transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) { .btn--pulse { animation: none; } }
/* Schmale Bildschirme: Umschalter mit drei Wörtern passen in die Zeile */
@media (max-width: 400px) { .seg > button { padding: 0 var(--s3); } }
