/* Lern-Dashboard 2 – Design-Tokens und Grundgeruest. Dark ist Standard, Light ueber html[data-theme=light]. */
:root {
  --bg: #0f1218; --bg2: #151a23; --bg3: #1c2230; --bg4: #232a3a; --line: #242b3a;
  --fg: #e6e9f0; --fg2: #9aa3b8; --fg3: #5f6880;
  --accent: #6f86ff; --accent-fg: #fff; --ok: #35c48a; --warn: #e9b44c; --bad: #f06464;
  --l0: #f06464; --l1: #e8813f; --l2: #e9b44c; --l3: #c9c33f; --l4: #7fbf4f; --l5: #35c48a;
  --gold: #d9a93a;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif; --disp: "Sora", "Segoe UI", system-ui, sans-serif;
  --radius: 12px; --side-w: 220px; --rail-w: 250px; --nav-h: 64px;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f4f5f9; --bg2: #ffffff; --bg3: #eceef4; --bg4: #e1e4ec; --line: #dfe3ec;
  --fg: #1a1e2a; --fg2: #5b6275; --fg3: #8a91a5;
  --accent: #4f66e6; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(20,24,40,.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--fg); background: var(--bg); -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--disp); margin: 0; font-weight: 600; line-height: 1.2; }
h1 { font-size: 18px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0 0 .6em; }
.muted { color: var(--fg2); } .small { font-size: 12px; } .faint { color: var(--fg3); }
.disp { font-family: var(--disp); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Layout ------------------------------------------------------------ */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--side-w); flex: 0 0 auto; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-family: var(--disp); font-weight: 600; font-size: 15px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font: 700 13px var(--disp); }
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--fg2); font-weight: 500; font-size: 13.5px; }
.sidenav a:hover { background: var(--bg3); color: var(--fg); }
.sidenav a.active { background: var(--bg3); color: var(--fg); font-weight: 600; }
.sidenav a .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px; line-height: 18px; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.feedback-btn { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--fg2); font-size: 13px; font-weight: 500; border: 1px dashed var(--line); background: transparent; cursor: pointer; width: 100%; text-align: left; }
.feedback-btn:hover { color: var(--fg); border-color: var(--fg3); }
.rank-mini { display: flex; align-items: center; gap: 12px; padding: 6px 10px; cursor: pointer; border-radius: 8px; }
.rank-mini:hover { background: var(--bg3); }
.rank-mini .name { font-family: var(--disp); font-size: 13px; font-weight: 600; }
.rank-mini .rm-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rank-mini .rm-top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.rank-mini .rm-top .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-streak { margin-left: auto; display: inline-flex; align-items: center; gap: 1px; font-size: 11px; font-weight: 600; color: var(--warn); align-self: center; white-space: nowrap; }
.rank-prog { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rp-bar { height: 6px; border-radius: 999px; background: var(--bg4); overflow: hidden; }
.rp-bar > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff)); transition: width .5s ease; }
.rp-txt { font-size: 11px; line-height: 1.3; color: var(--fg3); }
.stat .rank-prog { margin-top: 6px; }
.me-mini { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg3); }
.me-mini .name { font-weight: 600; font-size: 13px; } .me-mini .sub { font-size: 12px; color: var(--fg3); }
.page { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); min-height: 61px; }
.page-sub { font-size: 13px; color: var(--fg3); }
.search-box { margin-left: auto; display: flex; align-items: center; gap: 8px; width: 280px; height: 36px; padding: 0 12px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); color: var(--fg3); font-size: 13px; cursor: pointer; }
.search-box kbd { margin-left: auto; font: 11px var(--font); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); color: var(--fg2); display: inline-flex; align-items: center; justify-content: center; position: relative; cursor: pointer; flex: 0 0 auto; }
.icon-btn:hover { color: var(--fg); }
.icon-btn .badge { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--bg2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg3); flex: 0 0 auto; }
.dot.live { background: var(--ok); } .dot.poll { background: var(--warn); }
.body { flex: 1; display: flex; min-height: 0; position: relative; }
.main { flex: 1; min-width: 0; padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 16px; }
.rail { width: var(--rail-w); flex: 0 0 auto; border-left: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; height: calc(100vh - 61px); overflow: auto; }
.rail.collapsed { width: 0; border: 0; overflow: hidden; }
.chat-panel { position: fixed; top: 61px; bottom: 0; right: var(--rail-w); width: 340px; background: var(--bg2); border-left: 1px solid var(--line); box-shadow: -16px 0 40px rgba(0,0,0,.55); z-index: 5; display: flex; flex-direction: column; }
.bottom { display: none; }

/* Karten, Knoepfe, Felder ------------------------------------------- */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3 { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg3); color: var(--fg); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--fg3); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.bad { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--fg2); }
.field > span { font-weight: 500; }
.field input, .field select, .field textarea, .input { height: 38px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 0 10px; color: var(--fg); font-size: 13.5px; outline: none; width: 100%; }
.field textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 140px; }
.err { color: var(--bad); font-size: 13px; }
.tag { font-size: 12px; color: var(--fg2); background: var(--bg3); padding: 2px 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--subj, var(--accent)) 14%, transparent); color: var(--subj, var(--accent)); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--subj, var(--accent)); }
.avatar { width: 30px; height: 30px; border-radius: 8px; color: #fff; display: inline-flex; align-items: center; justify-content: center; font: 600 11px var(--disp); flex: 0 0 auto; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; border-radius: 12px; }
.avatar.sm { width: 24px; height: 24px; font-size: 9px; border-radius: 6px; }
.badge-hex { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #f2cf6b, #c9901f); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); color: #3a2604; font: 700 12px var(--disp); width: 38px; height: 42px; flex: 0 0 auto; }
.badge-hex.bronze { background: linear-gradient(160deg, #d9a27a, #8a5a2f); color: #2e1a08; }
.badge-hex.silber { background: linear-gradient(160deg, #e6eaf2, #8f98ad); color: #202433; }
.badge-hex.platin { background: linear-gradient(160deg, #cdeef3, #5aa7b8); color: #0e2c33; }
.badge-hex.diamant { background: linear-gradient(160deg, #cfd9ff, #6f86ff); color: #14204d; }
.badge-hex.meister { background: linear-gradient(160deg, #f0b6ff, #8a3fd6); color: #2a0b45; }
.empty { padding: 28px 16px; text-align: center; color: var(--fg3); border: 1px dashed var(--line); border-radius: var(--radius); font-size: 13px; }
.empty strong { display: block; color: var(--fg2); margin-bottom: 4px; font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; font-size: 13.5px; }
.list .meta { font-size: 12px; color: var(--fg3); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.switch { width: 40px; height: 22px; border-radius: 999px; background: var(--bg4); border: 1px solid var(--line); position: relative; cursor: pointer; flex: 0 0 auto; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.4); transition: left .15s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { left: 20px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg3); display: inline-block; flex: 0 0 auto; }
.status-dot.learn { background: var(--ok); } .status-dot.write { background: var(--warn); } .status-dot.online { background: var(--ok); }

/* Menue unten links, Chat-Blasen, Farbwahl -------------------------- */
.side-bottom { position: relative; }
.me-mini { cursor: pointer; }
.me-mini .ic { margin-left: auto; color: var(--fg3); }
.popover { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 30; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font-size: 13px; text-align: left; color: var(--fg); }
.pop-item:hover { background: var(--bg3); }
.pop-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.bubble { padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.45; background: var(--bg3); color: var(--fg); max-width: 100%; }
.bubble.rainbow { background: linear-gradient(120deg, #ff5f6d, #ffc371, #5df2a5, #4fc3ff, #b06bff, #ff5f6d); background-size: 300% 300%; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); animation: rainbow 4s linear infinite; }
@keyframes rainbow { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; outline: 2px solid transparent; outline-offset: 2px; }
.swatch.sel { outline-color: var(--fg); }
.swatch.none { background: var(--bg3); color: var(--fg2); font-weight: 600; }
.swatch.rainbow { background: conic-gradient(#ff5f6d, #ffc371, #5df2a5, #4fc3ff, #b06bff, #ff5f6d); }
.swatch-custom { width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0; background: none; cursor: pointer; }

/* Mitglieder-Leiste ------------------------------------------------- */
.rail-head { padding: 16px 16px 8px; display: flex; justify-content: space-between; align-items: center; }
.rail-list { padding: 0 10px; display: flex; flex-direction: column; gap: 2px; }
.rail-more { margin: 2px 0 0; padding: 6px 8px; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; }
.rail-more:hover { background: var(--bg3); }
.member { display: flex; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 8px; cursor: pointer; }
.member:hover { background: var(--bg3); }
.member.learn { background: color-mix(in srgb, var(--ok) 8%, transparent); }
.member .av { position: relative; }
.member .av .status-dot { position: absolute; right: -2px; bottom: -2px; border: 2px solid var(--bg2); box-sizing: content-box; }
.member .name { font-weight: 600; font-size: 13px; }
.member .st { font-size: 12px; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member .st.learn { color: var(--ok); } .member .st.write { color: var(--warn); }
.rail-section { margin: 14px 16px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.rail-section h3 { margin-bottom: 8px; }

/* Modal, Toast ------------------------------------------------------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px 14px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 20px; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { flex: 1; }
.modal .form { display: flex; flex-direction: column; gap: 12px; }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--bg4); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow); animation: fade .2s; }
.toast.err { border-color: var(--bad); color: var(--bad); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--fg3); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login ------------------------------------------------------------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 400px; padding: 28px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }

/* Tabellen (Admin) -------------------------------------------------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--fg3); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl-wrap { overflow-x: auto; }

/* Handy ------------------------------------------------------------- */
@media (min-width: 700px) {
  .modal-bg { align-items: center; padding: 16px; }
  .modal { border-radius: 14px; }
}
@media (max-width: 1100px) { .rail { display: none; } .chat-panel { right: 0; } }
@media (max-width: 900px) {
  .sidebar { display: none; }
  .top { padding: 10px 16px; min-height: 54px; }
  .search-box { width: 36px; padding: 0; justify-content: center; }
  .search-box span, .search-box kbd { display: none; }
  .main { padding: 14px 14px 100px; }
  .grid2 { grid-template-columns: 1fr; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 8px 6px calc(10px + env(safe-area-inset-bottom)); background: var(--bg2); border-top: 1px solid var(--line); justify-content: space-around; z-index: 20; }
  .bottom a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--fg3); min-width: 56px; position: relative; }
  .bottom a.active { color: var(--accent); }
  .bottom a .count { position: absolute; top: -4px; right: 6px; background: var(--accent); color: #fff; font-size: 10px; padding: 0 5px; border-radius: 999px; line-height: 16px; }
  .chat-panel { top: 0; left: 0; right: 0; width: auto; }
  #toasts { bottom: calc(var(--nav-h) + 16px); }
}

/* Editor ------------------------------------------------------------ */
.editor { display: flex; flex-direction: column; gap: 10px; }
.ed-head { display: flex; align-items: center; gap: 10px; }
.ed-sel { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.ed-sel select { height: 34px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 0 8px; color: var(--fg); font-size: 13px; max-width: 220px; }
.ed-title { height: 42px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 0 12px; color: var(--fg); font: 600 16px var(--disp); outline: none; width: 100%; }
.ed-title:focus, .ed-body:focus { border-color: var(--accent); }
.ed-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); flex-wrap: wrap; }
.ed-toolbar .tb { width: 30px; height: 30px; border-radius: 6px; border: 0; background: transparent; color: var(--fg2); font: 600 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ed-toolbar .tb:hover { background: var(--bg3); color: var(--fg); }
.ed-toolbar .tb.wide { width: auto; padding: 0 8px; }
.ed-toolbar .tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.ed-toolbar .only-mobile { display: none; }
.ed-body { min-height: 280px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 12px 14px; color: var(--fg); font: 14px/1.6 var(--font); resize: vertical; outline: none; width: 100%; }
.ed-body.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.editor.compact .ed-body { min-height: 220px; }
.att-box, .tags-box { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.att-box:empty { display: none; }
.tag .x { border: 0; background: transparent; color: var(--fg3); cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; }
.tag-in { height: 26px; border: 1px dashed var(--line); background: transparent; border-radius: 6px; padding: 0 8px; color: var(--fg); font-size: 12px; width: 120px; outline: none; }
.tag-in:focus { border-color: var(--accent); border-style: solid; }
.sugg { position: absolute; left: 0; top: 30px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 20; min-width: 160px; padding: 4px; }
.sugg-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--fg); }
.sugg-item:hover { background: var(--bg3); }
.ed-foot { display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ed-foot .actions { margin-left: auto; }
.vis { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vis-lbl { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--fg3); }
.vis-lbl.active { color: var(--fg); }
.vis-people { font-size: 12px; color: var(--fg3); border-bottom: 1px dotted var(--fg3); margin-left: 4px; }
.vis-people.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.people { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.person:hover { background: var(--bg3); }
.vis-opt { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; }
.vis-opt.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.vis-opt .title { font-weight: 600; }

/* Feed, Notiz ------------------------------------------------------- */
.feed { display: flex; flex-direction: column; gap: 10px; }
.note-card { display: flex; gap: 12px; padding: 14px 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); }
.note-card:hover { border-color: var(--fg3); }
.feed-card .note-card { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 12px 0; background: transparent; }
.feed-card .note-card:first-child { border-top: 0; padding-top: 4px; }
.note-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--fg3); flex-wrap: wrap; }
.note-meta .who { font-weight: 600; color: var(--fg2); }
.note-meta .sp, .note-foot .sp { flex: 1; }
.note-title { font-weight: 600; font-size: 14px; margin-top: 3px; }
.note-snippet { color: var(--fg2); font-size: 13px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-foot { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.note-foot .cnt { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--fg3); }
.note-foot .cnt.on { color: var(--bad); }
.vis-tag { padding: 1px 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select { height: 36px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 0 10px; color: var(--fg); font-size: 13px; }
.filters input:first-child { flex: 1 1 260px; }
.seg { display: inline-flex; gap: 2px; background: var(--bg3); padding: 2px; border-radius: 8px; }
.seg button { border: 0; background: transparent; color: var(--fg2); padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--bg2); color: var(--fg); }
.seg.wrap { flex-wrap: wrap; }
.note-page { display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.note-h1 { font-size: 24px; margin: 10px 0 14px; }
.md { font-size: 15px; line-height: 1.65; }
.md img { max-width: 100%; border-radius: 8px; cursor: zoom-in; }
.md pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow: auto; }
.md code { background: var(--bg3); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--accent); margin: 8px 0; padding: 4px 12px; color: var(--fg2); background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 0 8px 8px 0; }
.md table { border-collapse: collapse; } .md th, .md td { border: 1px solid var(--line); padding: 4px 8px; }
.md li.task { list-style: none; margin-left: -18px; }
.md h1 { font-size: 20px; margin: 16px 0 6px; } .md h2 { font-size: 17px; margin: 14px 0 6px; } .md h3 { font-size: 15px; margin: 12px 0 4px; }
.note-article .actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.btn.on-heart { color: var(--bad); border-color: var(--bad); }
.att-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.att { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: var(--bg3); font-size: 13px; width: fit-content; }
.comments { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.comment { display: flex; gap: 10px; }
.comment .md { font-size: 14px; }
.comment.deleted { opacity: .6; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { flex: 1; min-height: 44px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 10px; color: var(--fg); font: 13.5px var(--font); resize: vertical; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 70; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 96vw; max-height: 86vh; border-radius: 6px; }
.lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: #fff; font-size: 13px; }
.lb-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Faecher ----------------------------------------------------------- */
.subj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.subj-card { display: flex; flex-direction: column; gap: 14px; border-top: 3px solid var(--subj); }
.subj-card:hover { border-color: var(--fg3); border-top-color: var(--subj); }
.subj-top { display: flex; gap: 12px; align-items: center; }
.subj-icon { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.subj-icon.ph { display: inline-flex; align-items: center; justify-content: center; color: #fff; font: 700 15px var(--disp); }
.subj-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cnt-box { text-align: center; padding: 6px 0; border-radius: 8px; background: var(--bg3); }
.cnt-box .n { font-size: 16px; font-weight: 700; }
.subj-head { border-top: 3px solid var(--subj); display: flex; flex-direction: column; gap: 12px; }

/* Schnellsuche, Benachrichtigungen ---------------------------------- */
.palette-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette { width: 100%; max-width: 620px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.palette-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--fg3); }
.palette-in { flex: 1; border: 0; background: transparent; color: var(--fg); font-size: 15px; outline: none; height: 32px; }
.palette-head kbd { font: 11px var(--font); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.palette-res { max-height: 60vh; overflow: auto; padding: 6px; }
.pal-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--fg); }
.pal-item.sel { background: var(--bg3); }
.pal-row { display: flex; gap: 10px; align-items: center; }
.pal-row .title { font-weight: 600; font-size: 13.5px; }
.notif-pop { position: absolute; right: 0; top: calc(100% + 6px); bottom: auto; left: auto; width: 360px; max-width: calc(100vw - 32px); padding: 0; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 60vh; overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.notif { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--fg); }
.notif:hover { background: var(--bg3); }
.notif.unread { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.notif .title { font-weight: 600; font-size: 13px; }
@media (max-width: 900px) { .ed-toolbar .only-mobile { display: inline-flex; } .subj-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ed-foot .actions { width: 100%; } .ed-foot .actions .btn { flex: 1; } }

/* Dateien, Tafel, Vorschau ------------------------------------------ */
.dropzone { display: flex; align-items: center; gap: 16px; padding: 18px; border: 2px dashed var(--line); border-radius: 12px; color: var(--fg2); flex-wrap: wrap; }
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.dropzone .actions { margin-left: auto; }
.only-mobile { display: none; }
.fthumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--bg3); flex: 0 0 auto; }
.fthumb.ph { display: flex; align-items: center; justify-content: center; font: 700 11px var(--disp); color: var(--fg2); }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.photo { background: var(--bg3); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; cursor: zoom-in; background: #000; }
.photo-meta { display: flex; gap: 8px; align-items: center; padding: 8px 10px 0; flex-wrap: wrap; }
.photo .actions { padding: 8px 10px 10px; }
.viewer { position: fixed; inset: 0; background: #202329; z-index: 70; display: flex; flex-direction: column; }
.viewer .lb-bar { position: static; background: var(--bg2); border-bottom: 1px solid var(--line); color: var(--fg); }
.viewer-stage { flex: 1; overflow: auto; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.viewer-stage canvas.page { background: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.5); max-width: 100%; }
.viewer-text { white-space: pre-wrap; font: 13px ui-monospace, monospace; color: var(--fg); background: var(--bg2); padding: 16px; border-radius: 8px; width: 100%; max-width: 900px; }
@media (max-width: 900px) { .only-mobile { display: inline-flex; } .dropzone .actions { margin-left: 0; width: 100%; } }

/* Rangliste, Duell, Lernzeit ---------------------------------------- */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: grid; grid-template-columns: 28px 30px minmax(0, 1fr) 30px 90px minmax(60px, 160px) 70px 70px; gap: 10px; align-items: center; padding: 8px 6px; border-top: 1px solid var(--line); }
.rank-list li:first-child { border-top: 0; }
.rank-list li.me { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 8px; }
.rank-list .place { font: 700 13px var(--disp); color: var(--fg3); text-align: center; }
.rank-list .place.top1 { color: #e0b64a; } .rank-list .place.top2 { color: #b8c0d4; } .rank-list .place.top3 { color: #c98d5a; }
.rank-list .name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .bar, .duel-row .bar { height: 6px; border-radius: 999px; background: var(--bg3); overflow: hidden; display: block; }
.rank-list .bar > span, .duel-row .bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.rank-list .xp { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-list .time { text-align: right; }
.badge-hex.xs { width: 24px; height: 27px; font-size: 9px; }
.badge-hex.big { width: 84px; height: 94px; font-size: 26px; }
.duel-row { display: grid; grid-template-columns: 24px 90px 1fr 70px; gap: 10px; align-items: center; }
.duel-row .time { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.duel-row.lead .bar > span { background: var(--ok); }
.celebrate { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; }
.burst { position: relative; padding: 16px; animation: pop .6s cubic-bezier(.2, 1.4, .4, 1); }
.burst::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--gold) 45%, transparent), transparent 70%); animation: glow 1.6s ease-out infinite alternate; z-index: -1; }
@keyframes pop { from { transform: scale(.4) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes glow { from { transform: scale(.8); opacity: .5; } to { transform: scale(1.3); opacity: 1; } }
#study-mini { font-size: 11px; color: var(--fg3); display: flex; gap: 5px; align-items: center; padding: 0 10px 4px; }
@media (max-width: 900px) { .rank-list li { grid-template-columns: 24px 30px minmax(0, 1fr) 60px; } .rank-list .rname, .rank-list .bar, .rank-list .time, .rank-list li .badge-hex { display: none; } }

/* Profil ------------------------------------------------------------ */
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat { background: var(--bg3); border-radius: 8px; padding: 10px 12px; }
.stat .v { font: 600 16px var(--disp); }

/* Chat --------------------------------------------------------------- */
.chat-handle { position: fixed; right: var(--rail-w); top: 77px; width: 28px; height: 96px; border: 0; border-radius: 8px 0 0 8px; background: var(--accent); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; box-shadow: -4px 0 12px rgba(0,0,0,.35); z-index: 6; }
.chat-handle.open { background: var(--bg3); color: var(--fg2); }
.chat-handle .lbl { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.chat-handle .count, .chat-fab .count { background: #fff; color: var(--accent); font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 999px; line-height: 15px; }
.chat-fab { display: none; position: fixed; right: 16px; bottom: calc(var(--nav-h) + 24px); width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(0,0,0,.5); z-index: 25; cursor: pointer; }
.chat-fab .count { position: absolute; top: -2px; right: -2px; background: var(--bad); color: #fff; border: 2px solid var(--bg); line-height: 16px; }
.chat-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-tabs { display: flex; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: 0 0 auto; }
.chat-tab { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 6px; border: 0; background: transparent; color: var(--fg2); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chat-tab.on { background: var(--bg3); color: var(--fg); }
.chat-tab .count, .chat-item .count { background: var(--accent); color: #fff; font-size: 10px; padding: 0 5px; border-radius: 999px; line-height: 16px; }
.chat-tab.add { color: var(--fg3); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.system { align-self: center; font-size: 12px; color: var(--fg3); background: var(--bg3); padding: 3px 10px; border-radius: 999px; max-width: 100%; }
.msg-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.msg.mine .msg-body { align-items: flex-end; }
.msg-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--fg3); }
.msg-meta .who { font-weight: 600; color: var(--fg2); }
.msg-del { border: 0; background: transparent; color: var(--fg3); cursor: pointer; padding: 0; display: inline-flex; opacity: 0; }
.msg:hover .msg-del { opacity: 1; }
.msg-react { border: 0; background: transparent; color: var(--fg3); cursor: pointer; padding: 0; display: inline-flex; opacity: 0; }
.msg:hover .msg-react, .msg-react:focus-visible { opacity: 1; }
.msg-react:hover { color: var(--fg); }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 1px; }
.react { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg3); color: var(--fg2); font-size: 13px; line-height: 1; cursor: pointer; }
.react .n { font-size: 11px; font-weight: 600; }
.react.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--bg3)); color: var(--fg); }
.react-pop { position: fixed; z-index: 60; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 4px; animation: fade .12s; }
.react-pop .emojis { display: flex; gap: 2px; }
.react-pop .emojis button { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; font-size: 20px; line-height: 1; cursor: pointer; padding: 0; }
.react-pop .emojis button:hover, .react-pop .emojis button.on { background: var(--bg3); }
.react-pop .acts { display: flex; gap: 2px; border-top: 1px solid var(--line); padding-top: 4px; }
.react-pop .acts:empty { display: none; }
.react-pop .pop-item { width: auto; flex: 1; justify-content: center; }
.react-pop .pop-item.bad { color: var(--bad); }
/* Touch: langes Druecken oeffnet das Menue, daher kein Text-Markieren/iOS-Vorschau und keine Hover-Knoepfe */
@media (hover: none) and (pointer: coarse) {
  .chat-msgs .msg-body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .msg-react, .msg-del { display: none; }
}
.bubble.me { background: var(--accent); color: #fff; }
.bubble.deleted { opacity: .6; font-style: italic; }
.bubble p { margin: 0; } .bubble p + p { margin-top: 6px; }
.bubble .mention { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.msg.mentioned .bubble { outline: 1px solid var(--accent); }
.msg.cont { margin-top: -6px; }
.avatar.spacer { visibility: hidden; }
.msg.cont .msg-body { position: relative; }
.msg.cont .msg-meta.cont { position: absolute; top: 4px; right: -20px; }
.msg.cont.mine .msg-meta.cont { right: auto; left: -20px; }
.chat-typing { display: flex; align-items: center; gap: 8px; padding: 2px 14px 6px; font-size: 12px; color: var(--fg3); }
.chat-typing .dots { display: inline-flex; gap: 3px; }
.chat-typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--fg3); animation: typing 1.2s infinite ease-in-out; }
.chat-typing .dots i:nth-child(2) { animation-delay: .2s; } .chat-typing .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-in { width: 100%; min-height: 40px; max-height: 120px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 9px 10px; color: var(--fg); font: 13.5px var(--font); resize: none; outline: none; }
.chat-in:focus { border-color: var(--accent); }
.chat-send { width: 40px; height: 40px; border-radius: 8px; border: 0; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto; }
.mention-sugg { bottom: calc(100% + 4px); top: auto; }
.chat-page { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg2); height: calc(100vh - 61px - 52px); min-height: 420px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.chat-item { display: flex; gap: 8px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); padding: 10px 12px; cursor: pointer; }
.chat-item.on { background: var(--bg3); }
.chat-item .title { font-weight: 600; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .chat-handle { display: none; } .chat-fab { display: flex; } }
@media (max-width: 900px) { .chat-page { grid-template-columns: 1fr; height: auto; } .chat-list { max-height: 200px; border-right: 0; border-bottom: 1px solid var(--line); } .chat-view { height: 70vh; } .chat-fab { display: flex; } }
@media (min-width: 901px) { .chat-fab { bottom: 24px; } }
/* Push ------------------------------------------------------------- */
.push-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.push-card .grow { flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; }
.push-set { display: flex; flex-direction: column; gap: 10px; color: var(--fg); }
.push-prefs { display: flex; flex-direction: column; gap: 6px; }
.push-pref { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 13px; }
.push-pref input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: 0 0 auto; }
.push-pref > span { display: flex; flex-direction: column; }
.push-pref .t { font-weight: 500; }
.push-hint { margin: 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 14%, var(--bg3)); color: var(--fg); }
/* Ungelesen-Trenner im Chat */
.unread-sep { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.unread-sep::before, .unread-sep::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 55%, transparent); }

.chat-close { display: none; }
@media (max-width: 1100px) { .chat-close { display: inline-flex; } }
/* Handy: Panel liegt ueber Navigationsleiste und Chat-Knopf (die haben z-index 20/25 und verdeckten sonst das Eingabefeld/Senden) */
@media (max-width: 900px) {
  .chat-panel { z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  html.chat-open, html.chat-open body { overflow: hidden; }
  html.chat-open .chat-fab, html.chat-page-on .chat-fab { display: none; }
}
/* iOS zoomt beim Fokussieren in Felder mit Schrift unter 16px – auf Touch-Geraeten daher 16px */
@media (max-width: 900px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea, .chat-in { font-size: 16px !important; }
}

/* Ueben ------------------------------------------------------------- */
.quiz { max-width: 820px; display: flex; flex-direction: column; gap: 12px; }
.quiz-head { display: flex; align-items: center; gap: 12px; }
.qcard { display: flex; flex-direction: column; gap: 12px; }
.qhead { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.lvl-badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 5px; color: #fff; font: 700 11px var(--disp); }
.levels { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg3); gap: 1px; }
.level-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 11px; color: var(--fg2); }
.level-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.prompt { font-size: 17px; line-height: 1.5; font-weight: 500; }
.subinfo { padding: 6px 10px; border-left: 3px solid var(--line); }
.options { display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; font-size: 14.5px; min-height: 48px; }
.option:hover:not(:disabled) { border-color: var(--fg3); }
.option .box { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--fg3); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: 0 0 auto; }
.option.multi .box { border-radius: 5px; }
.option.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.option.sel .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.option.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--bg)); }
.option.missed { border-style: dashed; border-color: var(--ok); }
.option.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--bg)); }
.option:disabled { cursor: default; opacity: .95; }
.gap-input { display: inline-block; width: 140px; height: 32px; border: 1px solid var(--line); border-bottom: 2px solid var(--accent); background: var(--bg); border-radius: 6px; padding: 0 8px; color: var(--fg); font-size: 15px; margin: 0 4px; }
.flashcard { min-height: 200px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg3); display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; cursor: pointer; }
.flashcard.flipped { background: color-mix(in srgb, var(--accent) 10%, var(--bg3)); animation: flip .4s; }
.flashcard .answer { font-size: 18px; font-weight: 600; margin-top: 6px; white-space: pre-wrap; }
@keyframes flip { from { transform: rotateY(90deg); } to { transform: none; } }
.quiz-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.feedback { padding: 10px 12px; border-radius: 10px; background: var(--bg3); flex: 1 1 100%; }
.feedback.ok { background: color-mix(in srgb, var(--ok) 14%, var(--bg3)); } .feedback.bad { background: color-mix(in srgb, var(--bad) 14%, var(--bg3)); }
.feedback .lvl { font-size: 12px; color: var(--fg2); margin-right: 8px; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #0b2a1c; font-weight: 600; } .btn.bad.ok { background: none; }
.summary .big { font: 700 48px var(--disp); }
.exam-progress { display: flex; gap: 6px; flex-wrap: wrap; }
.exam-progress span { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; background: var(--bg3); color: var(--fg2); cursor: pointer; }
.exam-progress span.done { background: color-mix(in srgb, var(--accent) 25%, var(--bg3)); color: var(--fg); }
.exam-progress span.cur { outline: 2px solid var(--accent); }
.sketch-wrap .sketch-bar { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.visual { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-top: 6px; }
.visual .qimg { max-width: 320px; max-height: 240px; border-radius: 8px; cursor: zoom-in; }
.visual .sketch, .qvisual svg, .qd-sketch svg { width: 200px; height: 200px; }
.sketch-thumb { margin-left: auto; width: 64px; height: 64px; flex: 0 0 auto; } .sketch-thumb svg { width: 64px; height: 64px; }
.gsk .node { fill: var(--bg2); stroke: var(--accent); } .gsk .lbl { fill: var(--fg); text-anchor: middle; dominant-baseline: central; font-family: var(--font); }
.gsk .edge { stroke: currentColor; fill: none; } .gsk .edge.mark { stroke: var(--bad); } .gsk .arrow path { fill: currentColor; } .gsk .arrow.mark path { fill: var(--bad); }
.gsk .w { fill: var(--fg); paint-order: stroke; stroke: var(--bg2); stroke-width: 4px; text-anchor: middle; font-family: var(--font); }
.ex-tasks { padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.ex-tasks li { display: flex; flex-direction: column; gap: 4px; }
.ex-q { font-weight: 500; }
.ex-tasks .input { max-width: 260px; }
.ex-tasks .input.ok { border-color: var(--ok); } .ex-tasks .input.bad { border-color: var(--bad); }
.ex-result .ok { color: var(--ok); } .ex-result .bad { color: var(--bad); }
.qlist > li { align-items: stretch; }
.qlist.subs { margin-left: 24px; border-left: 2px solid var(--line); padding-left: 12px; }
.qprompt { font-weight: 500; }
.qopts { margin: 0; padding-left: 18px; font-size: 13px; color: var(--fg2); }
.qopts li.ok { color: var(--ok); font-weight: 600; }
.qvisual { display: flex; gap: 10px; align-items: flex-start; } .qvisual img { max-width: 140px; max-height: 100px; border-radius: 6px; cursor: zoom-in; } .qvisual svg { width: 100px; height: 100px; }
.qd-img img { max-width: 220px; max-height: 160px; border-radius: 8px; display: block; margin-bottom: 6px; cursor: zoom-in; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.pick-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { padding: 10px 12px; border-radius: 8px; background: var(--bg3); }
.explain { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--bg3); font-size: 14px; }
.tag.retry { color: var(--warn); }

/* Kalender, Stundenplan, Lernplan ----------------------------------- */
.tt-head { display: flex; padding-left: 34px; margin-bottom: 4px; }
.tt-axis-head { width: 0; }
.tt-dayhead { flex: 1; text-align: center; font-size: 11px; font-weight: 600; color: var(--fg3); }
.tt-dayhead.today { color: var(--fg); }
.tt-grid { display: flex; position: relative; }
.tt-axis { width: 34px; position: relative; font-size: 10px; color: var(--fg3); font-variant-numeric: tabular-nums; }
.tt-axis div { position: absolute; right: 6px; }
.tt-cols { flex: 1; display: flex; position: relative; }
.tt-hour { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.tt-col { flex: 1; position: relative; border-left: 1px solid var(--line); }
.tt-col.today { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tt-block { position: absolute; border-radius: 4px; background: color-mix(in srgb, var(--subj) 22%, var(--bg2)); color: var(--subj); font-size: 11px; font-weight: 600; padding: 3px 6px; line-height: 1.2; overflow: hidden; cursor: pointer; border: 1px solid transparent; }
.tt-block:hover { border-color: var(--subj); }
.tt-block .rm { display: block; font-weight: 400; color: var(--fg2); font-size: 10px; }
.tt-block.cancelled { text-decoration: line-through; opacity: .5; }
.tt-block.now { border-color: var(--subj); box-shadow: 0 0 0 2px color-mix(in srgb, var(--subj) 30%, transparent); }
.tt-now { position: absolute; left: 0; right: 0; height: 1px; background: var(--bad); z-index: 2; }
.tt-now::before { content: ""; position: absolute; left: -3px; top: -2.5px; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); }
.deadline .days { width: 44px; height: 44px; border-radius: 8px; background: var(--bg3); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; flex: 0 0 auto; }
.deadline .days .n { font: 700 15px var(--disp); }
.deadline.soon .days { background: color-mix(in srgb, var(--bad) 18%, var(--bg3)); }
.deadline.soon .days .n { color: var(--bad); }
.rail-dl li { padding: 6px 0; }
.rail-dl .days { width: 36px; height: 36px; } .rail-dl .days .n { font-size: 13px; } .rail-dl .title { font-size: 12.5px; }
.plans { display: flex; flex-direction: column; gap: 12px; }
.plans:empty { display: none; }
.plan { border-top: 3px solid var(--subj); }
.plan-today { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.progress { height: 6px; border-radius: 999px; background: var(--bg3); overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; }
.tag.soon { color: var(--bad); }
.list li.today { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 8px; padding-left: 6px; }
.list li.done .title { color: var(--ok); }

/* Statistik --------------------------------------------------------- */
.hm-wrap { overflow-x: auto; }
.hm { display: flex; gap: 3px; }
.hm-col { display: flex; flex-direction: column; gap: 3px; }
.hm-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--bg3); display: inline-block; }
.hm-cell.l1 { background: color-mix(in srgb, var(--accent) 30%, var(--bg3)); } .hm-cell.l2 { background: color-mix(in srgb, var(--accent) 55%, var(--bg3)); }
.hm-cell.l3 { background: color-mix(in srgb, var(--accent) 80%, var(--bg3)); } .hm-cell.l4 { background: var(--accent); }
.hm-cell.today { outline: 1px solid var(--fg); } .hm-cell.future { opacity: .25; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; gap: 10px; align-items: center; }
.bar-row .progress { flex: 1; margin: 0; }
.xp-chart { display: flex; gap: 6px; align-items: flex-end; height: 120px; }
.xp-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.xp-bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }

.tt-block.half { border-style: dashed; border-color: color-mix(in srgb, var(--subj) 50%, transparent); }
.tt-block.cancelled::after { content: " entfällt"; font-weight: 400; color: var(--fg3); }

.tt-col { cursor: cell; }
.tt-block.custom { border-style: dotted; }

.note-refs { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.note-ref { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 13px; min-width: 220px; }
.nr-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nr-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.msg.link-only .msg-body { max-width: 100%; }
.note-ref:hover { border-color: var(--accent); }
.note-ref .nr-title { font: 600 15px var(--disp); line-height: 1.3; }
.bubble a.note-link { text-decoration: underline; text-underline-offset: 2px; }

/* Rundgang ---------------------------------------------------------- */
.tour { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; width: 100%; max-width: 560px; padding: 22px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; margin: 16px; }
.tour h2 { font-size: 18px; }
.tour p { font-size: 14px; line-height: 1.55; color: var(--fg); margin: 0; }
.tour-step { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--fg3); text-transform: uppercase; }
.tour-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.tour-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--bg4); cursor: pointer; }
.tour-dots span.on { background: var(--accent); }
.tour-hl { outline: 2px solid var(--accent); outline-offset: 2px; background: color-mix(in srgb, var(--accent) 14%, transparent) !important; }

/* Apple-Stil: helle Flaechen, Milchglas, Pillen-Knoepfe, iMessage-Blasen, SF-Pro-artige Schrift -------------- */
html[data-theme="apple"] {
  --bg: #f5f5f7; --bg2: #ffffff; --bg3: #f2f2f7; --bg4: #e5e5ea; --line: #e3e3e8;
  --fg: #1d1d1f; --fg2: #6e6e73; --fg3: #86868b;
  --accent: #0071e3; --accent-fg: #fff; --ok: #34c759; --warn: #ff9f0a; --bad: #ff3b30;
  --l0: #ff3b30; --l1: #ff9500; --l2: #ffcc00; --l3: #a2d100; --l4: #30d158; --l5: #34c759;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", "Segoe UI", sans-serif;
  --disp: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", "Segoe UI", sans-serif;
  --radius: 18px;
  --shadow: 0 2px 6px rgba(0,0,0,.05), 0 12px 32px rgba(0,0,0,.08);
  --glass: rgba(255,255,255,.72);
  color-scheme: light;
}
html[data-theme="apple"] body { -webkit-font-smoothing: antialiased; letter-spacing: -.005em; }
html[data-theme="apple"] h1, html[data-theme="apple"] h2, html[data-theme="apple"] h3 { letter-spacing: -.02em; font-weight: 700; }
html[data-theme="apple"] h1 { font-size: 22px; }
html[data-theme="apple"] .sidebar, html[data-theme="apple"] .rail, html[data-theme="apple"] .top, html[data-theme="apple"] .bottom, html[data-theme="apple"] .chat-panel {
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-color: rgba(0,0,0,.08);
}
html[data-theme="apple"] .top { border-bottom: 1px solid rgba(0,0,0,.06); }
html[data-theme="apple"] .brand-mark { border-radius: 9px; background: linear-gradient(160deg, #3a8dff, #0071e3); }
html[data-theme="apple"] .sidenav a { border-radius: 10px; font-weight: 500; }
html[data-theme="apple"] .sidenav a.active { background: rgba(0,113,227,.12); color: var(--accent); }
html[data-theme="apple"] .sidenav a:hover { background: rgba(0,0,0,.05); }
html[data-theme="apple"] .me-mini, html[data-theme="apple"] .rank-mini:hover, html[data-theme="apple"] .member:hover { background: rgba(0,0,0,.05); border-radius: 12px; }
html[data-theme="apple"] .feedback-btn { border: 0; background: rgba(0,0,0,.04); border-radius: 12px; }
html[data-theme="apple"] .card, html[data-theme="apple"] .note-card, html[data-theme="apple"] .subj-card, html[data-theme="apple"] .login-card {
  border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.06);
}
html[data-theme="apple"] .note-card:hover { box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 10px 28px rgba(0,0,0,.1); }
html[data-theme="apple"] .feed-card .note-card { box-shadow: none; border-top: 1px solid var(--line); border-radius: 0; }
html[data-theme="apple"] .btn { border-radius: 980px; border: 0; background: rgba(0,0,0,.06); font-weight: 500; transition: background .15s, transform .1s; }
html[data-theme="apple"] .btn:hover { background: rgba(0,0,0,.1); border-color: transparent; }
html[data-theme="apple"] .btn:active { transform: scale(.97); }
html[data-theme="apple"] .btn.primary { background: var(--accent); color: #fff; font-weight: 600; }
html[data-theme="apple"] .btn.primary:hover { background: #0077ed; }
html[data-theme="apple"] .btn.ghost { background: transparent; color: var(--accent); }
html[data-theme="apple"] .btn.ghost:hover { background: rgba(0,113,227,.08); }
html[data-theme="apple"] .btn.bad { background: rgba(255,59,48,.1); color: var(--bad); }
html[data-theme="apple"] .icon-btn, html[data-theme="apple"] .search-box { border: 0; background: rgba(0,0,0,.05); border-radius: 12px; }
html[data-theme="apple"] .search-box { border-radius: 980px; }
html[data-theme="apple"] .search-box kbd, html[data-theme="apple"] .palette-head kbd { border-color: rgba(0,0,0,.12); background: #fff; }
html[data-theme="apple"] .field input, html[data-theme="apple"] .field select, html[data-theme="apple"] .field textarea, html[data-theme="apple"] .input, html[data-theme="apple"] .chat-in, html[data-theme="apple"] .comment-form textarea {
  border: 1px solid transparent; background: #f2f2f7; border-radius: 12px; transition: box-shadow .15s, background .15s;
}
html[data-theme="apple"] .field input:focus, html[data-theme="apple"] .field select:focus, html[data-theme="apple"] .field textarea:focus, html[data-theme="apple"] .chat-in:focus {
  background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,.2);
}
html[data-theme="apple"] .chat-in { border-radius: 20px; }
html[data-theme="apple"] .chat-send, html[data-theme="apple"] .chat-fab { border-radius: 50%; background: var(--accent); }
html[data-theme="apple"] .chat-handle { background: var(--accent); border-radius: 12px 0 0 12px; }
html[data-theme="apple"] .chat-panel { box-shadow: -8px 0 40px rgba(0,0,0,.12); }
html[data-theme="apple"] .bubble { border-radius: 18px; background: #e9e9eb; color: #000; font-size: 14px; padding: 8px 12px; }
html[data-theme="apple"] .msg:not(.mine) .bubble:not(.rainbow) { border-bottom-left-radius: 6px; }
html[data-theme="apple"] .msg.mine .bubble { border-bottom-right-radius: 6px; }
html[data-theme="apple"] .bubble.me { background: linear-gradient(180deg, #2a9bff, #0a84ff); color: #fff; }
html[data-theme="apple"] .msg.system { background: transparent; color: var(--fg3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
html[data-theme="apple"] .chat-tab { border-radius: 980px; }
html[data-theme="apple"] .chat-tab.on { background: var(--accent); color: #fff; }
html[data-theme="apple"] .chat-tab.on .count { background: #fff; color: var(--accent); }
html[data-theme="apple"] .seg { background: rgba(0,0,0,.06); border-radius: 10px; padding: 3px; }
html[data-theme="apple"] .seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 3px 8px rgba(0,0,0,.06); border-radius: 8px; }
html[data-theme="apple"] .switch { width: 44px; height: 26px; background: #e5e5ea; border: 0; }
html[data-theme="apple"] .switch::after { width: 22px; height: 22px; box-shadow: 0 2px 4px rgba(0,0,0,.25), 0 0 1px rgba(0,0,0,.2); }
html[data-theme="apple"] .switch.on { background: var(--ok); }
html[data-theme="apple"] .switch.on::after { left: 20px; }
html[data-theme="apple"] .tag, html[data-theme="apple"] .chip { border-radius: 980px; }
html[data-theme="apple"] .avatar { border-radius: 50%; }
html[data-theme="apple"] .modal-bg, html[data-theme="apple"] .palette-bg { background: rgba(0,0,0,.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
html[data-theme="apple"] .modal, html[data-theme="apple"] .palette, html[data-theme="apple"] .tour { border: 0; border-radius: 22px; background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); box-shadow: 0 24px 80px rgba(0,0,0,.22); }
html[data-theme="apple"] .modal { border-radius: 22px 22px 0 0; }
@media (min-width: 720px) { html[data-theme="apple"] .modal { border-radius: 22px; } }
html[data-theme="apple"] .popover, html[data-theme="apple"] .notif-pop { border: 0; border-radius: 16px; background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); padding: 6px; }
html[data-theme="apple"] .pop-item { border-radius: 10px; }
html[data-theme="apple"] .toast { border: 0; border-radius: 980px; background: rgba(29,29,31,.92); color: #fff; backdrop-filter: blur(20px); padding: 10px 18px; }
html[data-theme="apple"] .toast.err { background: var(--bad); color: #fff; }
html[data-theme="apple"] .option { border-radius: 14px; border-color: transparent; background: #f2f2f7; }
html[data-theme="apple"] .option:hover:not(:disabled) { background: #eaeaef; border-color: transparent; }
html[data-theme="apple"] .option.sel { background: rgba(0,113,227,.1); border-color: var(--accent); }
html[data-theme="apple"] .tt-block { border-radius: 8px; }
html[data-theme="apple"] .bottom { border-top: 1px solid rgba(0,0,0,.08); }
html[data-theme="apple"] .bottom a { font-size: 10px; }
html[data-theme="apple"] .tour-hl { outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,.35); }
html[data-theme="apple"] ::selection { background: rgba(0,113,227,.25); }
html[data-theme="apple"] .progress { border-radius: 980px; overflow: hidden; }
html[data-theme="apple"] .login-body { background: linear-gradient(180deg, #f5f5f7, #e8e8ed); }
html[data-theme="apple"] .login-card { border-radius: 24px; padding: 32px; }

/* Mitschrift (Handschrift) --------------------------------------------- */
.hw { display: flex; flex-direction: column; gap: 8px; height: calc(100vh - 61px - 48px); min-height: 480px; }
.hw-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hw-head select, .hw-head input { height: 34px; border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 0 10px; color: var(--fg); font-size: 13px; outline: none; }
.hw-head input { flex: 1; min-width: 160px; }
.hw-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 6px 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; }
.hw-tools .btn.on, .hw-tool.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.hw-sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.hw-colors, .hw-sizes { display: inline-flex; gap: 4px; align-items: center; }
.hw-color { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.15) inset; }
.hw-color.on { border-color: var(--fg); transform: scale(1.12); }
.hw-size { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg3); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.hw-size i { display: block; border-radius: 50%; background: var(--fg); }
.hw-size.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.hw-bg { height: 30px; border: 1px solid var(--line); background: var(--bg3); border-radius: 6px; color: var(--fg); font-size: 12px; padding: 0 6px; }
.hw-finger { display: inline-flex; gap: 6px; align-items: center; color: var(--fg2); }
.hw-hint { padding: 0 2px; }
.hw-pages { flex: 1; overflow: auto; background: var(--bg3); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 16px; align-items: center; overscroll-behavior: contain; }
.hw-page { display: flex; flex-direction: column; gap: 4px; width: 100%; align-items: center; }
.hw-page-head { display: flex; align-items: center; gap: 6px; width: 100%; max-width: 900px; }
.hw-canvas { display: block; background: #fff; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: crosshair; -webkit-user-select: none; user-select: none; }
@media (max-width: 900px) { .hw { height: calc(100vh - 61px - 24px - var(--nav-h)); } .hw-tools .btn span, .hw-hint { display: none; } }

/* Breite und Ueberlauf: Notizen duerfen nie ueber den Bildschirmrand hinaus ---------------------------- */
.note-card > .grow { flex: 1; min-width: 0; }
.note-title, .note-meta, .note-foot, .md, .comment .grow { overflow-wrap: anywhere; }
.comment > .grow, .comment > div:last-child { flex: 1; min-width: 0; }
.card-head { flex-wrap: wrap; }
.card-head h2 { flex: 1 1 auto; }
.note-page { max-width: none; }
.md table { display: block; max-width: 100%; overflow-x: auto; }
.md img, .md video { max-width: 100%; height: auto; }
.card, .note-card { max-width: 100%; }
.main { max-width: 100%; }

/* Mitschrift: die Seite selbst steht still, nur der Blattbereich scrollt */
html.hw-mode, html.hw-mode body { overflow: hidden; height: 100%; overscroll-behavior: none; }
html.hw-mode .main { overflow: hidden; }
.hw { height: calc(100vh - 61px - 48px); height: calc(100dvh - 61px - 48px); }
@media (max-width: 900px) { .hw { height: calc(100vh - 61px - 24px - var(--nav-h)); height: calc(100dvh - 61px - 24px - var(--nav-h)); } }
.hw-canvas { -webkit-touch-callout: none; touch-action: pan-y; }
.hw-pages { -webkit-overflow-scrolling: touch; }

/* Todos */
.todo-check { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--line); background: transparent; color: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; transition: border-color .15s, background .15s; }
.todo-check:hover { border-color: var(--ok); color: var(--ok); }
.todo-check.on { background: var(--ok); border-color: var(--ok); color: #0b2a1c; }
.list li.todo { align-items: flex-start; }
.list li.todo .todo-check { margin-top: 1px; }
.list li.todo.done .title { color: var(--fg3); text-decoration: line-through; }
.todo-due { color: var(--fg2); }
.todo.soon .todo-due { color: var(--warn); font-weight: 600; }
.todo.overdue .todo-due { color: var(--bad); font-weight: 600; }
.todo-group + .todo-group { margin-top: 14px; }
.todo-group h3 { font-size: 13px; margin-bottom: 4px; }
.todo-group h3.bad { color: var(--bad); }
.todo-card .list li { padding: 8px 0; }
@media (hover: none) and (pointer: coarse) { .todo-check { width: 28px; height: 28px; } }
.todo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.todo-tile { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--subj); border-radius: 10px; background: var(--bg); cursor: pointer; min-width: 0; transition: border-color .15s, transform .15s; }
.todo-tile:hover, .todo-tile:focus-visible { border-color: var(--accent); border-left-color: var(--subj); outline: none; }
.todo-tile-top { display: flex; gap: 8px; align-items: flex-start; }
.todo-tile .title { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.todo-tile-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; margin-top: auto; }
.todo-tile-foot { display: flex; gap: 10px; font-size: 11.5px; color: var(--fg3); }
.todo-tile-foot span { display: inline-flex; align-items: center; gap: 4px; }
.todo-info { display: flex; gap: 10px; font-size: 13px; }
.todo-info > .faint { width: 70px; flex: 0 0 auto; }
.todo-details { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; background: var(--bg3); border-radius: 8px; padding: 10px 12px; }
@media (max-width: 500px) { .todo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }

/* Neuigkeiten-Fenster */
.updates { display: flex; flex-direction: column; gap: 16px; }
.update + .update { border-top: 1px solid var(--line); padding-top: 14px; }
.update-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.update-head h3 { flex: 1; font-size: 15px; }
.update-item { display: flex; gap: 12px; padding: 8px 0; }
.update-item .title { font-weight: 600; font-size: 14px; }
.update-item p { margin: 2px 0 6px; font-size: 13.5px; line-height: 1.5; color: var(--fg2); }
.update-ic { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 14%, var(--bg3)); color: var(--accent); }

/* Uebungsbeispiele: Faecher-Kacheln, Schwierigkeit */
.ex-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 4px; }
.ex-subj { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; text-align: left; padding: 9px 11px; border: 1px solid var(--line); border-left: 3px solid var(--subj, var(--line)); border-radius: 10px; background: var(--bg); color: var(--fg); cursor: pointer; font: inherit; }
.ex-subj:hover { border-color: var(--accent); border-left-color: var(--subj, var(--accent)); }
.ex-subj.on { background: color-mix(in srgb, var(--subj, var(--accent)) 14%, var(--bg)); border-color: var(--subj, var(--accent)); }
.ex-subj .nm { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-subj .n { font-size: 12px; color: var(--fg3); font-weight: 600; }
.ex-subj-diff { flex-basis: 100%; display: flex; gap: 10px; font-size: 11.5px; color: var(--fg3); }
.ex-subj-diff > span { display: inline-flex; align-items: center; gap: 4px; }
.diff-dots { display: inline-flex; gap: 2px; }
.diff-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--bg4, var(--line)); }
.diff-dots.d1 i.on { background: var(--ok); } .diff-dots.d2 i.on { background: var(--warn); } .diff-dots.d3 i.on { background: var(--bad); }
.tag.diff { gap: 5px; }
.ex-tasks .input { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
@media (max-width: 500px) { .ex-subjects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ex-tasks .input { max-width: 480px; }

/* Rangliste: Karte "Ränge" */
.badge-hex.sm { width: 30px; height: 34px; font-size: 11px; }
.xp-rules { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--fg2); }
.xp-rules li { display: flex; gap: 6px; align-items: baseline; }
.xp-rules strong { color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.rank-tier { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.rank-tier.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.rank-tier-name { font: 600 14px var(--disp); margin-bottom: 8px; }
.rank-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rank-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border-radius: 8px; opacity: .45; }
.rank-step.reached { opacity: 1; }
.rank-step.me { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.rank-step-xp { font-size: 11.5px; color: var(--fg2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-step-me { position: absolute; top: 2px; right: 4px; font-size: 10px; font-weight: 700; color: var(--accent); }
@media (max-width: 500px) { .rank-tiers { grid-template-columns: 1fr; } }

/* Punkteverlust-Warnung */
.decay-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; margin-bottom: 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--warn) 55%, var(--line)); background: color-mix(in srgb, var(--warn) 12%, var(--bg2)); font-size: 13.5px; }
.decay-warn strong { color: var(--warn); }
.decay-warn span { flex: 1 1 240px; color: var(--fg2); }
.decay-warn.running { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); background: color-mix(in srgb, var(--bad) 12%, var(--bg2)); }
.decay-warn.running strong { color: var(--bad); }
.list li.past { opacity: .5; }
