/* ===== Design-System: warmes Buch/Papier-Thema, hell + dunkel ===== */
:root,
[data-theme="light"] {
  --bg: #F6F1E6;
  --panel: #FFFFFF;
  --panel-2: #FBF6EB;
  --line: #E6DCC6;
  --line-soft: #EFE7D6;
  --text: #2B2621;
  --muted: #7A7166;
  --muted-2: #A69C8C;
  --accent: #B9862E;
  --accent-ink: #FFFFFF;
  --red: #C0392B;
  --red-bg: #FBEAE7;
  --shadow: 0 1px 0 rgba(0,0,0,.02), 0 8px 24px rgba(43,38,33,.08);
}

[data-theme="dark"] {
  --bg: #1B1712;
  --panel: #241F19;
  --panel-2: #2A241D;
  --line: #38312A;
  --line-soft: #2E2820;
  --text: #ECE6DA;
  --muted: #A79C8C;
  --muted-2: #6E655A;
  --accent: #D9A441;
  --accent-ink: #1A1304;
  --red: #E5726A;
  --red-bg: #331D19;
  --shadow: 0 1px 0 rgba(255,255,255,.02), 0 8px 24px rgba(0,0,0,.35);
}

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: 'Archivo', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 90px;
}
a{ color: inherit; }
button{ font-family: inherit; }
::selection{ background: var(--accent); color: var(--accent-ink); }
.hidden{ display:none !important; }

/* ---------- Topbar ---------- */
header.top{
  position: sticky; top:0; z-index: 40;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.top-inner{
  max-width: 760px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.brand{ display:flex; align-items:center; gap:10px; margin-right:auto; text-decoration:none; }
.brand .mark{
  width: 34px; height:34px; border-radius: 9px; flex:none;
  background: var(--accent); color: var(--accent-ink);
  display:grid; place-items:center; font-weight:800; font-size:18px;
  font-family:'Archivo Narrow','Archivo',sans-serif;
}
.brand span{ font-weight:700; font-size:17px; font-family:'Archivo Narrow','Archivo',sans-serif; }
.user-chip{ color: var(--muted); font-size:12.5px; margin-right:4px; }
.icon-btn{
  width:38px; height:38px; border-radius:9px; border:1px solid var(--line);
  background: var(--panel-2); color: var(--text); display:grid; place-items:center;
  cursor:pointer; flex:none; text-decoration:none;
}
.icon-btn:hover{ border-color: var(--accent); }
.icon-btn svg{ width:19px; height:19px; fill: currentColor; }
.icon-btn{ position:relative; }
.icon-badge{
  position:absolute; top:-5px; right:-5px; min-width:16px; height:16px; padding:0 3px;
  border-radius:8px; background: var(--red); color:#fff; font-size:10px; font-weight:700;
  display:flex; align-items:center; justify-content:center; line-height:1;
}

/* ---------- Layout ---------- */
main{ max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; }
.card{
  background: var(--panel); border:1px solid var(--line); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow);
}
h1,h2,h3{ font-family:'Archivo Narrow','Archivo',sans-serif; margin:0 0 8px; }
h1{ font-size:22px; } h2{ font-size:19px; } h3{ font-size:16px; }
.muted{ color: var(--muted); font-size: 13.5px; }
.section-title{
  font-family:'Archivo Narrow','Archivo',sans-serif; font-weight:700; font-size:13px;
  text-transform:uppercase; letter-spacing:.04em; color: var(--muted); margin: 26px 0 10px;
}
.section-title:first-child{ margin-top:0; }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border-radius:10px; border:1px solid var(--line); background: var(--panel-2);
  color: var(--text); padding:10px 16px; font-weight:600; font-size:14.5px;
  cursor:pointer; text-decoration:none;
}
.btn.primary{ background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled, .btn.disabled{ opacity:.4; pointer-events:none; }
.btn.block{ width:100%; }

/* ---------- Startseite ---------- */
.quick-row{ display:flex; gap:12px; flex-wrap:wrap; }
.quick-card{
  flex:1; min-width:150px; background: var(--panel); border:1px solid var(--line);
  border-radius:12px; padding:14px 16px; text-decoration:none; color:var(--text);
  display:flex; align-items:center; gap:12px;
}
.quick-card .icn{
  width:36px; height:36px; border-radius:9px; background: var(--panel-2); display:grid; place-items:center; flex:none;
}
.quick-card .icn svg{ width:18px; height:18px; fill: var(--accent); }
.quick-card .t{ font-weight:700; font-size:14.5px; }
.quick-card .s{ font-size:12.5px; color: var(--muted); }

.book-grid{ display:grid; grid-template-columns: repeat(2, 1fr); gap:8px; }
@media (min-width:480px){ .book-grid{ grid-template-columns: repeat(3, 1fr); } }
.book-chip{
  display:block; padding:10px 12px; border-radius:10px; border:1px solid var(--line);
  background: var(--panel); text-decoration:none; color: var(--text); font-size:14px; font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.book-chip:hover{ border-color: var(--accent); }

/* ---------- Leseansicht ---------- */
.reader-title{ margin-bottom: 18px; }
.verse-line{ margin: 0 0 2px; }
.verse-num{ color: var(--accent); font-weight:700; font-size:13px; vertical-align: super; margin-right:2px; }
.verse-item{ cursor:pointer; border-radius:6px; padding:1px 3px; margin:-1px -3px; }
.verse-item.selected{ background: var(--accent); color: var(--accent-ink); }
.verse-item.bookmarked .verse-num{ color: var(--red); }
sup.note{ font-size:10px; color: var(--muted); }

.reader-nav{
  position: fixed; left:0; right:0; bottom:0; z-index:35;
  background: var(--panel); border-top:1px solid var(--line);
  display:flex; align-items:center; justify-content:space-around; gap:6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  transition: transform .25s ease-in-out;
}
.reader-nav.hide{ transform: translateY(100%); }
.reader-nav .nav-btn{
  border:1px solid var(--line); background: var(--panel-2); color:var(--text);
  border-radius:10px; padding:9px 14px; font-weight:700; cursor:pointer; text-decoration:none;
  font-size:15px;
}
.reader-nav .nav-btn.disabled{ opacity:.35; pointer-events:none; }
.reader-nav .picker{ flex:1; position:relative; min-width:0; }
.reader-nav .picker button{
  width:100%; border:1px solid var(--line); background: var(--panel-2); color:var(--text);
  border-radius:10px; padding:9px 10px; font-weight:600; cursor:pointer; font-size:14px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.picker-menu{
  position:absolute; bottom: calc(100% + 8px); left:0; right:0; max-height:45vh; overflow-y:auto;
  background: var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow: var(--shadow);
  padding:6px; display:none;
}
.picker-menu.open{ display:block; }
.picker-menu a{
  display:block; padding:9px 12px; border-radius:8px; text-decoration:none; color: var(--text); font-size:14px;
}
.picker-menu a:hover, .picker-menu a.active{ background: var(--panel-2); color: var(--accent); }

#floatingToolbar{
  position:absolute; z-index:1000; display:flex; gap:8px;
  opacity:0; transform: scale(.5) translateY(6px); transition: opacity .2s, transform .2s;
  pointer-events:none;
}
#floatingToolbar.visible{ opacity:1; transform: scale(1) translateY(0); pointer-events:auto; }
#floatingToolbar button{
  width:44px; height:44px; border-radius:50%; border:none; cursor:pointer;
  background: var(--accent); color: var(--accent-ink); display:flex; align-items:center; justify-content:center;
  box-shadow: var(--shadow);
}
#floatingToolbar button svg{ width:20px; height:20px; fill: currentColor; }
#floatingToolbar button.bookmark-btn.active{ background: var(--red); color:#fff; }

/* ---------- Suche ---------- */
.search-form{ display:flex; gap:8px; margin-bottom: 12px; position:relative; }
.search-form input{
  flex:1; border:1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius:10px; padding:12px 14px; font-size:15px;
}
.search-form input:focus{ outline:none; border-color: var(--accent); }
.search-spinner{
  position:absolute; right:14px; top:50%; transform:translateY(-50%);
  width:16px; height:16px; border-radius:50%;
  border:2px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite; opacity:0; transition:opacity .15s;
}
.search-spinner.visible{ opacity:1; }
@keyframes spin{ to{ transform: translateY(-50%) rotate(360deg); } }

.filter-row{ display:flex; gap:8px; align-items:center; margin-bottom:16px; flex-wrap:wrap; }
.filter-pill{
  border:1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius:20px; padding:6px 14px; font-size:13.5px; font-weight:600; cursor:pointer;
}
.filter-pill.active{ background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.book-select{
  border:1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius:20px; padding:6px 12px; font-size:13.5px; font-weight:600; cursor:pointer;
  max-width:180px;
}

.hint-box{
  background: var(--panel-2); border:1px solid var(--line); border-radius:10px;
  padding:10px 14px; font-size:14px; margin-bottom: 14px;
}
.hint-box a{ color: var(--accent); font-weight:700; text-decoration:none; }
.result-summary{ color: var(--muted); font-size:13.5px; margin-bottom:14px; }
.result-group{ margin-bottom:20px; }
.result-group-title{
  display:flex; align-items:baseline; gap:8px; margin-bottom:8px;
  font-family:'Archivo Narrow','Archivo',sans-serif; font-weight:700; font-size:15px;
}
.result-group-title .cnt{ color: var(--muted); font-weight:500; font-size:12.5px; }
.result-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.result-item{
  border:1px solid var(--line); border-radius:12px; padding:12px 14px; background: var(--panel);
  text-decoration:none; color:var(--text); display:block;
}
.result-item:hover{ border-color: var(--accent); }
.result-ref{ font-weight:700; color: var(--accent); font-size:13.5px; margin-bottom:4px; }
.result-text{
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  color: var(--muted); font-size:14.5px;
}

/* ---------- Lesezeichen ---------- */
.bookmark-item{
  border:1px solid var(--line); border-radius:12px; padding:12px 14px; background: var(--panel);
  margin-bottom:10px; display:flex; gap:10px; align-items:flex-start;
}
.bookmark-item .body{ flex:1; min-width:0; }
.bookmark-item a.ref{ font-weight:700; color: var(--accent); text-decoration:none; font-size:14px; }
.bookmark-item .txt{ font-size:14.5px; margin-top:4px; color: var(--text); }
.bookmark-item .remove{
  border:none; background:none; color: var(--muted); cursor:pointer; padding:4px; flex:none;
}
.bookmark-item .remove svg{ width:18px; height:18px; fill:currentColor; }
.empty-state{ text-align:center; color: var(--muted); padding: 40px 20px; }

/* ---------- Login ---------- */
.login-wrap{ min-height: 100vh; display:flex; align-items:center; justify-content:center; padding:20px; }
.login-card{ width:100%; max-width:340px; background: var(--panel); border:1px solid var(--line);
  border-radius:16px; padding:28px 24px; box-shadow: var(--shadow); text-align:center; }
.login-mark{ width:54px; height:54px; margin:0 auto 14px; border-radius:14px; background: var(--accent);
  color: var(--accent-ink); display:grid; place-items:center; font-weight:800; font-size:26px;
  font-family:'Archivo Narrow','Archivo',sans-serif; }
.login-card h2{ margin:0 0 4px; }
.login-sub{ margin:0 0 20px; color: var(--muted); font-size:13.5px; }
.login-card .field{ margin-bottom:14px; text-align:left; }
.login-card input[type="password"], .login-card input[type="text"]{
  width:100%; background: var(--bg); border:1px solid var(--line); color: var(--text);
  border-radius:10px; padding:12px 14px; font-size:15px;
}
.login-card input:focus{ outline:none; border-color: var(--accent); }
.login-remember{ display:flex; align-items:center; gap:8px; justify-content:center; margin-bottom:16px; font-size:14px; color: var(--muted); }
.login-remember input{ accent-color: var(--accent); width:16px; height:16px; }
.login-error{ color: var(--red); font-size:13px; min-height:18px; margin-bottom:6px; }
.login-alt{ margin-top:16px; font-size:13.5px; color: var(--muted); }
.login-alt a{ color: var(--accent); font-weight:700; text-decoration:none; }
