/* =========================================================================
   Einstellungen (7.12.0): globale Schalter aus prefs.js + die Seite selbst.
   ========================================================================= */

/* ---------- Global: Animationen ---------- */
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after {
    animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
}
/* Reduziert: Uebergaenge bleiben, Endlos-Schleifen laufen nur einmal */
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after {
    animation-iteration-count: 1 !important; scroll-behavior: auto !important;
}
:root[data-motion="reduced"] .starfield i, :root[data-motion="off"] .starfield i { animation: none !important; }
:root[data-stars="off"] .starfield { display: none; }
:root[data-shake="off"] .fx-flash { display: none !important; }

/* ---------- Global: Schrift ---------- */
:root[data-font="large"] { font-size: 112.5%; }
:root[data-font="xl"] { font-size: 125%; }

/* ---------- HUD-Zahnrad ---------- */
.hud-gear { transition: transform .4s var(--ease); }
.hud-gear:hover { transform: rotate(60deg); }

/* ---------- Seite ---------- */
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.st-card { display: grid; gap: 10px; }
.st-note { margin: 0; font-size: .84rem; color: var(--text-dim); }
.st-note b { color: var(--text); }

.st-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.st-seg button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: 14px; text-align: center; cursor: pointer;
                 background: var(--bg-slot); border: 1px solid var(--line); color: var(--text); font: inherit; transition: border-color .2s, background .2s, transform .15s; }
.st-seg button:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.st-seg button.on { border-color: var(--cyan); background: rgba(47,224,228,.1); box-shadow: 0 0 18px -6px var(--cyan); }
.st-seg .i { font-size: 1.4rem; }
.st-seg b { font-size: .88rem; color: var(--text-bright); }
.st-seg small { font-size: .7rem; color: var(--text-dim); line-height: 1.3; }

.st-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.st-row > span { min-width: 0; }
.st-row b { display: block; color: var(--text-bright); font-size: .92rem; }
.st-row small { display: block; color: var(--text-dim); font-size: .78rem; }
.st-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.st-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.st-select { width: auto; min-width: 190px; }
.st-range { width: 150px; accent-color: var(--cyan); }

/* Schalter */
.st-tog { cursor: pointer; }
.st-tog input { position: absolute; opacity: 0; pointer-events: none; }
.st-sw { position: relative; flex: none; width: 46px; height: 26px; border-radius: 99px; background: rgba(255,255,255,.1); border: 1px solid var(--line-strong); transition: background .2s, border-color .2s; }
.st-sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-dim); transition: transform .25s var(--ease), background .2s; }
.st-tog input:checked + .st-sw { background: rgba(47,224,228,.3); border-color: var(--cyan); }
.st-tog input:checked + .st-sw::after { transform: translateX(20px); background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.st-tog input:focus-visible + .st-sw { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Vorschau: zeigt, was die Einstellung bedeutet */
.st-demo { position: relative; height: 74px; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 50%, rgba(47,224,228,.12), transparent 70%), var(--bg-slot); border: 1px solid var(--line); }
.st-demo span { position: absolute; right: 12px; bottom: 8px; font-size: .74rem; color: var(--text-dim); }
.st-orb { position: absolute; top: 50%; left: 10%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }
.st-orb.b { background: var(--gold); box-shadow: 0 0 14px var(--gold); width: 12px; height: 12px; margin-top: -6px; }
.st-orb.c { background: var(--violet); box-shadow: 0 0 14px var(--violet); width: 8px; height: 8px; margin-top: -4px; }
.st-demo[data-lvl="full"] .st-orb { animation: stOrb 2.4s ease-in-out infinite; }
.st-demo[data-lvl="full"] .st-orb.b { animation-delay: .2s; }
.st-demo[data-lvl="full"] .st-orb.c { animation-delay: .4s; }
.st-demo[data-lvl="reduced"] .st-orb { left: 45%; transition: left .6s; }
.st-demo[data-lvl="reduced"] .st-orb.b { left: 52%; }
.st-demo[data-lvl="reduced"] .st-orb.c { left: 58%; }
.st-demo[data-lvl="off"] .st-orb { left: 45%; }
.st-demo[data-lvl="off"] .st-orb.b { left: 52%; }
.st-demo[data-lvl="off"] .st-orb.c { left: 58%; }
@keyframes stOrb { 0%, 100% { left: 10%; transform: scale(1); } 50% { left: 80%; transform: scale(1.4); } }

.st-reload { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 14px; border-radius: 14px; background: rgba(47,224,228,.08); border: 1px solid rgba(47,224,228,.4); }
.st-reload > span { font-size: 1.4rem; }
.st-reload > div { flex: 1; min-width: 0; }
.st-reload b { display: block; color: var(--text-bright); }
.st-reload small { color: var(--text-dim); }

@media (max-width: 560px) {
    .st-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .st-row { flex-wrap: wrap; }
    .st-tog { flex-wrap: nowrap; }
    .st-ctrl { justify-content: flex-start; width: 100%; }
    .st-select { width: 100%; }
    .st-range { flex: 1; width: auto; }
    .st-reload { flex-wrap: wrap; }
}

/* Sehr grosse Schrift auf schmalen Handys: lange Woerter duerfen umbrechen */
@media (max-width: 420px) {
    :root[data-font="xl"] .page :is(h1, h2, h3, p, b, small, span, div) { overflow-wrap: anywhere; min-width: 0; }
}
