:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --card-soft: #fbfcfd;
  --border: #e4e7ec;
  --text: #171717;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --accent: #0f766e;
  --accent-dark: #0b5f58;
  --accent-soft: #e6fffb;
  --danger: #b91c1c;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.05);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; }

.app-shell {
  max-width: 1420px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.brand { font-size: 30px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.byline { margin-top: 3px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: lowercase; color: var(--muted); }
.subtitle { color: var(--muted); font-size: 14px; margin-top: 6px; }
.topbar-right { display:flex; gap:10px; align-items:center; }
.status-pill {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--muted);
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}
.ghost-btn { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 8px 12px; cursor:pointer; }

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-panel { min-width: 0; }
.search-card {
  padding: 16px;
  position: sticky;
  top: 20px;
  z-index: 5;
}
.search-input-wrap {
  display: flex;
  align-items:center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--card-soft);
  border-radius: 15px;
  padding: 0 12px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.search-input-wrap:focus-within {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.10);
  background: #fff;
}
.search-input-wrap input {
  flex:1;
  min-width: 0;
  border:none;
  background:transparent;
  padding: 14px 0;
  outline:none;
  font-size:16px;
}
.clear-btn {
  border:none;
  background:transparent;
  font-size:24px;
  line-height:1;
  cursor:pointer;
  color:var(--muted);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}
.clear-btn:hover { background:#eef2f7; color:var(--text); }

.toolbar {
  display:flex;
  justify-content:flex-start;
  align-items:center;
  margin-top:12px;
  gap:10px;
  flex-wrap: wrap;
}
.segmented { display:flex; gap:8px; }
.seg-btn {
  border:none;
  background:#eef2f7;
  color:var(--muted);
  padding:8px 13px;
  border-radius:999px;
  cursor:pointer;
  font-weight: 600;
}
.seg-btn:hover { background:#e6ebf2; color:var(--text); }
.seg-btn.active { background: var(--accent); color:white; }
.small-note {
  color: var(--muted);
  font-size: 13px;
  background: #f7f9fb;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  white-space: nowrap;
}

.list {
  margin-top: 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.result-card {
  width:100%;
  text-align:left;
  cursor:pointer;
  padding:16px;
  border-radius:16px;
  background:var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.result-card:hover { transform: translateY(-1px); border-color:#cfd6df; box-shadow: var(--shadow); }
.result-card.active {
  outline: 2px solid rgba(15,118,110,0.16);
  border-color: var(--accent);
  background: linear-gradient(180deg, #fff 0%, #fbfffe 100%);
}
.result-main { min-width:0; flex:1; }
.result-de { font-size: 18px; font-weight:800; letter-spacing: -0.02em; }
.result-trans { color: var(--muted); margin-top: 4px; font-size: 13px; }
.result-meta { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.meta-chip { font-size: 12px; padding: 5px 10px; border-radius:999px; background:#f4f4f5; color:var(--muted); }
.result-ar {
  font-family: 'Noto Sans Arabic', sans-serif;
  font-size: 28px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 45%;
  line-height: 1.4;
}

.detail-panel { min-width: 0; }
.detail-card {
  min-height: 70vh;
  padding: 22px;
}
.empty-detail { min-height: 50vh; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; color:var(--muted); }
.empty-icon { font-size: 40px; }
.detail-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.detail-de { font-size: 32px; font-weight:800; letter-spacing:-0.05em; line-height: 1.1; }
.detail-trans { color: var(--muted); margin-top:6px; font-size: 16px; }
.favorite-btn {
  border:none;
  background:#f1f5f9;
  border-radius:16px;
  width:48px;
  height:48px;
  font-size:24px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
}
.favorite-btn:hover { background:#e7edf5; }
.detail-ar { margin-top: 16px; font-family:'Noto Sans Arabic', sans-serif; font-size: 42px; font-weight:800; line-height: 1.5; }
.chips { display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }
.section { margin-top: 22px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 10px; font-weight:800; }
.section-body { padding: 14px; background:var(--card-soft); border:1px solid var(--border); border-radius:14px; }
.verb-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:12px; }
.verb-item { padding:14px; border:1px solid var(--border); border-radius:14px; background:var(--card-soft); }
.verb-item span { display:block; color:var(--muted); font-size:12px; margin-bottom:8px; text-transform:uppercase; letter-spacing:0.04em; font-weight: 700; }
.example-card { padding:14px; border:1px solid var(--border); border-radius:14px; background:var(--card-soft); margin-bottom:10px; }
.example-de { font-size:16px; }
.example-ar { margin-top:10px; font-size:22px; font-family:'Noto Sans Arabic', sans-serif; line-height: 1.6; }
.selectable { user-select: text; -webkit-user-select: text; }
.mobile-back-btn { display:none; border:none; background:#f1f5f9; color:var(--text); border-radius:999px; padding:10px 14px; font-weight:700; margin-bottom:16px; cursor:pointer; }
.left-align { text-align: left; }
.arabic { direction: rtl; }
.hidden { display:none !important; }

.auth-overlay { position:fixed; inset:0; background: rgba(15,23,42,.55); display:flex; align-items:center; justify-content:center; padding:20px; z-index:50; }
.auth-card { width:min(420px, 100%); padding:24px; }
.auth-card h2 { margin-top:0; }
.auth-card input { width:100%; border:1px solid var(--border); border-radius:14px; padding:14px; margin-top:12px; }
.auth-card button { width:100%; border:none; background:var(--accent); color:white; border-radius:14px; padding:14px; margin-top:12px; cursor:pointer; }
.auth-error { color: var(--danger); margin-top: 10px; min-height: 20px; }
.empty-list { padding: 20px; text-align:center; color: var(--muted); }

/* Desktop: App-ähnliches Layout mit zwei getrennten Scrollbereichen */
@media (min-width: 981px) {
  html, body { height: 100%; overflow: hidden; }
  .app-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .topbar { flex: 0 0 auto; }
  .layout {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }
  .search-panel {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .search-card {
    position: relative;
    top: auto;
    flex: 0 0 auto;
  }
  .list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 6px 20px 1px;
    scroll-padding-top: 10px;
  }
  .detail-panel {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .detail-card {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-padding-top: 16px;
  }
  .list::-webkit-scrollbar,
  .detail-card::-webkit-scrollbar { width: 9px; }
  .list::-webkit-scrollbar-track,
  .detail-card::-webkit-scrollbar-track { background: transparent; }
  .list::-webkit-scrollbar-thumb,
  .detail-card::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.32);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  .list::-webkit-scrollbar-thumb:hover,
  .detail-card::-webkit-scrollbar-thumb:hover { background: rgba(107, 114, 128, 0.48); background-clip: padding-box; }
}

@media (max-width: 980px) {
  html, body { overflow: auto; }
  .layout { grid-template-columns: 1fr; }
  .detail-card { min-height: auto; }
  .search-card { position: static; }
  .result-ar { max-width: 40%; font-size:24px; }
  .detail-panel { display:none; }
  body.detail-open .search-panel { display:none; }
  body.detail-open .detail-panel { display:block; }
  .mobile-back-btn { display:inline-flex; align-items:center; justify-content:center; }
}

@media (max-width: 680px) {
  .app-shell { padding: 12px; }
  .topbar { align-items:flex-start; flex-direction:column; }
  .toolbar { align-items:center; }
  .small-note { font-size: 12px; padding: 6px 9px; }
  .detail-de { font-size: 26px; }
  .detail-ar { font-size: 34px; }
  .verb-grid { grid-template-columns: 1fr; }
  .result-card { padding: 15px; }
}

/* Entfernt die Treffer-Anzeige neben den Buttons */
.small-note {
  display: none !important;
}

/* Toolbar ohne Treffer-Badge sauberer ausrichten */
.toolbar {
  justify-content: flex-start !important;
  gap: 8px !important;
}

/* QAMUSI FIX: Kleine arabische Texte in der Web-App größer anzeigen.
   Die große Hauptübersetzung oben (.detail-ar) bleibt unverändert. */
.result-ar {
  font-size: 32px;
  line-height: 1.45;
}
.section-body.arabic,
.section-body .arabic,
#detailPlural {
  font-family: 'Noto Sans Arabic', sans-serif;
  font-size: 26px;
  line-height: 1.75;
}
.verb-item > div.arabic,
#detailVerbMadi,
#detailVerbMudari,
#detailVerbAmr,
#detailVerbMasdar {
  font-family: 'Noto Sans Arabic', sans-serif;
  font-size: 26px;
  line-height: 1.7;
  font-weight: 600;
}
.example-ar {
  font-size: 28px;
  line-height: 1.8;
}

@media (max-width: 980px) {
  .result-ar {
    font-size: 30px;
    max-width: 46%;
  }
  .section-body.arabic,
  .section-body .arabic,
  #detailPlural,
  .verb-item > div.arabic,
  #detailVerbMadi,
  #detailVerbMudari,
  #detailVerbAmr,
  #detailVerbMasdar {
    font-size: 27px;
  }
  .example-ar {
    font-size: 28px;
  }
}

@media (max-width: 680px) {
  .result-ar {
    font-size: 28px;
    max-width: 48%;
  }
  .section-body.arabic,
  .section-body .arabic,
  #detailPlural,
  .verb-item > div.arabic,
  #detailVerbMadi,
  #detailVerbMudari,
  #detailVerbAmr,
  #detailVerbMasdar {
    font-size: 26px;
  }
  .example-ar {
    font-size: 27px;
  }
}
