/* Hell/Dunkel-Umschalter (thema.js): Knopf in der Kopfzeile, Auswahl im Handy-Menü und im Profil-Menü.
   Farben nur über Tokens; dunkle Werte stehen in design.css/styles.css doppelt (System dunkel ohne data-theme="light" UND data-theme="dark"). */
.thema-knopf{display:inline-grid;place-items:center;flex:none;width:44px;height:44px;padding:0;border-radius:var(--r-pill);border:1px solid var(--line);
  background:var(--surface);color:var(--ink);box-shadow:var(--sh-1);cursor:pointer;position:relative;
  transition:border-color var(--t-fast) ease,transform var(--t-fast) ease,color var(--t-fast) ease}
.thema-knopf:hover{border-color:var(--brand);color:var(--brand)}
.thema-knopf:active{transform:scale(.95)}
.thema-knopf svg{width:20px;height:20px;grid-area:1/1;transition:transform var(--t-med) var(--ease-spring),opacity var(--t-fast) ease}
/* Mond = „dunkel einschalten“ im hellen Design, Sonne = „hell einschalten“ im dunklen */
.thema-knopf .tk-sonne{opacity:0;transform:rotate(-60deg) scale(.6)}
.thema-knopf[aria-pressed="true"] .tk-mond{opacity:0;transform:rotate(60deg) scale(.6)}
.thema-knopf[aria-pressed="true"] .tk-sonne{opacity:1;transform:none}
/* Automatisch: kleiner Punkt am Knopf */
.thema-knopf[data-wahl="auto"]::after{content:"";position:absolute;right:7px;bottom:7px;width:6px;height:6px;border-radius:50%;background:var(--ink-3);box-shadow:0 0 0 2px var(--surface)}
@media (max-width:420px){ .top .wrap{gap:8px} .thema-knopf{width:44px} }
html.einladungsmodus .thema-knopf,html.einladungsmodus .nav-thema{display:none!important}
/* Konten mit Brief/Kinder-Symbol in der Kopfzeile: kein Platz für einen weiteren Knopf – Design dann über Profil- und Handy-Menü */
header.top:has(.kopf-symbole:not([hidden])) .thema-knopf{display:none}

/* Handy-Menü: Segmente Automatisch · Hell · Dunkel (nur im Menü-Blatt) */
.nav-thema{display:none}
@media (max-width:1100px){
  .nav-thema{display:flex;flex-direction:column;gap:4px;padding:4px 0 2px}
  .nav-thema-seg{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:4px;border-radius:var(--r-m);background:var(--soft);margin:0 4px}
  .nav-thema-seg button{min-height:44px;border:0;border-radius:calc(var(--r-m) - 4px);background:transparent;color:var(--ink-2);font-weight:700;cursor:pointer}
  .nav-thema-seg button[aria-pressed="true"]{background:var(--surface);color:var(--ink);box-shadow:var(--sh-1)}
}

/* Profil-Menü */
.pc-thema{display:flex;flex-direction:column;gap:2px}
.pc-thema-t{font-family:var(--f-mono);font-size:.7rem;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-3);padding:6px 12px 2px}
.pc-menue [role="menuitemradio"]{display:flex;align-items:center;gap:10px;min-height:44px;padding:8px 12px;border:0;border-radius:10px;background:none;color:var(--ink);font:inherit;font-weight:700;text-align:left;cursor:pointer}
.pc-menue [role="menuitemradio"]::before{content:"";width:16px;height:16px;flex:none;border-radius:50%;border:2px solid var(--ink-3)}
.pc-menue [role="menuitemradio"][aria-checked="true"]::before{border-color:var(--brand);background:radial-gradient(circle,var(--brand) 0 4px,transparent 4.5px)}
.pc-menue [role="menuitemradio"]:hover,.pc-menue [role="menuitemradio"]:focus-visible{background:var(--soft)}

/* Weiche Überblendung beim Umschalten (nicht beim Laden, nicht bei reduzierter Bewegung) */
@media (prefers-reduced-motion: no-preference){
  html.thema-wechsel,html.thema-wechsel *,html.thema-wechsel *::before,html.thema-wechsel *::after{transition:background-color .25s ease,color .25s ease,border-color .25s ease,fill .25s ease,stroke .25s ease!important}
}

/* Feedback-Lasche (feedback.js): am Handy ausblenden, solange ein Blatt, eine Palette, ein Werkzeug, die Lernkartei oder Kachi offen ist */
@media (max-width:760px){
  html:has(.fk-blatt:not([hidden])) .fb-lasche,html:has(.mk-palette:not([hidden])) .fb-lasche,html:has(.lk-overlay) .fb-lasche,
  html:has(.ki-panel:not([hidden])) .fb-lasche,html:has(.wz:not([hidden])) .fb-lasche,html:has(.rechner:not([hidden])) .fb-lasche,
  html:has(.b-notizfeld:not([hidden])) .fb-lasche{visibility:hidden;opacity:0;pointer-events:none}
}
/* Sehr schmale Handys (z. B. Android mit großer Anzeige): Kopfzeile passt sonst nicht; die Wahl steht im Handy-Menü */
@media (max-width:379px){ .thema-knopf[data-thema-knopf]{display:none} }
