/* ===== Open-WebUI-inspiriertes Theme (nur dunkel) – identisch zu Notes ===== */
:root {
  --gray-50: #f9f9f9;
  --gray-100: #ececec;
  --gray-200: #e3e3e3;
  --gray-300: #cdcdcd;
  --gray-400: #b4b4b4;
  --gray-500: #9b9b9b;
  --gray-600: #676767;
  --gray-700: #4e4e4e;
  --gray-800: #333333;
  --gray-850: #262626;
  --gray-900: #171717;
  --gray-950: #0d0d0d;

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, Consolas, monospace;

  --bg: var(--gray-900);
  --bg-sidebar: var(--gray-950);
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active: rgba(255, 255, 255, 0.08);
  --bg-elev: var(--gray-850);
  --bg-input: var(--gray-850);
  --bg-soft: var(--gray-850);
  --border: var(--gray-850);
  --border-strong: var(--gray-800);
  --text: var(--gray-100);
  --text-2: var(--gray-300);
  --text-3: var(--gray-500);
  --primary-bg: #ffffff;
  --primary-text: #000000;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --accent: #60a5fa;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
  --mark: rgba(250, 204, 21, 0.35);
  --code-bg: var(--gray-850);
  --player-h: 84px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { flex-shrink: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 18px; height: 18px; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }

/* ===== Buttons & Inputs ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 9999px; font-weight: 500; font-size: 13.5px;
  transition: background .15s, opacity .15s; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary-bg); color: var(--primary-text); }
.btn-primary:hover { opacity: .88; }
.btn-secondary { background: var(--bg-soft); color: var(--text); }
.btn-secondary:hover { background: var(--bg-active); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 32px; height: 32px; border-radius: 10px; color: var(--text-2);
  transition: background .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; border-radius: 7px; }
.icon-btn.active { color: #eab308; }
.icon-btn.on { background: var(--bg-active); color: var(--text); }
.icon-btn[disabled] { opacity: .4; cursor: default; }

.input {
  width: 100%; padding: 9px 14px; border-radius: 12px; border: 1px solid transparent;
  background: var(--bg-input); outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--border-strong); }
.input::placeholder { color: var(--text-3); }
textarea.input { resize: vertical; font-family: inherit; line-height: 1.5; }
.label { display: block; font-size: 12px; font-weight: 500; color: var(--text-3); margin: 0 0 6px 2px; }
.field { margin-bottom: 14px; }
.select {
  padding: 6px 28px 6px 10px; border-radius: 10px; background: var(--bg-input); border: 0; outline: none;
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239b9b9b'%3E%3Cpath d='M5.3 7.3a1 1 0 0 1 1.4 0L10 10.6l3.3-3.3a1 1 0 1 1 1.4 1.4l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}

.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
}
.badge-muted { background: var(--bg-soft); color: var(--text-3); text-transform: none; font-weight: 500; }
.count-badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 9999px;
  background: var(--accent); color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

.toggle {
  position: relative; width: 36px; height: 20px; border-radius: 9999px; background: var(--gray-700); transition: background .15s; flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s;
}
.toggle.on { background: #10b981 !important; }
.toggle.on::after { transform: translateX(16px); }
.toggle[disabled] { opacity: .4; cursor: not-allowed; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--text-2);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .9s linear infinite; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; color: #fff; flex-shrink: 0; user-select: none; overflow: hidden;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

/* ===== Auth ===== */
.auth-wrap {
  position: fixed; inset: 0; z-index: 200;
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--bg);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-title { font-size: 26px; font-weight: 600; text-align: center; margin: 0 0 6px; }
.auth-sub { text-align: center; color: var(--text-3); margin: 0 0 28px; }
.auth-error { background: var(--danger-soft); color: var(--danger); padding: 9px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13px; }
.auth-switch { text-align: center; color: var(--text-3); margin-top: 18px; font-size: 13px; }
.auth-switch button { color: var(--text); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.logo {
  width: 44px; height: 44px; border-radius: 14px; background: var(--primary-bg); color: var(--primary-text);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.logo.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }

/* ===== Layout ===== */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

:root { --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-top: env(safe-area-inset-top, 0px); }
@media (display-mode: standalone) {
  .sidebar { padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }
  .main, .chat-panel { padding-top: var(--safe-top); }
  .chat-compose { padding-bottom: calc(10px + var(--safe-bottom)); }
  .toasts { bottom: calc(18px + var(--safe-bottom)); }
  .player { bottom: calc(12px + var(--safe-bottom)); }
}

.sidebar {
  width: 260px; flex-shrink: 0; background: var(--bg-sidebar); display: flex; flex-direction: column;
  transition: margin-left .2s ease; z-index: 40; color: var(--text-2);
}
.sidebar.closed { margin-left: -260px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 14px; }
.sidebar-brand { text-decoration: none; display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--text); font-size: 15px; }
.sidebar-nav { padding: 6px 8px 4px; display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 10px;
  font-size: 13.5px; text-align: left; color: var(--text-2);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.selected { background: var(--bg-active); color: var(--text); }
.nav-item .kbd, .nav-item .num { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  font-size: 11.5px; font-weight: 500; color: var(--text-3); padding: 14px 10px 4px;
}
.section-title .icon-btn { opacity: 0; }
.section-title:hover .icon-btn { opacity: 1; }
.section-title .name { flex: 1; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title .name:hover { color: var(--text-2); }
.section-title .tree-toggle { margin-left: -6px; }
.empty-hint { font-size: 12.5px; color: var(--text-3); padding: 4px 10px; }

.tree-item {
  position: relative; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px;
  border-radius: 10px; cursor: pointer; color: var(--text-2); user-select: none;
}
.tree-item:hover { background: var(--bg-hover); color: var(--text); }
.tree-item.selected { background: var(--bg-active); color: var(--text); }
.tree-toggle {
  width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); flex-shrink: 0;
}
.tree-toggle:hover { background: var(--bg-active); color: var(--text); }
.tree-toggle svg { transition: transform .15s; }
.tree-toggle.open svg { transform: rotate(90deg); }
.tree-icon {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0; object-fit: cover; background: var(--bg-soft);
  display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 600; color: var(--text-2); overflow: hidden;
}
.tree-title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13.5px; }
.tree-count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tree-actions { display: none; align-items: center; gap: 1px; }
.tree-item:hover .tree-actions { display: flex; }
.tree-item:hover .tree-count { display: none; }
.tree-error { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }

.sidebar-filter {
  display: flex; align-items: center; gap: 8px; margin: 4px 8px 0; padding: 0 10px; border-radius: 10px; color: var(--text-3);
}
.sidebar-filter:focus-within { background: var(--bg-hover); }
.sidebar-filter input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 7px 0; font-size: 13.5px; color: var(--text); }
.sidebar-filter input::placeholder { color: var(--text-3); }

.sidebar-foot { padding: 8px; position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 12px; text-align: left; }
.user-btn:hover { background: var(--bg-hover); }
.user-btn .name { font-weight: 500; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); position: relative; }
.topbar {
  height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 0 12px;
  position: sticky; top: 0; z-index: 20; background: var(--bg);
}
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; overflow: hidden; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; font-size: 14px;
  color: var(--text-2); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis;
}
.crumb.current { color: var(--text); font-weight: 500; }
.crumb .sub { color: var(--text-3); font-weight: 400; font-size: 12.5px; }
.topbar-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar-search {
  display: flex; align-items: center; gap: 8px; width: 220px; padding: 0 12px; border-radius: 9999px;
  background: var(--bg-input); color: var(--text-3); border: 1px solid transparent; margin-right: 4px;
}
.topbar-search:focus-within { border-color: var(--border-strong); }
.topbar-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 7px 0; font-size: 13.5px; color: var(--text); }
.topbar-search input::placeholder { color: var(--text-3); }
.content { flex: 1; min-height: 0; display: flex; position: relative; }

.backdrop-mobile { display: none; }
@media (max-width: 768px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; height: 100%; box-shadow: var(--shadow); }
  .backdrop-mobile { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 39; }
  .topbar-search { display: none; }
}

/* ===== Menus / Popovers ===== */
.menu {
  position: fixed; z-index: 70; min-width: 200px; padding: 6px; border-radius: 14px;
  background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text);
}
.menu.abs { position: absolute; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 9px; text-align: left;
  font-size: 13.5px; white-space: nowrap; text-decoration: none;
}
.menu-item:hover, .menu-item.active { background: var(--bg-hover); }
.menu-item.danger { color: var(--danger); }
.menu-item .hint { margin-left: auto; color: var(--text-3); font-size: 12px; padding-left: 16px; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-label { font-size: 11.5px; color: var(--text-3); padding: 6px 10px 4px; font-weight: 500; }

/* Benachrichtigungen */
.notif-menu { width: 360px; max-width: calc(100vw - 24px); max-height: 70vh; overflow-y: auto; right: 0; top: calc(100% + 6px); }
.notif { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 8px 10px; border-radius: 10px; text-align: left; }
.notif:hover { background: var(--bg-hover); }
.notif img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; background: var(--bg-soft); flex-shrink: 0; }
.notif .t { font-size: 12px; color: var(--text-3); }
.notif .b { font-size: 13.5px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== Modals ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 520px; background: var(--gray-900); border-radius: 20px; box-shadow: var(--shadow);
  border: 1px solid var(--gray-850); color: var(--text);
}
.modal.lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px 22px; }
.modal-title { font-size: 17px; font-weight: 600; margin: 0; }
.modal-body { padding: 10px 22px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }

.settings-layout { display: flex; min-height: 420px; }
.settings-tabs { width: 190px; padding: 6px 10px 18px 14px; display: flex; flex-direction: column; gap: 2px; }
.settings-tab { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; text-align: left; color: var(--text-2); }
.settings-tab:hover { background: var(--bg-hover); }
.settings-tab.active { background: var(--bg-active); color: var(--text); }
.settings-panel { flex: 1; padding: 6px 22px 22px 10px; min-width: 0; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-row .d { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.settings-h { font-size: 13px; font-weight: 600; margin: 4px 0 10px; }
.card { border: 1px solid var(--border); border-radius: 16px; padding: 6px 18px; }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13px; color: var(--text-2); align-items: center; }
.kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 6px; font-size: 11px; text-align: center; color: var(--text-2); font-family: var(--mono);
}
@media (max-width: 640px) {
  .settings-layout { flex-direction: column; }
  .settings-tabs { width: auto; flex-direction: row; overflow-x: auto; }
}

/* Toasts */
.toasts { position: fixed; z-index: 90; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 240px; max-width: 360px; padding: 11px 16px; border-radius: 14px; background: var(--bg-elev);
  border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 13.5px; display: flex; gap: 10px; align-items: center;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; flex-shrink: 0; }
.toast.error .dot { background: var(--danger); }

/* ===== Home (wie Open-WebUI Chat-Startseite) ===== */
.home { max-width: 760px; margin: 0 auto; padding: 14vh 24px 40px; width: 100%; }
.home-greet { display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 30px; }
.home-greet h1 { font-size: 30px; font-weight: 500; margin: 0; }
.composer {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 22px; border-radius: 28px;
  background: var(--gray-850); border: 1px solid var(--gray-800);
}
.composer input { flex: 1; border: 0; outline: none; background: none; font-size: 15.5px; padding: 8px 0; min-width: 0; }
.send-btn {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--primary-bg); color: var(--primary-text);
}
.send-btn[disabled] { background: var(--bg-active); color: var(--text-3); cursor: default; }
.home-sub { font-size: 13px; color: var(--text-3); margin: 34px 4px 10px; display: flex; align-items: center; gap: 6px; }
.suggestions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.suggestion {
  text-align: left; padding: 12px 14px; border-radius: 16px; background: transparent; border: 1px solid var(--border);
  transition: background .15s;
}
.suggestion:hover { background: var(--bg-hover); }
.suggestion .t { font-weight: 500; display: flex; gap: 8px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.suggestion .s { color: var(--text-3); font-size: 12.5px; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 1.4em; }
.add-error { color: var(--danger); font-size: 13px; margin: 10px 8px 0; }

.center-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 14vh 20px; color: var(--text-3); text-align: center; }
.center-state h2 { color: var(--text); margin: 0; font-size: 20px; font-weight: 600; }
.center-state p { margin: 0; max-width: 360px; }
.center { display: flex; justify-content: center; padding: 20px; }

/* ===== Artikelliste ===== */
.list {
  width: 420px; flex-shrink: 0; overflow-y: auto; padding: 0 8px calc(var(--player-h) + 24px);
}
.content.no-article .list { width: 100%; max-width: 820px; margin: 0 auto; }
.content.has-article .list { border-right: 1px solid var(--border); }

.item {
  display: flex; gap: 12px; padding: 12px; border-radius: 14px; cursor: pointer; transition: background .12s;
}
.item:hover { background: var(--bg-hover); }
.item.selected { background: var(--bg-active); }
.item-body { flex: 1; min-width: 0; }
.item-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin-bottom: 3px; min-width: 0; }
.item-meta .src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--gray-600); flex-shrink: 0; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.item-title {
  font-weight: 500; font-size: 14.5px; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-summary {
  margin-top: 3px; font-size: 13px; color: var(--text-3); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item.read .item-title { color: var(--text-3); font-weight: 400; }
.item.read .item-summary { color: var(--gray-600); }
.item-thumb { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; background: var(--bg-soft); flex-shrink: 0; }
.item-actions { display: flex; align-items: center; gap: 2px; margin-top: 8px; }

.play-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 5px; border-radius: 9999px;
  background: var(--bg-soft); font-size: 12px; color: var(--text-2); transition: background .15s;
}
.play-pill:hover { background: var(--bg-active); color: var(--text); }
.play-pill .circle {
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary-bg); color: var(--primary-text);
  display: inline-flex; align-items: center; justify-content: center;
}
.play-pill .circle svg { width: 11px; height: 11px; }
.mini-progress { width: 46px; height: 3px; border-radius: 9999px; background: var(--border-strong); overflow: hidden; }
.mini-progress > div { height: 100%; background: var(--text-2); }

/* ===== Leser ===== */
.reader { flex: 1; min-width: 0; overflow-y: auto; padding: 0 32px calc(var(--player-h) + 40px); }
.reader-inner { max-width: 720px; margin: 0 auto; }
.reader-toolbar { position: sticky; top: 0; display: flex; align-items: center; gap: 2px; padding: 8px 0; background: var(--bg); z-index: 5; }
.reader-title { font-size: 32px; font-weight: 700; line-height: 1.25; margin: 14px 0 10px; letter-spacing: -.01em; }
.reader-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--text-3); font-size: 12.5px; margin-bottom: 22px; }
.reader-hero { width: 100%; max-height: 420px; object-fit: cover; border-radius: 14px; margin-bottom: 22px; background: var(--bg-soft); }

.prose { font-size: 15.5px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }
.prose p { margin: 0 0 1em; }
.prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 3px; }
.prose img, .prose video, .prose iframe { max-width: 100%; height: auto; border-radius: 10px; }
.prose figure { margin: 1.4em 0; }
.prose figcaption { font-size: 13px; color: var(--text-3); margin-top: 6px; text-align: center; }
.prose h1, .prose h2, .prose h3, .prose h4 { line-height: 1.3; margin: 1.5em 0 .5em; font-weight: 600; }
.prose h2 { font-size: 23px; }
.prose h3 { font-size: 19px; }
.prose blockquote { border-left: 3px solid var(--text); padding-left: 14px; margin: 1em 0; color: var(--text-2); }
.prose pre { background: var(--code-bg); border-radius: 10px; padding: 14px 18px; overflow-x: auto; font-size: 13.5px; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); color: #eb5757; padding: 2px 5px; border-radius: 5px; }
.prose pre code { background: none; color: var(--text); padding: 0; }
.prose table { border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border-strong); padding: 7px 10px; }
.prose hr { border: 0; height: 1px; background: var(--border-strong); margin: 2em 0; }

.episode-card {
  display: flex; gap: 16px; align-items: center; padding: 14px; margin-bottom: 24px;
  border: 1px solid var(--border); border-radius: 16px;
}
.episode-card img { width: 92px; height: 92px; border-radius: 12px; object-fit: cover; background: var(--bg-soft); flex-shrink: 0; }
.episode-card .grow { flex: 1; min-width: 0; }
.episode-card .when { font-size: 12.5px; color: var(--text-3); margin-bottom: 8px; }

/* ===== Player ===== */
.player {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 30;
  width: min(860px, calc(100% - 24px)); padding: 10px 14px 8px 10px;
  background: var(--gray-850); border: 1px solid var(--gray-800); border-radius: 22px; box-shadow: var(--shadow);
}
.player-row { display: flex; align-items: center; gap: 12px; }
.player-art { width: 50px; height: 50px; border-radius: 12px; object-fit: cover; background: var(--bg-active); flex-shrink: 0; cursor: pointer; }
.player-info { flex: 1; min-width: 0; cursor: pointer; }
.player-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-sub.error { color: var(--danger); }
.controls { display: flex; align-items: center; gap: 2px; }
.skip-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2);
}
.skip-btn:hover { background: var(--bg-hover); color: var(--text); }
.skip-btn .icon { width: 28px; height: 28px; }
.skip-btn span { position: absolute; font-size: 8.5px; font-weight: 700; top: 50%; left: 50%; transform: translate(-50%, -40%); }
.play-btn {
  width: 40px; height: 40px; border-radius: 50%; background: var(--primary-bg); color: var(--primary-text);
  display: inline-flex; align-items: center; justify-content: center; margin: 0 2px;
}
.play-btn:hover { opacity: .88; }
.play-btn .icon { width: 18px; height: 18px; }
.play-btn .spinner { border-color: #bbb; border-top-color: #000; }
.play-btn.lg { width: 64px; height: 64px; }
.play-btn.lg .icon { width: 26px; height: 26px; }
.speed-btn {
  min-width: 46px; height: 28px; padding: 0 9px; border-radius: 9999px; background: var(--bg-active);
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
}
.speed-btn:hover { background: rgba(255, 255, 255, .12); }
.speed-menu { right: 0; bottom: calc(100% + 8px); width: 248px; padding: 10px; }
.speed-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.speed-grid button {
  padding: 6px 0; border-radius: 8px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-2);
}
.speed-grid button:hover { background: var(--bg-hover); color: var(--text); }
.speed-grid button.on { background: var(--primary-bg); color: var(--primary-text); font-weight: 600; }
.range { width: 100%; accent-color: var(--gray-100); cursor: pointer; }

.timeline { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding-left: 62px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.timeline .time { width: 54px; }
.timeline .time.right { text-align: right; }
.bar { position: relative; flex: 1; height: 16px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.bar .track { position: absolute; left: 0; right: 0; height: 4px; border-radius: 9999px; background: var(--border-strong); overflow: hidden; transition: height .1s; }
.bar .buffer { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gray-700); }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gray-100); }
.bar .knob { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #fff; transform: translateX(-50%); opacity: 0; transition: opacity .15s; pointer-events: none; }
.bar:hover .knob, .bar.always .knob { opacity: 1; }
.bar:hover .track { height: 6px; }
.bar input[type=range] { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; margin: 0; }
.resume-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); padding: 0 0 6px 62px; }

.player-full {
  position: fixed; inset: 0; z-index: 65; background: var(--bg); display: flex; flex-direction: column; align-items: center;
  padding: 10px 24px 40px; overflow-y: auto;
}
.player-full .top { width: 100%; height: 42px; display: flex; justify-content: space-between; align-items: center; }
.player-full .top .lbl { font-size: 12.5px; color: var(--text-3); }
.player-full .art { width: min(340px, 70vw); aspect-ratio: 1; border-radius: 22px; object-fit: cover; margin: 4vh 0 26px; box-shadow: var(--shadow); background: var(--bg-soft); }
.player-full .meta { text-align: center; max-width: 560px; }
.player-full .meta h2 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.player-full .meta p { color: var(--text-3); margin: 0; }
.player-full .timeline { padding-left: 0; width: min(560px, 100%); margin-top: 26px; }
.player-full .controls { gap: 18px; margin-top: 16px; }
.player-full .skip-btn { width: 54px; height: 54px; }
.player-full .skip-btn .icon { width: 38px; height: 38px; }
.player-full .skip-btn span { font-size: 11px; }
.player-full .rate-row { display: flex; align-items: center; gap: 10px; margin-top: 28px; width: min(560px, 100%); }
.player-full .chips { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.chip { padding: 5px 12px; border-radius: 9999px; font-size: 12.5px; background: var(--bg-soft); color: var(--text-2); font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--bg-active); color: var(--text); }
.chip.on { background: var(--primary-bg); color: var(--primary-text); font-weight: 600; }
.player-full .extra { display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
.player-full .extra .btn { color: var(--text-2); }

/* ===== KI-Chat (rechte Seitenleiste) – wie Notes ===== */
.chat-panel {
  width: 400px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--bg);
  border-left: 1px solid var(--border); margin-right: -400px; transition: margin-right .2s ease; z-index: 45; min-height: 0;
}
.chat-panel.open { margin-right: 0; }
@media (max-width: 1100px) {
  .chat-panel { position: fixed; right: 0; top: 0; bottom: 0; box-shadow: var(--shadow); }
  .chat-panel:not(.open) { box-shadow: none; }
}
@media (max-width: 768px) {
  .chat-panel { width: 100%; margin-right: -100%; }
}
.chat-head { height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 16px; flex-shrink: 0; }
.chat-title { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.chat-title .icon { width: 18px; height: 18px; color: var(--text); }
.chat-model { font-size: 11.5px; font-weight: 500; color: var(--text-3); background: var(--bg-soft); padding: 2px 8px; border-radius: 9999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 6px 16px 16px; min-height: 0; }

.chat-empty { text-align: center; padding: 10vh 10px 10px; color: var(--text-3); }
.chat-empty h3 { color: var(--text); font-size: 18px; font-weight: 600; margin: 14px 0 6px; }
.chat-empty p { margin: 0 0 18px; font-size: 13.5px; line-height: 1.5; }
.chat-hero {
  width: 52px; height: 52px; border-radius: 16px; margin: 0 auto; display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); color: var(--text);
}
.chat-hero .icon { width: 26px; height: 26px; }
.chat-suggestions { display: grid; gap: 6px; text-align: left; }
.chat-suggestions .suggestion { padding: 10px 14px; border-radius: 14px; }
.chat-suggestions .suggestion .t { font-size: 13.5px; color: var(--text); }

.chat-msg { margin: 14px 0; display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg .bubble {
  max-width: 85%; background: var(--gray-850); padding: 9px 14px; border-radius: 20px 20px 6px 20px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.5; font-size: 14px;
}
.assistant-body { flex: 1; min-width: 0; }
.md { line-height: 1.6; font-size: 14px; word-break: break-word; }
.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md h3, .md h4 { margin: 14px 0 6px; font-size: 15px; font-weight: 600; }
.md ul, .md ol { margin: 4px 0 10px; padding-left: 20px; }
.md li { margin: 2px 0; }
.md code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); color: #eb5757; padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--code-bg); border-radius: 10px; padding: 12px 14px; overflow-x: auto; margin: 6px 0 10px; }
.md pre code { background: none; color: var(--text); padding: 0; font-size: 12.5px; }
.md blockquote { border-left: 3px solid var(--border-strong); margin: 6px 0; padding: 2px 12px; color: var(--text-2); }
.md a { color: var(--accent); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

.chat-error {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; padding: 8px 12px; border-radius: 12px;
  background: var(--danger-soft); color: var(--danger); font-size: 13px;
}
.chat-note { font-size: 11.5px; color: var(--text-3); text-align: center; margin: 4px 0; }
.msg-actions { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.chat-msg:hover .msg-actions { opacity: 1; }

.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: typing 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-compose { padding: 8px 12px 10px; flex-shrink: 0; }
.chat-context {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 12px; color: var(--text-3);
  background: var(--bg-soft); padding: 3px 10px; border-radius: 9999px; margin: 0 0 6px 4px;
}
.chat-context .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-input {
  display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 16px; border-radius: 24px;
  border: 1px solid var(--gray-800); background: var(--gray-850);
}
.chat-input textarea {
  flex: 1; border: 0; outline: none; background: none; resize: none; padding: 7px 0; font-size: 14px; line-height: 1.45;
  max-height: 200px; font-family: inherit; color: var(--text);
}
.chat-input .send-btn { width: 32px; height: 32px; flex-shrink: 0; }
.chat-hint { font-size: 11px; color: var(--text-3); text-align: center; margin-top: 6px; }

/* Admin → KI */
.ai-presets, .ai-models { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ai-presets button, .ai-models button {
  font-size: 12px; padding: 3px 10px; border-radius: 9999px; background: var(--bg-soft); color: var(--text-2);
}
.ai-presets button:hover, .ai-models button:hover { background: var(--bg-active); }
.ai-presets button.on, .ai-models button.on { background: var(--primary-bg); color: var(--primary-text); }
.ai-models { max-height: 120px; overflow-y: auto; }
.ai-help { font-size: 12px; color: var(--text-3); margin: 6px 2px 0; }
.ai-test { margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.ai-test.ok { background: rgba(16, 185, 129, .12); color: #059669; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .content.has-article .list { display: none; }
}
@media (max-width: 768px) {
  .reader { padding: 0 18px calc(var(--player-h) + 40px); }
  .reader-title { font-size: 26px; }
  .list { padding: 0 4px calc(var(--player-h) + 30px); }
  .item-thumb { width: 64px; height: 64px; }
  .player { bottom: 8px; width: calc(100% - 16px); }
  .hide-mobile { display: none !important; }
  .timeline, .resume-hint { padding-left: 0; }
  .home { padding-top: 8vh; }
  .home-greet h1 { font-size: 24px; }
}
