/* =========================================================
   Billard-Diagramme – Stylesheet
   Dunkles "Billardsalon"-Thema rund um den blauen Tisch
   ========================================================= */

:root {
  --bg: #14171c;
  --bg-raised: #1c2129;
  --bg-inset: #10131a;
  --line: #2b323d;
  --text: #e8ecf2;
  --text-dim: #93a0b4;
  --accent: #4f9bdc;        /* Kreideblau */
  --accent-strong: #79c1ff;
  --felt: #2e6bb0;          /* Simonis Tournament Blue */
  --danger: #d9534f;
  --ok: #3fae6a;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(46,107,176,.14), transparent 60%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;            /* full-bleed-Tisch erzeugt keinen Scroll */
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  /* Fußzeile überall unten „kleben" lassen: Body als Spalte, Hauptinhalt wächst */
  min-height: 100vh; display: flex; flex-direction: column;
}
/* width:100% ist WICHTIG: ohne es schrumpft ein Flex-Item mit margin:0 auto (z. B. .layout,
   .sb-main) auf seine Inhaltsbreite statt auf die volle Breite bis max-width. */
body > main { flex: 1 0 auto; width: 100%; }
.site-footer { margin-top: auto; }

h1, h2 { font-weight: 650; letter-spacing: .015em; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }

/* ---------- Kopfzeile ---------- */
.topbar {
  display: flex; align-items: center; justify-content: flex-start;
  gap: .5rem .9rem; flex-wrap: wrap; padding: .6rem 1rem;
  background: linear-gradient(180deg, #1a1f27, #161a21);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;   /* über der Werkzeugleiste (z-index 45), damit das Burger-Menü sie überdeckt */
}
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 0 1 auto; }
.brand-logo { height: 30px; width: auto; display: block; flex: 0 0 auto; }
.brand h1 { font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%; align-self: center; flex: 0 0 auto;
  background: radial-gradient(circle at 35% 30%, #9fd0ff, var(--felt) 60%, #1c4575);
  box-shadow: 0 0 0 2px rgba(255,255,255,.08);
}
.brand-sub { color: var(--text-dim); font-size: .8rem; letter-spacing: .02em; white-space: nowrap; }
.topnav { flex: 0 0 auto; }
.userbox { display: flex; align-items: center; gap: .45rem; font-size: .9rem; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.userbox .uname { color: var(--accent-strong); font-weight: 600; }

/* Schmale Bildschirme: Navigation zum Burger-Menü zusammenklappen.
   Selektoren bewusst mit .topbar-Präfix (höhere Spezifität), damit sie die
   späteren Basisregeln (.topnav{display:flex}, .nav-toggle{display:none}) sicher
   überschreiben – unabhängig von der Quellreihenfolge. */
@media (max-width: 680px) {
  .topbar { padding: .5rem .7rem; row-gap: .4rem; }
  .brand { flex: 1 1 auto; }
  .brand-sub { display: none; }                 /* Untertitel ausblenden – spart Platz */
  .topbar .nav-toggle { display: inline-flex; }
  /* Navigation als Overlay unter der Kopfzeile (wird per Burger auf-/zugeklappt) */
  .topbar .topnav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: .35rem; padding: .6rem .8rem;
    background: var(--bg-raised); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow); z-index: 45;
  }
  .topbar .topnav.open { display: flex; }
  .topnav .nav-link { width: 100%; text-align: left; }
  .userbox { font-size: .85rem; gap: .4rem; }
}
@media (max-width: 420px) {
  .userbox { font-size: .8rem; gap: .3rem; }
  .userbox .ghost-btn { padding: .35rem .55rem; }
}

/* ---------- Layout ---------- */
.layout { max-width: 1180px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; }

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

/* ---------- Toolbar ---------- */
/* Werkzeugleiste: schlanker Balken, der bei Hover/Tippen ein Panel ausklappt
   (overlay – der Tisch bleibt dadurch in voller Größe sichtbar) */
.toolbar {
  position: sticky; top: .4rem; z-index: 45;
}
.toolbar-bar {
  width: 100%; display: flex; align-items: center; gap: .8rem;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .55rem .9rem; box-shadow: var(--shadow);
  color: var(--text); text-align: left;
}
.toolbar-bar .tb-title { font-weight: 600; font-size: .9rem; }
.toolbar-bar .tb-hint { color: var(--text-dim); font-size: .78rem; margin-left: auto; }
.toolbar-bar .tb-chev { transition: transform .2s; color: var(--text-dim); }
.toolbar.open .toolbar-bar { border-color: var(--accent); }
.toolbar.open .tb-chev { transform: rotate(180deg); }

.toolbar-panel {
  position: absolute; top: 100%; left: 0; right: 0;
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem 1.6rem;
  background: var(--bg-raised); border: 1px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 0 1rem; margin-top: 0;
  max-height: 0; overflow: hidden; opacity: 0; pointer-events: none;
  transition: max-height .25s ease, opacity .18s ease, padding .25s ease;
}
.toolbar.open .toolbar-panel {
  max-height: 78vh; overflow: auto; opacity: 1; pointer-events: auto;
  padding: .8rem 1rem;
}

.tool-group { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.tool-stack { display: flex; flex-direction: column; gap: .6rem; flex: 0 0 auto; }
.tool-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim); }
.tool-label small { text-transform: none; letter-spacing: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

button {
  font: inherit; color: var(--text); cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-inset);
  border-radius: 8px; padding: .42rem .7rem;
  transition: background .15s, border-color .15s, transform .05s;
  touch-action: manipulation;
}
button:hover { border-color: #3c4656; }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tool-btn { display: inline-flex; align-items: center; gap: .45rem; }
.tool-btn svg { width: 16px; height: 16px; fill: currentColor; }
.tool-btn.active, .opt-btn.active {
  background: rgba(79,155,220,.18); border-color: var(--accent); color: var(--accent-strong);
}
.rack-btn { font-weight: 600; }
.primary-btn { background: var(--accent); border-color: var(--accent); color: #0c1015; font-weight: 650; }
.primary-btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.danger-btn { color: #ffb3b0; border-color: rgba(217,83,79,.5); }
.danger-btn:hover { background: rgba(217,83,79,.15); border-color: var(--danger); }
.danger-btn.full { width: 100%; margin-top: .6rem; }
.ghost-btn { background: transparent; }
.icon-btn { padding: .1rem .5rem; font-size: 1.1rem; line-height: 1; background: transparent; border: none; }

.color-wrap input[type="color"] {
  width: 38px; height: 30px; padding: 2px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg-inset); cursor: pointer;
}

/* Kugel-Palette */
.palette { display: flex; flex-direction: column; gap: .55rem; max-width: 620px; }
.pal-row-wrap { display: flex; flex-direction: column; gap: .25rem; }
.pal-row-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); }
.pal-row { display: flex; gap: .3rem; flex-wrap: nowrap; overflow-x: auto; padding-bottom: .15rem; }
.pal-ball {
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  border: 2px solid transparent; background: rgba(255,255,255,.05); flex: 0 0 auto;
}
.pal-ball svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
.pal-ball.active { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(121,193,255,.25); }

/* ---------- Tisch ---------- */
/* Voll über die gesamte Bildschirmbreite, aber immer komplett sichtbar */
.table-wrap {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 0 max(8px, env(safe-area-inset-left));
}
#table {
  width: 100%; height: auto; display: block;
  max-height: 82vh;                /* nie höher als der sichtbare Bereich */
  margin: 0 auto;
  box-shadow: var(--shadow);
  touch-action: none;            /* Gesten gehören dem Zeichenwerkzeug */
  user-select: none; -webkit-user-select: none;
}

/* Eigenschaften-Leiste – feste, horizontale Zeile in der Werkzeugleiste.
   Immer sichtbar, damit die Höhe der Leiste bei Auswahl unverändert bleibt. */
.propbar {
  flex: 0 0 100%;
  display: flex; align-items: center; gap: .7rem;
  min-height: 46px;
  margin-top: .2rem; padding-top: .55rem;
  border-top: 1px solid var(--line);
}
.propbar .prop-title {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent-strong); white-space: nowrap; flex: 0 0 auto;
}
.propbar.empty .prop-title { color: var(--text-dim); }
.props-body {
  display: flex; flex-direction: row; align-items: center; gap: .5rem;
  flex: 1 1 auto; min-width: 0;
  flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px;
}
.props-body label { display: flex; align-items: center; gap: .35rem; color: var(--text-dim); font-size: .8rem; white-space: nowrap; }
.props-body input[type="text"] { width: clamp(120px, 32vw, 320px); padding: .35rem .5rem; }
.props-body input[type="range"] { width: 120px; accent-color: var(--accent); }
.props-body .row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.props-body .prop-hint { white-space: nowrap; }
.props-body .slider-label { white-space: nowrap; }
.props-body label.text-edit { align-items: flex-start; }
.hp-field { position: absolute !important; left: -9999px; top: 0; width: 1px; height: 1px; overflow: hidden; }
.captcha-row { display: flex; align-items: flex-end; gap: .5rem; }
.captcha-row label { flex: 1 1 auto; }
.captcha-reload { padding: .45rem .7rem; flex: 0 0 auto; }
.props-body textarea#p-text {
  width: clamp(160px, 34vw, 340px); min-height: 2.4rem; max-height: 8rem; resize: vertical;
  padding: .35rem .5rem; font: inherit; line-height: 1.25;
  color: var(--text); background: var(--bg-inset);
  border: 1px solid var(--line); border-radius: 8px;
}
.prop-actions { display: flex; gap: .4rem; margin-left: auto; flex: 0 0 auto; }
.prop-actions .danger-btn, .prop-actions .ghost-btn { padding: .35rem .7rem; }

/* ---------- Formulare ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 220px; gap: .8rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

label { display: grid; gap: .3rem; font-size: .85rem; color: var(--text-dim); }
.full-label { margin-top: .8rem; }

input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="search"], input[type="date"], input[type="time"], input[type="datetime-local"],
select, textarea {
  font: inherit; color: var(--text);
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 8px; padding: .55rem .65rem; width: 100%;
}
/* Zahlenfelder optisch wie Textfelder behandeln (ohne Spinner-Pfeile) */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* Datums-/Uhrzeit-Felder: gleiche Höhe wie Textfelder, Kalendersymbol einfärben */
input[type="date"], input[type="time"], input[type="datetime-local"] { min-height: 40px; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(60%); cursor: pointer;
}
/* Checkboxen/Radios im Akzentton */
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--accent); width: 1.05rem; height: 1.05rem; flex: 0 0 auto; cursor: pointer;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
textarea { resize: vertical; min-height: 90px; }

.save-row { display: flex; justify-content: flex-end; align-items: center; gap: .8rem; margin-top: .8rem; flex-wrap: wrap; }
.muted { color: var(--text-dim); font-size: .85rem; }

/* ---------- Übungsliste ---------- */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.ex-list { display: grid; gap: .5rem; margin-top: .6rem; }
.ex-item {
  display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center;
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 8px; padding: .6rem .8rem;
}
.ex-item .ex-name { font-weight: 650; flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.ex-item .ex-meta { color: var(--text-dim); font-size: .82rem; }
.ex-item .ex-actions { display: flex; gap: .4rem; margin-left: auto; }
.stars { color: var(--accent-strong); letter-spacing: .1em; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8,10,14,.7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal {
  width: min(380px, 100%); background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow); display: grid; gap: .8rem;
  /* Bei langem Inhalt (z. B. Profil mit E-Mail-Bereich) im Modal scrollen,
     damit oben/unten nichts abgeschnitten wird. */
  max-height: calc(100vh - 2rem); overflow-y: auto;
}
.tabs { display: flex; gap: .4rem; }
.tab { flex: 1; background: transparent; }
.tab.active { background: rgba(79,155,220,.18); border-color: var(--accent); color: var(--accent-strong); }
#auth-form { display: grid; gap: .7rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; }
.form-error { color: #ffb3b0; font-size: .85rem; margin: 0; }

/* ---------- Navigation ---------- */
.topnav { display: flex; align-items: center; gap: .5rem; }
.nav-link {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  padding: .45rem .9rem; border-radius: 999px; font-size: .9rem; white-space: nowrap;
}
.nav-link:hover { border-color: var(--accent); color: var(--accent-strong); }

/* ---------- Übungs-Modal ---------- */
.modal-wide { width: min(720px, 100%); max-height: 88vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.ex-filters { display: flex; flex-wrap: wrap; gap: .6rem .8rem; align-items: end; }
.ex-filters .flt { display: flex; flex-direction: column; gap: .25rem; font-size: .75rem; color: var(--text-dim); flex: 1 1 160px; }
.ex-filters .flt input[type="text"], .ex-filters .flt select { padding: .4rem .55rem; }
.ex-filters .flt-check { flex: 0 0 auto; flex-direction: row; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text); white-space: nowrap; }
.list-paging { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: .2rem; }
.list-paging button:disabled { opacity: .4; cursor: default; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  background: #0d1118; border: 1px solid var(--line); border-radius: 999px;
  padding: .55rem 1.1rem; box-shadow: var(--shadow); z-index: 120;
  font-size: .9rem; max-width: 90vw;
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }

/* ---------- SVG-Elemente auf dem Tisch ---------- */
.draggable { cursor: grab; }
.draggable:active { cursor: grabbing; }
.handle { cursor: grab; }
.txt-box {
  color: #fff; font-family: inherit; line-height: 1.25;
  overflow: visible; word-wrap: break-word; white-space: pre-wrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.6); pointer-events: none;
  box-sizing: border-box; width: 100%; height: 100%;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Footer + Rechtstexte ---------- */
.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1rem; padding: 1rem 1.2rem; margin-top: .5rem;
  border-top: 1px solid var(--line); color: var(--text-dim); font-size: .85rem;
}
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.footer-links a { color: var(--text-dim); text-decoration: none; }
.footer-links a:hover { color: var(--accent-strong); text-decoration: underline; }
/* „Change Log" / „Kontakt" als Buttons, sehen aus wie die übrigen Footer-Links */
.footer-link-btn {
  background: none; border: 0; padding: 0; margin: 0; font: inherit; cursor: pointer;
  color: var(--text-dim); text-decoration: none;
}
.footer-link-btn:hover { color: var(--accent-strong); text-decoration: underline; }

/* ---------- Change Log + Kontakt (Popups) ---------- */
.changelog-body { display: grid; gap: .9rem; max-height: 62vh; overflow-y: auto; }
.cl-entry { display: grid; gap: .3rem; }
.cl-date { font-weight: 700; color: var(--accent-strong); font-size: .9rem; }
.cl-entry ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .2rem; }
.cl-entry li { font-size: .88rem; }
#contact-form { display: grid; gap: .6rem; }
#contact-form label { display: block; }
#contact-form textarea { width: 100%; resize: vertical; }

/* ---------- Mobiles Burger-Menü ---------- */
.nav-toggle {
  display: none; background: transparent; border: 1px solid var(--line); border-radius: 8px;
  padding: .3rem .45rem; color: var(--text); cursor: pointer; line-height: 0;
}
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle:hover { border-color: var(--accent); }
.footer-left { display: flex; align-items: center; gap: .7rem; }
.social-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-inset); color: var(--text-dim);
  transition: background .15s, border-color .15s, color .15s;
}
.social-btn:hover { border-color: #1877f2; color: #1877f2; }
.social-btn svg { width: 16px; height: 16px; fill: currentColor; display: block; }

/* Einwilligung (Datenschutz) im Registrierungsformular */
.consent-row { font-size: .85rem; }
.consent-check { display: flex; align-items: flex-start; gap: .5rem; cursor: pointer; white-space: normal; }
.consent-check input { margin-top: .2rem; flex: 0 0 auto; }
.consent-check a { color: var(--accent-strong); }

/* Standalone-Rechtstexte (impressum.html / datenschutz.html) */
.legal { max-width: 820px; margin: 0 auto; padding: 1.5rem 1.2rem 4rem; line-height: 1.6; }
.legal h1 { font-size: 1.5rem; margin: .2rem 0 1.2rem; }
.legal h2 { font-size: 1.1rem; margin: 1.7rem 0 .5rem; color: var(--accent-strong); }
.legal p, .legal li { color: var(--text); }
.legal ul { padding-left: 1.2rem; }
.legal a { color: var(--accent-strong); }
.legal address { font-style: normal; }
.legal .back { display: inline-block; margin-bottom: .5rem; color: var(--text-dim); text-decoration: none; }
.legal .back:hover { color: var(--accent-strong); }
.legal .note { color: var(--text-dim); font-size: .85rem; border-left: 3px solid var(--accent); padding: .4rem .8rem; margin: 1rem 0; background: rgba(121,193,255,.06); }
.legal .ph { background: rgba(121,193,255,.14); border: 1px dashed var(--accent); border-radius: 4px; padding: 0 .3rem; }

/* ---------- Sprachumschalter ---------- */
.lang-switch { display: flex; align-items: center; flex: 0 0 auto; margin-left: auto; }
/* Kompakter Sprachumschalter: nur die Flagge der aktuellen Sprache */
.lang-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .2rem; border: 1px solid var(--line, #2a3038); border-radius: 6px;
  background: var(--bg-raised, #1b2027); cursor: pointer; line-height: 0;
}
.lang-toggle:hover { border-color: var(--accent, #79c1ff); }
.lang-toggle svg { width: 24px; height: 16px; border-radius: 2px; display: block; }
/* Benutzername als Link (öffnet das Profil) */
.uname-link {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--accent-strong); font-weight: 600; text-decoration: none;
}
.uname-link:hover { text-decoration: underline; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media (max-width: 680px) {
  .lang-switch { order: 3; margin-left: 0; }
}

/* ---------- Zweisprachige Rechtstexte ---------- */
.legal-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.lang-block { display: none; }
.lang-block.active { display: block; }

/* ---------- Bewertung (1–5 Sterne) ---------- */
.rating-block {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem;
  margin: .1rem 0 .2rem; padding: .5rem .7rem;
  background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
}
.rating-block-label { font-weight: 600; }
.rating-summary { font-size: .9rem; }
.rating-your { display: inline-flex; align-items: center; gap: .45rem; margin-left: auto; }
.stars-input { display: inline-flex; gap: .08rem; }
.stars-input .star {
  background: none; border: none; cursor: pointer; padding: 0 .04rem;
  font-size: 1.35rem; line-height: 1; color: var(--text-dim); transition: color .08s;
}
.stars-input .star.on { color: #f5b301; }
.link-btn {
  background: none; border: none; color: var(--accent-strong); cursor: pointer;
  font: inherit; text-decoration: underline; padding: 0;
}
.ex-item .ex-rating { color: #f5b301; font-size: .9rem; white-space: nowrap; }
.ex-item .ex-rating.muted { color: var(--text-dim); }

/* ---------- Practice / Trainings-Protokoll ---------- */
.practice h2 { margin-top: 0; }
.practice-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.practice-field { display: flex; flex-direction: column; gap: .25rem; width: 11rem; }
.practice-field span { font-size: .85rem; color: var(--text-dim); }
.practice-field input { width: 100%; }
/* Schaltfläche neben dem Eingabefeld exakt gleich hoch -> saubere horizontale Ausrichtung */
.practice-row .primary-btn { padding-top: .55rem; padding-bottom: .55rem; }
.practice-sub { font-weight: 600; margin: .1rem 0 .5rem; }
.practice-meta { color: var(--text-dim); font-size: .85rem; }
.practice-login { color: var(--text-dim); }

.attempt-list { list-style: none; margin: .4rem 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; max-height: 30vh; overflow: auto; }
.attempt-item {
  display: flex; align-items: center; gap: .6rem;
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 6px; padding: .35rem .6rem; font-size: .9rem;
}
.attempt-item .att-n { color: var(--text-dim); min-width: 4.8rem; }
.attempt-item .att-potted { font-weight: 650; }
.attempt-item .att-potted.reached { color: #4caf50; }
.attempt-item .att-time { color: var(--text-dim); margin-left: auto; font-size: .82rem; white-space: nowrap; }
.attempt-item .att-del { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .2rem; }
.attempt-item .att-del:hover { color: #e23b3b; }

.practice-comment { width: 100%; margin-top: .3rem; min-height: 3.4rem; resize: vertical; }
.practice-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }

/* Statistik */
.stats-grid { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: .6rem 0 .3rem; }
.stat { display: flex; flex-direction: column; }
.stat .stat-val { font-size: 1.15rem; font-weight: 700; }
.stat .stat-val.reached { color: #4caf50; }
.stat .stat-lbl { font-size: .78rem; color: var(--text-dim); }
.stat-chart { width: 100%; height: auto; margin-top: .2rem; display: block; }

/* Training-Übersicht */
.training-list { display: flex; flex-direction: column; gap: .6rem; }
.training-group-title { font-weight: 650; margin: .5rem 0 .1rem; }
.ts-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem;
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 8px; padding: .6rem .8rem;
}
.ts-item .ts-name { font-weight: 650; flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.ts-badge { font-size: .74rem; padding: .08rem .5rem; border-radius: 999px; border: 1px solid var(--line); }
.ts-badge.open { color: #4caf50; border-color: rgba(76,175,80,.45); }
.ts-badge.finished { color: var(--text-dim); }
.ts-item .ts-meta { color: var(--text-dim); font-size: .82rem; flex-basis: 100%; }
.ts-item .ts-actions { display: flex; gap: .4rem; margin-left: auto; }

/* ---------- Kommentare ---------- */
.comment-list { list-style: none; margin: .4rem 0 .8rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.comment-item { background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; }
.comment-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .2rem; }
.comment-author { font-weight: 650; }
.comment-author.former { color: var(--text-dim); font-style: italic; font-weight: 500; }
.comment-date { color: var(--text-dim); font-size: .8rem; }
.comment-del { margin-left: auto; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: .95rem; line-height: 1; padding: 0 .2rem; }
.comment-del:hover { color: #e23b3b; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.comment-form textarea { width: 100%; min-height: 3.4rem; resize: vertical; }
.comment-login { color: var(--text-dim); }

/* Kommentar-Icon in der Übungsliste */
.ex-comments { display: inline-flex; align-items: center; gap: .2rem; color: var(--text-dim); font-size: .82rem; }
.ex-comments svg { width: 14px; height: 14px; fill: currentColor; }

/* Gefahrenzone im Profil */
.danger-zone { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.danger-zone h3 { margin: 0 0 .3rem; font-size: 1rem; color: #ffb3b0; }
.danger-zone p { font-size: .85rem; margin: 0 0 .5rem; }
.danger-zone label { display: block; margin-bottom: .5rem; }

/* Profil-Modal: breiter, Abschnitte als Karten in bis zu 2 Spalten (weniger Scrollen) */
.profile-modal { width: min(760px, 100%); }
/* Tabs im Profil-Modal nutzen dasselbe Design wie die Editor-Tabs (.tab-bar/.tab-btn) */
.profile-tab-bar { flex-wrap: wrap; margin: .2rem 0 .3rem; }
/* Persönliches Dashboard */
.dash-grid { display: grid; gap: .8rem; }
@media (min-width: 620px) { .dash-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.dash-card {
  border: 1px solid var(--line); border-radius: 10px; padding: .75rem;
  display: grid; gap: .45rem; align-content: start;
}
.dash-card h3 { margin: 0; font-size: .95rem; }
.dash-list { display: grid; gap: .35rem; }
.dash-item {
  display: grid; gap: .1rem; padding: .45rem .55rem; border-radius: 8px; text-decoration: none;
  background: var(--bg-inset); border: 1px solid var(--line); color: var(--text);
}
a.dash-item:hover { border-color: var(--accent); }
.dash-main { font-size: .88rem; font-weight: 600; overflow-wrap: anywhere; }
.dash-meta { font-size: .76rem; }
.dash-pager { display: flex; align-items: center; justify-content: center; gap: .6rem; }
.dash-pager .ghost-btn { padding: .3rem .6rem; font-size: .8rem; }
.profile-grid { display: grid; gap: .8rem; }
@media (min-width: 560px) { .profile-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.profile-card {
  border: 1px solid var(--line); border-radius: 10px; padding: .85rem;
  display: grid; gap: .5rem; align-content: start; margin: 0;
}
.profile-card h3 { margin: 0; font-size: .95rem; }
.profile-card p { font-size: .85rem; margin: 0; }
.profile-card label { display: block; }
.profile-card #profile-form { display: grid; gap: .5rem; }
.profile-card.danger-zone { margin-top: 0; padding-top: .85rem; }
.profile-card.danger-zone h3 { color: #ffb3b0; }
#profile-email-status { color: var(--accent-strong); }

/* Optionale E-Mail bei der Registrierung + „Passwort vergessen" */
.email-row .email-hint { display: block; margin-top: .25rem; font-size: .8rem; }
.auth-forgot-row { text-align: right; margin-top: -.3rem; }
.linklike {
  background: none; border: none; padding: .1rem 0; cursor: pointer; font: inherit;
  color: var(--accent-strong); text-decoration: underline;
}
.linklike:hover { color: var(--text); }
.fp-ok { color: var(--ok); }

/* ---------- Admin-Modal (Benutzerverwaltung) ---------- */
.admin-modal { width: min(880px, 100%); }
.admin-search { display: flex; gap: .5rem; }
.admin-search input { flex: 1 1 auto; }
.admin-users { display: grid; gap: .4rem; }
.admin-user-row {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  width: 100%; text-align: left; background: var(--bg-inset);
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .75rem;
  color: var(--text); cursor: pointer; font: inherit;
}
.admin-user-row:hover { border-color: var(--accent); }
.admin-user-main { display: grid; gap: .1rem; min-width: 0; }
.admin-user-name { font-weight: 600; }
.admin-user-meta { font-size: .78rem; }
.admin-user-stats { display: flex; flex-wrap: wrap; gap: .1rem .7rem; font-size: .82rem; white-space: nowrap; }
.admin-badge {
  display: inline-block; font-size: .68rem; font-weight: 600; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 999px; padding: 0 .4rem; margin-left: .3rem;
  color: var(--text-dim);
}
.admin-badge.is-admin { border-color: var(--accent); color: var(--accent-strong); }
.admin-badge.is-deleted { border-color: var(--danger); color: #ffb3b0; }
.admin-pager { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: .3rem; }
.admin-detail-head h3 { margin: 0 0 .2rem; }
.admin-detail-head p { margin: 0; font-size: .82rem; }
.admin-section { border: 1px solid var(--line); border-radius: 8px; margin-top: .6rem; }
.admin-section > summary { cursor: pointer; padding: .5rem .7rem; font-weight: 600; }
.admin-section-body { padding: 0 .7rem .5rem; display: grid; gap: .3rem; }
.admin-item {
  display: flex; justify-content: space-between; gap: .8rem; font-size: .85rem;
  padding: .3rem 0; border-top: 1px solid var(--line); min-width: 0;
}
.admin-item > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.admin-item > span:last-child { white-space: nowrap; }
.admin-actions { display: grid; gap: .8rem; margin-top: 1rem; }
@media (min-width: 560px) { .admin-actions { grid-template-columns: 1fr 1fr; align-items: start; } }
.admin-back { margin-bottom: .6rem; }

/* ---------- Benachrichtigungen (Glocke + Panel) ---------- */
.notif-bell { position: relative; padding: .35rem .5rem; line-height: 0; }
.notif-bell svg { width: 20px; height: 20px; fill: currentColor; }
.notif-badge {
  position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .66rem; font-weight: 700;
  line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--bg-raised);
}
.notif-modal { width: min(520px, 100%); }
.notif-list { display: grid; gap: .4rem; max-height: 60vh; overflow-y: auto; }
.notif-item {
  display: flex; align-items: stretch; gap: .3rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg-inset); overflow: hidden;
}
.notif-item.is-read { opacity: .62; }
.notif-go {
  flex: 1 1 auto; display: flex; align-items: flex-start; gap: .6rem; min-width: 0;
  background: transparent; border: 0; color: var(--text); text-align: left; cursor: pointer;
  padding: .55rem .7rem; font: inherit;
}
.notif-go:hover { background: rgba(79,155,220,.1); }
.notif-ico { font-size: 1.05rem; line-height: 1.3; flex: 0 0 auto; }
.notif-main { display: grid; gap: .12rem; min-width: 0; }
.notif-text { overflow-wrap: anywhere; }
.notif-time { font-size: .76rem; }
.notif-item:not(.is-read) .notif-text { font-weight: 600; }
.notif-x {
  flex: 0 0 auto; background: transparent; border: 0; border-left: 1px solid var(--line);
  color: var(--text-dim); cursor: pointer; padding: 0 .6rem; font-size: .95rem;
}
.notif-x:hover { color: #ffb3b0; }
.notif-foot { display: flex; justify-content: flex-end; margin-top: .2rem; }

/* ---------- Tabs (Übung/Kommentare & Practice) ---------- */
.tab-bar { display: flex; gap: .4rem; margin-bottom: .7rem; }
.tab-btn {
  background: var(--bg-inset); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 8px; padding: .5rem 1.05rem; font-weight: 600;
}
.tab-btn:hover { color: var(--text); border-color: var(--accent); }
.tab-btn.active { background: var(--bg-raised); color: var(--accent-strong); border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel .card + .card { margin-top: 1rem; }

/* ---------- Practice: zwei Spalten + abgeschlossene Sessions ---------- */
.practice-cols { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-start; }
.practice-col { flex: 1 1 240px; min-width: 0; }
.fin-list { list-style: none; margin: .3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; max-height: 42vh; overflow: auto; }
.fin-item {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: .15rem;
  background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
  padding: .5rem .65rem; cursor: pointer; color: var(--text); font: inherit;
}
.fin-item:hover { border-color: var(--accent); }
.fin-date { font-weight: 650; }
.fin-sum { color: var(--text-dim); font-size: .82rem; }
/* Kommentar abgeschlossener Sessions in der Trainings-Übersicht */
.ts-comment {
  flex-basis: 100%; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: .85rem; color: var(--text-dim);
  border-left: 2px solid var(--line); padding-left: .5rem; margin-top: .1rem;
}

/* ---------- Foto-Import („Spielsituation aufnehmen") ---------- */
.photo-modal { width: min(1020px, 100%); }   /* Lupe liegt außerhalb -> Modal darf größer sein */
#ph-canvas1 {
  max-width: 100%; max-height: 62vh; display: block; margin: 0 auto;
  border-radius: 8px; touch-action: none; cursor: crosshair; background: #0b0e13;
}
#ph-drop {
  display: grid; place-items: center; min-height: 180px;
  border: 2px dashed var(--line); border-radius: 10px;
}
#ph-stage { position: relative; max-width: 100%; margin: 0 auto; }
#ph-canvas2 { display: block; width: 100%; height: auto; border-radius: 8px; background: #10141a; }
#ph-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  touch-action: none; cursor: crosshair;
}
/* Zoom-Lupe beim Ecken-Abstecken und Kugel-Platzieren (der Finger verdeckt sonst die
   Stelle). Liegt AUSSERHALB der Modal-Box am linken oberen Bildschirmrand (der Backdrop
   ist ihr Containing Block und deckt den Viewport); weicht nach rechts aus, wenn der
   Finger in ihre Nähe kommt. */
#ph-zoom {
  position: fixed; top: 10px; left: 10px; width: min(42vw, 300px); height: auto;
  aspect-ratio: 1 / 1; border: 2px solid rgba(121, 193, 255, .85); border-radius: 10px;
  background: #0b0e13; pointer-events: none; z-index: 10;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
#ph-zoom.right { left: auto; right: 10px; }
.ph-pal { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; }
#ph-addball.on { background: rgba(79,155,220,.28); border-color: var(--accent); color: var(--accent-strong); }
.ph-replace { display: flex; gap: .45rem; align-items: center; font-size: .85rem; }
.ph-row { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }

/* ---------- Startseite (Übersicht / Landing) ---------- */
.home-body { display: flex; flex-direction: column; min-height: 100vh; }
/* Landing: animierter Wireframe-Billardtisch hinter dem Inhalt (js/landing-bg.js).
   z-index -1 legt das Canvas über den Seiten-Verlauf, aber hinter alle Inhalte. */
.home-bg-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -1; pointer-events: none;
}
.home {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.4rem; padding: 2rem 1rem; max-width: 1100px; margin: 0 auto; width: 100%;
}
.home-lead { font-size: 1.05rem; margin: 0; }
.home-tiles { display: flex; gap: 1.2rem; justify-content: center; width: 100%; }
.home-tile {
  flex: 1 1 0; max-width: 300px; min-height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .7rem; padding: 1.6rem 1.2rem; text-align: center;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text); text-decoration: none;
  transition: border-color .15s, transform .12s, background .15s;
  position: relative;
}
.home-tile:hover { border-color: var(--accent); transform: translateY(-3px); background: #202632; }
.home-tile svg { width: 64px; height: 64px; flex: 0 0 auto; color: var(--accent-strong); }
.home-tile-title { font-size: 1.15rem; font-weight: 650; letter-spacing: .02em; }
.home-tile-desc { font-size: .85rem; }
.home-tile.disabled { opacity: .55; cursor: not-allowed; }
.home-tile.disabled:hover { border-color: var(--line); transform: none; background: var(--bg-raised); }
.home-wip {
  position: absolute; top: .7rem; right: .7rem;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .1em;
  padding: .2rem .5rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--text-dim); background: var(--bg-inset);
}
@media (max-width: 720px) {
  .home { justify-content: flex-start; gap: 1rem; padding: 1.4rem 1rem; }
  .home-tiles { flex-direction: column; align-items: stretch; }
  /* Kacheln nach Inhalt (nicht flex:1 aus der Basisregel -> sonst Höhe 0 & Icons weg),
     Symbol etwas kleiner */
  .home-tile { flex: 0 0 auto; max-width: none; min-height: 0; padding: 1.1rem 1rem; gap: .5rem; }
  .home-tile svg { width: 44px; height: 44px; }
  .home-tile-title { font-size: 1.05rem; }
}
