/* „Hm?" — Knopf, Ringmarkierung und Blatt (Paket 9, Stufe 128, 12.11.2026). Gehört zu js/hm.mjs; geladen von meine.html und index.html.
   Alles trägt das Präfix hm- (Lehre „Element-Selektor trifft geteilten Baustein"): kein Selektor hier trifft ein Element der Anwendung. */

:root { --hm-rot: #FF3B30; }

/* ── Der Knopf ──────────────────────────────────────────────────────────────
   Rechter Rand, mittlere Höhe: Dort sitzt weder Kopfzeile noch Tab-Leiste noch Stempelleiste (unten) noch Update-Balken. 44 × 44 px,
   halbtransparent, damit er nicht aufdringlich ist.
   Eigene :hover/:active-Regeln — das globale `button:hover` aus stil.css färbt sonst hellcyan (Lehre aus der Crew-App). Die doppelte
   Klasse hebt auch `button { padding; background; … }` aus stil.css und meine.css aus. */
.hm-knopf.hm-knopf {
  position: fixed; z-index: 9000;
  right: max(6px, env(safe-area-inset-right));
  top: calc(50% - 22px);
  width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink700, #1A1F25); color: var(--fg2, rgba(255,255,255,.68));
  border: 1px solid var(--line-stark, rgba(255,255,255,.22));
  font-family: inherit; font-weight: 800; font-size: 13px; line-height: 1; letter-spacing: 0; text-transform: none;
  opacity: .62; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hm-knopf.hm-knopf:hover { background: var(--ink600, #252B33); color: var(--fg, #fff); opacity: .95; }
.hm-knopf.hm-knopf:active { background: var(--ink800, #111418); color: var(--fg, #fff); opacity: 1; }
.hm-knopf.hm-knopf:focus-visible { outline: 2px solid var(--blau, #009FE3); outline-offset: 2px; opacity: 1; }
.hm-knopf[hidden] { display: none; }

/* Auf der Anmeldeseite der Planung (#tuer sichtbar) gibt es nichts zu melden. */
body:has(#tuer:not([hidden])) .hm-knopf { display: none; }
body.abz-rb-offen .hm-knopf { opacity: .45; }

/* ── Die Fläche zum Zeigen ──────────────────────────────────────────────────
   Unsichtbar, fängt das Antippen. `touch-action: manipulation` lässt Scrollen und Zoomen zu: Man darf die Seite noch an die richtige
   Stelle schieben, bevor man tippt. */
.hm-schicht { position: fixed; inset: 0; z-index: 9001; background: rgba(0,0,0,.06); cursor: crosshair; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.hm-band {
  position: fixed; z-index: 9003; left: 12px; right: 12px; width: fit-content; margin: 0 auto; top: max(10px, env(safe-area-inset-top)); padding: 4px 4px 4px 16px; border-radius: 999px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(10,13,16,.92); color: #fff; border: 1px solid rgba(255,255,255,.25);
  font-size: 14px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.5);
  pointer-events: none;      /* der Text fängt nichts ab: auch unter ihm lässt sich zeigen; nur „Abbrechen" fängt */
}
.hm-band .hm-band-text { min-width: 0; }
.hm-band .hm-band-aus {
  pointer-events: auto; flex: none; min-height: 44px; padding: 0 16px; margin: 0; border-radius: 999px;
  background: rgba(255,255,255,.14); color: #fff; border: 0; font: inherit; font-size: 14px; font-weight: 800;
  text-transform: none; letter-spacing: 0; cursor: pointer;
}
.hm-band .hm-band-aus:hover, .hm-band .hm-band-aus:active { background: rgba(255,255,255,.28); color: #fff; }

/* Der Schalter „Melde-Knopf zeigen" (Profil der Crew-App, Menü der Planung). */
.hm-schalterzeile { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-size: 15px; font-weight: 700; }
.hm-schalterzeile input { width: 22px; height: 22px; flex: none; accent-color: var(--blau, #009FE3); }

.hm-ring {
  position: fixed; z-index: 9002; width: 52px; height: 52px; margin: -26px 0 0 -26px; box-sizing: border-box;
  border-radius: 50%; border: 5px solid var(--hm-rot); background: rgba(255,59,48,.16);
  box-shadow: 0 0 0 4px #fff, 0 0 0 5px rgba(0,0,0,.25), 0 0 14px rgba(0,0,0,.4);
  pointer-events: none; animation: hm-ploppen .16s ease-out;
}
@keyframes hm-ploppen { from { transform: scale(1.7); opacity: 0 } to { transform: none; opacity: 1 } }

/* ── Das Blatt ───────────────────────────────────────────────────────────── */
.hm-sheet {
  position: fixed; z-index: 9004; left: 0; right: 0; bottom: var(--hm-unten, 0px);
  width: 100%; max-width: 560px; margin: 0 auto; box-sizing: border-box;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--ink800, #111418); color: var(--fg, #fff);
  border: 1px solid var(--line-stark, rgba(255,255,255,.22)); border-bottom: 0; border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,.55);
  display: flex; flex-direction: column; gap: 10px;
  font-size: 15px; line-height: 1.35;
}
.hm-sheet.hm-oben {
  bottom: auto; top: var(--hm-oben, 0px); padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 14px;
  border: 1px solid var(--line-stark, rgba(255,255,255,.22)); border-top: 0; border-radius: 0 0 14px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.55);
}
.hm-titel { font-size: 16px; font-weight: 800; }
.hm-stelle { display: flex; align-items: center; gap: 10px; justify-content: space-between; min-height: 44px; color: var(--fg2, rgba(255,255,255,.68)); font-size: 13px; }
.hm-stelle-text { min-width: 0; overflow-wrap: anywhere; }

.hm-sheet .hm-text {
  width: 100%; box-sizing: border-box; min-height: 84px; max-height: 40vh; resize: vertical; padding: 10px 12px;
  background: var(--ink900, #0A0D10); color: var(--fg, #fff); border: 1px solid var(--line-stark, rgba(255,255,255,.22)); border-radius: 8px;
  font: inherit; font-size: 16px;     /* 16 px: iOS zoomt sonst beim Antippen ins Feld */
}
.hm-sheet .hm-text:focus { outline: 2px solid var(--blau, #009FE3); outline-offset: 0; }

.hm-bildzeile { font-size: 13px; color: var(--fg2, rgba(255,255,255,.68)); }
.hm-bildzeile.hm-warn { color: #FFD79A; }
.hm-fehler { padding: 10px 12px; border-radius: 8px; background: #3A1416; border: 1px solid rgba(229,72,77,.5); color: #FFC9CB; font-size: 14px; }
.hm-fehler[hidden] { display: none; }

/* Link-artige Knöpfe: 44 px hoch, keine Füllung. Eigene Zustände, damit das globale button:hover nicht durchschlägt. */
.hm-sheet .hm-link {
  background: transparent; color: var(--blau-text, #009FE3); border: 0; padding: 0 4px; margin: 0; min-height: 44px;
  font: inherit; font-size: 14px; font-weight: 700; text-transform: none; letter-spacing: 0; cursor: pointer;
  display: inline-flex; align-items: center; white-space: nowrap; text-decoration: none;
}
.hm-sheet .hm-link:hover, .hm-sheet .hm-link:active { background: transparent; color: var(--blau-hell, #1FB6FF); text-decoration: underline; }
.hm-sheet .hm-link:disabled { color: var(--fg3, rgba(255,255,255,.44)); }
.hm-sheet .hm-eigenes { position: relative; align-self: flex-start; font-size: 13px; }
.hm-sheet .hm-datei { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 0; }

.hm-zeile { display: flex; gap: 10px; justify-content: flex-end; }
.hm-sheet .hm-senden, .hm-sheet .hm-still {
  min-height: 44px; min-width: 96px; padding: 0 18px; margin: 0; border-radius: 8px; font: inherit; font-size: 15px; font-weight: 800;
  text-transform: none; letter-spacing: 0; cursor: pointer;
}
.hm-sheet .hm-senden { background: var(--blau, #009FE3); color: var(--auf-blau); border: 0; flex: 1 1 auto; max-width: 240px; }
.hm-sheet .hm-senden:hover { background: var(--blau-hell, #1FB6FF); color: var(--auf-blau); }
.hm-sheet .hm-senden:active { background: var(--blau-tief, #0077B0); color: var(--auf-blau); }
.hm-sheet .hm-senden:disabled { background: var(--ink600, #252B33); color: var(--fg3, rgba(255,255,255,.44)); cursor: default; }
.hm-sheet .hm-still { background: transparent; color: var(--fg2, rgba(255,255,255,.68)); border: 1px solid var(--line-stark, rgba(255,255,255,.22)); }
.hm-sheet .hm-still:hover, .hm-sheet .hm-still:active { background: var(--ink600, #252B33); color: var(--fg, #fff); }
.hm-sheet .hm-still:disabled { opacity: .5; cursor: default; }

/* ── Dank ────────────────────────────────────────────────────────────────── */
.hm-toast {
  position: fixed; z-index: 9005; left: 16px; right: 16px; width: fit-content; margin: 0 auto; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); padding: 12px 18px; border-radius: 10px; font-size: 15px; font-weight: 700; text-align: center;
  background: #0C2E20; border: 1px solid rgba(0,194,122,.45); color: #9BF0CC; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}

@media print { .hm-knopf, .hm-schicht, .hm-band, .hm-ring, .hm-sheet, .hm-toast { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .hm-ring { animation: none; } }
