:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1b1b1b;
  --muted: #5d625f;
  --line: #e3e1da;
  --accent: #0f5c4d;
  --accent-soft: #e4f0ec;
  --on-accent: #ffffff;
  --warn-bg: #fff6e0;
  --warn-line: #e8c56a;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141615; --surface: #1c1f1e; --text: #ecebe6; --muted: #a3a8a5;
    --line: #2e3331; --accent: #5cc4a8; --accent-soft: #1f3530; --on-accent: #0b1f1a;
    --warn-bg: #33291a; --warn-line: #8a6d2d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; padding: 12px 16px; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 20px; }
nav a { margin-right: 16px; text-decoration: none; color: var(--muted); }
nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.hero { padding: 28px 0 8px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.25; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 8px; max-width: 46em; }
.crumbs { padding-top: 16px; font-size: 14px; color: var(--muted); }

.tool, .content { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.content h2 { margin-top: 8px; font-size: 1.3rem; }
.content h3 { font-size: 1.05rem; margin-bottom: 4px; }
.field-label { display: block; font-weight: 600; margin: 16px 0 6px; }
.field-label:first-child { margin-top: 0; }
.input {
  width: 100%; font: inherit; font-size: 18px; padding: 12px 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.arabic-input { font-size: 28px; line-height: 2; font-family: "Noto Naskh Arabic", "Amiri", serif; resize: vertical; }

.segments { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.segments li { font-size: 14px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; background: var(--bg); }
.segments .src-dictionary { border-color: var(--accent); }
.segments .src-approximate { border-color: var(--warn-line); background: var(--warn-bg); }
.segments .src-local { border-style: dashed; border-color: var(--accent); }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 10px 14px; font-size: 15px; }

.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chip[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.options { display: flex; gap: 16px; font-size: 14px; color: var(--muted); align-items: center; }
.options input[type="color"] { width: 32px; height: 28px; border: none; background: none; vertical-align: middle; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.card[hidden] { display: none; }
/* Previews sit on paper white so the chosen ink colour looks as it will in the PNG. */
.card-preview { background: #ffffff; border-radius: 8px; min-height: 110px; display: grid; place-items: center; font-size: 40px; line-height: 2.4; text-align: center; overflow-wrap: anywhere; padding: 0 8px; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.card-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.tag { font-size: 12px; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

.btn { display: inline-block; font: inherit; font-size: 15px; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 16px; }
.btn-secondary { background: transparent; color: var(--accent); }
.btn:disabled { opacity: .5; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.font-list { display: grid; gap: 8px; }
.font-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); background: var(--bg); }
.font-row:hover { border-color: var(--accent); }
.font-sample { font-size: 34px; line-height: 2; }
.font-info { display: flex; flex-direction: column; font-size: 14px; color: var(--muted); }
.font-info strong { color: var(--text); }

.specimen { font-size: 56px; padding: 16px; border: 1px dashed var(--line); border-radius: 10px; margin-top: 12px; overflow-wrap: anywhere; }
input[type="range"] { width: 100%; max-width: 360px; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data td[dir="rtl"] { text-align: right; font-size: 20px; }
.small { font-size: 14px; color: var(--muted); }
code { background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; }

.site-footer { color: var(--muted); font-size: 14px; padding: 24px 0 40px; }
