.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin: 1rem 0;
  box-shadow: var(--card-shadow);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}

.lead {
  color: var(--text-muted);
  max-width: 66ch;
}

.back {
  margin: 0 0 0.75rem;
}

.back a {
  color: #546779;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.32rem 0.66rem;
  font-size: 0.84rem;
}

.hero-meta {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

input,
select,
button {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 0.72rem 0.9rem;
}

/* ── Button system ────────────────────────────────────────────── */

.btn,
.btn-sm,
.btn-outline,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  border: 0;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

/* Primary — form submits, main actions */
.btn {
  background: var(--accent);
  color: #fff;
  padding: 0.6em 1.15em;
  font-size: 0.92rem;
}

.btn:hover {
  background: var(--accent-strong);
}

/* Small — inline actions (Compare, Open, Resume) */
.btn-sm {
  background: var(--accent);
  color: #fff;
  padding: 0.35em 0.72em;
  font-size: 0.875rem;
}

.btn-sm:hover {
  background: var(--accent-strong);
}

/* Outline — secondary/cancel actions */
.btn-outline {
  background: #fff;
  color: #324a5e;
  border: 1px solid var(--border);
  padding: 0.58em 1.1em;
  font-size: 0.92rem;
}

.btn-outline:hover {
  background: #dce8ee;
  color: #142838;
}

.btn--copied,
.btn--copied:hover {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

/* Danger — destructive actions */
.btn-danger {
  background: #be123c;
  color: #fff;
  padding: 0.6em 1.15em;
  font-size: 0.92rem;
}

.btn-danger:hover {
  background: #9f1239;
}

@media (max-width: 768px) {
  .btn,
  .btn-outline,
  .btn-danger {
    padding: 0.55em 1em;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .btn,
  .btn-outline,
  .btn-danger {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 38px;
    padding: 0.4em 0.72em;
  }
}

.error-msg {
  grid-column: 1 / -1;
  margin: 0.06rem 0 0;
  color: #b91c1c;
  font-size: 0.9rem;
}

.collection-form,
.collection-save-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.7rem;
  align-items: end;
}

.collection-form label,
.collection-save-form label {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  font-weight: 600;
  color: #526679;
}

.collection-form input[id="collection-description"],
.collection-save-form input[name="note"] {
  grid-column: 1 / -1;
}

.collection-form button,
.collection-save-form button {
  width: fit-content;
}

.inline-form {
  margin: 0;
}

.meta {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.simple-list,
.related-list,
.pairs-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.simple-list li,
.related-item,
.pairs-list li {
  border-top: 1px solid var(--border);
  padding: 0.82rem 0;
}

.simple-list li:first-child,
.related-item:first-child,
.pairs-list li:first-child {
  border-top: 0;
}

.line-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.66rem;
  flex-wrap: wrap;
}

.verse-card {
  border-left: 4px solid #b8d8d3;
}

.arabic {
  margin: 0.72rem 0;
  font-family: "Amiri Quran", "Noto Naskh Arabic", serif;
  font-size: clamp(1.78rem, 3vw, 2.18rem);
  line-height: 2.06;
  direction: rtl;
  text-align: right;
  color: #0b2734;
}

.arabic-small {
  font-size: clamp(1.45rem, 2.7vw, 1.78rem);
}

.translation {
  margin: 0.5rem 0 0;
  border-top: 1px dashed var(--border);
  padding-top: 0.58rem;
  color: #4f6278;
  font-size: 0.99rem;
}

mark.word-unique {
  background: #ffe066;
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

.pair-refs {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.ayah-chip {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  background: #e8f4f2;
  border: 1px solid #b8d8d3;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1a6b5e;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.ayah-chip:hover {
  background: #c8eae4;
  border-color: #7bbdb5;
  color: #0f4f44;
}

.pairs-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.note {
  margin-top: 0.3rem;
}

.not-found-card {
  max-width: 540px;
  margin-top: 2.5rem;
}

.tafsir-card .tafsir-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.tafsir-card .tafsir-header h2 {
  margin: 0;
}

.tafsir-source {
  font-size: 0.85rem;
  color: var(--muted);
  display: block;
  margin-top: 0.18rem;
}

.tafsir-body {
  margin-top: 1rem;
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
  font-size: 0.97rem;
  line-height: 1.75;
  color: #2e3f4e;
}

.tafsir-body p {
  margin: 0 0 0.9rem;
}

.tafsir-body p:last-child {
  margin-bottom: 0;
}

.tafsir-body h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.1rem 0 0.4rem;
  color: #0b2734;
}

.not-found-card .button-link {
  margin-top: 0.5rem;
}

.qf-bookmarks-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.qf-bookmark-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
  min-width: 0;
}

.qf-bookmark-ref {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.qf-bookmark-links {
  display: flex;
  gap: 0.4rem;
}

.qf-bookmark-link {
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  border: 1px solid;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.qf-bookmark-link--internal {
  color: #1a6b5e;
  border-color: #b8d8d3;
  background: #e8f4f2;
}

.qf-bookmark-link--internal:hover {
  background: #c8eae4;
  border-color: #7bbdb5;
  color: #0f4f44;
}

.qf-bookmark-link--external {
  color: #5a6e7a;
  border-color: #d0dde4;
  background: #fff;
}

.qf-bookmark-link--external:hover {
  background: #eef3f6;
  border-color: #aac0cc;
  color: #2f4554;
}

.qf-synced-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.05rem 0.28rem;
  background: #e8f4f2;
  border: 1px solid #b8d8d3;
  border-radius: 3px;
  color: #1a6b5e;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.mastered-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.05rem 0.28rem;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 3px;
  color: #854d0e;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.mastered-form {
  margin-top: 0.75rem;
}

.btn-mastered {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45em 1em;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: #324a5e;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-mastered:hover {
  background: #fef9c3;
  border-color: #fde047;
  color: #713f12;
}

.btn-mastered--done,
.btn-mastered--done:hover {
  background: #fef9c3;
  border-color: #fde047;
  color: #854d0e;
}

@media (max-width: 640px) {
  .collection-form,
  .collection-save-form {
    grid-template-columns: 1fr;
  }

  .hero-meta {
    gap: 0.36rem;
  }
}
