@font-face { font-family: "Readex Pro"; src: url("fonts/readex-pro-arabic-wght-normal.woff2") format("woff2"); font-weight: 160 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Readex Pro"; src: url("fonts/readex-pro-latin-wght-normal.woff2") format("woff2"); font-weight: 160 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "Reem Kufi"; src: url("fonts/reem-kufi-arabic-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Reem Kufi"; src: url("fonts/reem-kufi-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ground: #f4efe6;
  --sheet: #fffcf6;
  --ink: #1e1b16;
  --soft: rgb(30 27 22 / 0.6);
  --line: rgb(30 27 22 / 0.14);
  --hidden: #b5179e;
  --change: #0f6e6e;
  --cut: #b42318;
  --ui: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --ground: #171511; --sheet: #211e19; --ink: #f1ebdf; --soft: rgb(241 235 223 / 0.62); --line: rgb(241 235 223 / 0.14); --hidden: #f15bd8; --change: #4fd1c5; --cut: #ff7a6b; color-scheme: dark; }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.6 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--change); outline-offset: 2px; }

.bar { display: flex; align-items: baseline; gap: 4px 20px; flex-wrap: wrap; padding: 14px 24px 10px; }
.brand { margin: 0; font: 700 30px/1.2 "Reem Kufi", var(--ui); }
.purpose { flex: 1; margin: 0; color: var(--soft); }
.bar-meta { color: var(--soft); font-size: 13px; }
.bar-meta .lang { margin-inline-start: 12px; unicode-bidi: isolate; }
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.head-actions { display: flex; gap: 14px; }
.link:disabled { opacity: 0.4; cursor: default; }
.glossary { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; font-size: 12.5px; }
.glossary div { display: flex; gap: 5px; }
.glossary dt { font: 500 11px/1.9 "IBM Plex Mono", ui-monospace, monospace; color: var(--hidden); }
.glossary dd { margin: 0; color: var(--soft); }

.desk { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr) minmax(0, 1.15fr); gap: 14px; padding: 0 24px 20px; }
.col { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 14px 16px; border-radius: 8px; background: var(--sheet); }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
.link { padding: 0; border: 0; background: none; color: var(--change); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.primary { padding: 6px 18px; border: 0; border-radius: 8px; background: var(--ink); color: var(--sheet); font-weight: 600; }

textarea { flex: 1 1 40%; min-height: 120px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; resize: none; font-size: 16px; line-height: 1.8; }
textarea:focus { outline: none; border-color: var(--ink); }
textarea::placeholder { color: var(--soft); }
.reveal, .output { flex: 1 1 40%; min-height: 80px; overflow-y: auto; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 2; }
.output { flex: 1; border-style: solid; font-size: 17px; }
.empty { color: var(--soft); }
.tally { font-size: 13px; font-weight: 600; color: var(--hidden); }
.hint { margin: 0; font-size: 12.5px; color: var(--soft); }

/* The stamps: hidden characters made visible */
mark.hid { display: inline-block; margin: 0 1px; padding: 0 4px; border: 1px solid var(--hidden); border-radius: 4px; background: color-mix(in srgb, var(--hidden) 12%, transparent); color: var(--hidden); font: 500 10.5px/1.6 "IBM Plex Mono", ui-monospace, monospace; vertical-align: 2px; }
del { color: var(--cut); text-decoration: line-through; text-decoration-thickness: 1.5px; }
del mark.hid { border-color: var(--cut); color: var(--cut); background: color-mix(in srgb, var(--cut) 10%, transparent); text-decoration: line-through; }
del.gap { text-decoration: none; font-weight: 700; letter-spacing: 1px; }
del:not(.gap) + ins { margin-inline-start: 3px; }
ins { color: var(--change); text-decoration: none; background: color-mix(in srgb, var(--change) 14%, transparent); border-radius: 3px; }
.summary { margin: 0; font-size: 13.5px; color: var(--soft); }
.toggle { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; font-size: 13.5px; cursor: pointer; }
.toggle input, .rule input, .digits input { accent-color: var(--change); }

/* Rules */
.rules { overflow-y: auto; }
.presets { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.presets button { padding: 4px 12px; border: 0; background: none; font-weight: 600; font-size: 14px; }
.presets button + button { border-inline-start: 1px solid var(--line); }
.presets button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }
.group, .digits { margin: 0; padding: 0; border: 0; }
.group legend, .digits legend { padding: 0; margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--soft); }
.group + .group { margin-top: 6px; }
.rule { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.rule input { margin-top: 5px; }
.rule-text { display: grid; line-height: 1.4; }
.rule-text b { font-weight: 600; }
.rule-text small { color: var(--soft); font-size: 12.5px; }
.count { min-width: 2.2em; padding: 0 6px; border-radius: 999px; text-align: center; font-size: 13px; font-weight: 600; color: var(--soft); }
.count.hit { background: var(--change); color: var(--sheet); }
.digits { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 8px; }
.digits legend { width: 100%; }
.digits label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.digits .count { margin-inline-start: auto; }

.toast { position: fixed; left: 50%; bottom: 24px; margin: 0; padding: 10px 16px; border-radius: 8px; background: var(--ink); color: var(--sheet); font-weight: 600; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { margin-inline-start: 8px; padding: 0; border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media (min-width: 1000px) and (min-height: 640px) { .app { height: 100dvh; } }
@media (max-width: 999px) {
  .bar { padding-inline: 16px; }
  .purpose { flex-basis: 100%; order: 3; }
  .desk { grid-template-columns: 1fr; padding: 0 16px 20px; }
  textarea { min-height: 160px; }
  .reveal, .output { max-height: 50vh; }
}

/* Questions under the tool: for people who scroll, and for search engines */
.faq { max-width: 920px; margin: 0 auto; padding: 56px 20px 64px; }
.faq h2 { margin: 0 0 20px; font: 700 22px/1.2 var(--ui); letter-spacing: -0.02em; }
.faq-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 32px; }
.faq h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.faq p { margin: 0; color: var(--soft); line-height: 1.6; }
