@font-face { font-family: 'AL-KANZ'; src: url(fonts/AL-KANZ.ttf); font-display: swap; }
@font-face { font-family: 'Kanz-al-Marjaan'; src: url(fonts/Kanz-al-Marjaan.ttf); font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url(fonts/fraunces-normal.woff2) format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url(fonts/fraunces-italic.woff2) format('woff2'); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url(fonts/instrument-sans-normal.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --bg-a: #eef3eb; --bg-b: #dde7da; --card: #ffffff; --ink: #1c261e; --mute: #66756a; --line: #e1e9de; --chip: #eef3ec;
  --green: #5b7d5e; --green-h: #4a6a4d; --on-green: #ffffff; --green-soft: #e3ecdf;
  --amber: #8a6410; --amber-bg: #fbf0c9; --amber-line: #efd98a;
  --shadow: 0 1px 2px rgba(50,80,52,.06), 0 12px 32px rgba(50,80,52,.10);
  --serif: 'Fraunces', Georgia, serif; --sans: 'Instrument Sans', system-ui, sans-serif; --ease: cubic-bezier(.2,.7,.2,1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg-a: #121a14; --bg-b: #0d1310; --card: #19241c; --ink: #e8f0e6; --mute: #9db1a1; --line: #263429; --chip: #213026;
    --green: #86ad8a; --green-h: #a2c5a6; --on-green: #0e1a11; --green-soft: #23362a;
    --amber: #f1d37a; --amber-bg: #3a3011; --amber-line: #6b5920; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font: 17px/1.5 var(--sans); min-height: 100dvh; background: linear-gradient(170deg, var(--bg-a), var(--bg-b)) fixed; padding-bottom: 120px; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.kanz { font-family: 'AL-KANZ', serif; } .marjaan { font-family: 'Kanz-al-Marjaan', serif; }
.muted { color: var(--mute); font-size: 15px; }

.app { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 6px; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; transition: transform .12s; }
.round:active { transform: scale(.94); }
.round.sm { width: 42px; height: 42px; box-shadow: none; background: var(--chip); flex: none; }
.round.big { width: 58px; height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.b-en { font: 500 25px/1 var(--serif); letter-spacing: -.02em; }
.b-ar { font-size: 28px; line-height: 1; color: var(--green); padding-left: 12px; border-left: 1px solid color-mix(in srgb, var(--mute) 35%, transparent); }

.layout { padding-top: 14px; display: grid; gap: 18px; }
.display { margin: 8px 0 8px; font: 400 clamp(38px, 11vw, 62px)/1.02 var(--serif); letter-spacing: -.03em; font-variation-settings: 'opsz' 144; }
.display em { font-style: normal; color: var(--green); display: block; }
.sub { margin: 0 0 20px; color: var(--mute); font-size: 16px; max-width: 34ch; }

.card { background: var(--card); border-radius: 26px; box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.input { padding: 14px 18px 10px; }
textarea { display: block; width: 100%; resize: none; background: transparent; border: 0; color: var(--ink); padding: 8px 0 6px; font: 400 clamp(21px, 6vw, 27px)/1.4 var(--sans); min-height: 104px; }
textarea:focus { outline: none; }
textarea::placeholder { color: color-mix(in srgb, var(--mute) 55%, transparent); }
.in-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.try { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; padding: 2px 0; }
.try::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; background: var(--chip); border-radius: 999px; padding: 8px 14px; min-height: 38px; font-size: 14px; color: var(--mute); transition: background .15s, color .15s; }
.chip:hover { background: var(--green-soft); color: var(--ink); }
.clear { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--mute); display: grid; place-items: center; }
.clear[hidden] { display: none; }
.clear:hover { background: var(--chip); }

.result { padding: 16px 18px 16px; min-height: 230px; }
.r-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.label { margin: 0; font-size: 13px; font-weight: 600; color: var(--mute); letter-spacing: .02em; }
.seg { display: inline-flex; background: var(--chip); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; min-height: 36px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--mute); transition: background .15s, color .15s; }
.seg button[aria-checked="true"] { background: var(--green); color: var(--on-green); }

.dawat { font-size: clamp(38px, 10vw, 56px); line-height: 2.1; overflow-wrap: anywhere; text-align: left; padding: 6px 0 4px; min-height: 90px; }
.dawat:empty { display: none; }
.empty { margin: 0; min-height: 150px; display: grid; align-content: center; justify-items: center; color: var(--mute); font-size: 15px; text-align: center; }
.empty span { font-size: 70px; line-height: 1.3; color: var(--green-soft); }
.dawat:not(:empty) ~ .empty { display: none; }
.w { border-radius: 8px; cursor: pointer; transition: background .12s; }
.w:hover { background: var(--green-soft); }
.w.guess { background: var(--amber-bg); box-shadow: 0 2px 0 var(--amber-line); }

.status { margin-top: 10px; width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; border-radius: 18px; padding: 10px 12px; background: var(--green-soft); }
.status[hidden] { display: none; }
.s-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: var(--on-green); display: grid; place-items: center; flex: none; }
.s-ic .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.s-tx { flex: 1; font-weight: 600; font-size: 15px; line-height: 1.25; }
.s-go { display: none; font-weight: 700; font-size: 14px; padding: 8px 16px; border-radius: 999px; background: var(--ink); color: var(--card); }
.status.warn { background: var(--amber-bg); box-shadow: inset 0 0 0 1px var(--amber-line); }
.status.warn .s-ic { background: var(--amber); color: var(--amber-bg); } .status.warn .s-go { display: block; }
.status.ok { cursor: default; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 12px; justify-content: center; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, color-mix(in srgb, var(--bg-b) 94%, transparent) 60%, transparent); z-index: 5; pointer-events: none; }
.dock > * { pointer-events: auto; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 12px; height: 58px; padding: 0 32px; border: 0; border-radius: 999px; background: var(--green); color: var(--on-green); font-size: 18px; font-weight: 600; flex: 1; max-width: 420px; box-shadow: 0 10px 24px color-mix(in srgb, var(--green) 38%, transparent); transition: background .2s, transform .12s, opacity .2s; }
.pill:hover:not(:disabled) { background: var(--green-h); }
.pill:active:not(:disabled) { transform: scale(.98); }
.pill:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(12,22,14,.5); z-index: 20; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 600px; margin: 0 auto; max-height: 88dvh; overflow: auto; background: var(--card); border-radius: 30px 30px 0 0; padding: 8px 20px calc(22px + env(safe-area-inset-bottom)); animation: up .28s var(--ease) both; }
.sheet[hidden], .scrim[hidden] { display: none; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.grab { width: 44px; height: 5px; background: var(--line); border-radius: 3px; margin: 6px auto 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-head h2 { margin: 0; font: 400 28px/1.12 var(--serif); letter-spacing: -.02em; }
.sheet-head h2 em { font-style: normal; color: var(--green); word-break: break-word; }
.kicker { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.ticks { display: flex; gap: 6px; margin: 14px 0 6px; } .ticks:empty { display: none; }
.ticks i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.ticks i.done { background: var(--green); } .ticks i.now { background: var(--ink); }
.alts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.alt { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; text-align: left; min-height: 80px; padding: 6px 20px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--card); transition: border-color .12s, background .12s, transform .1s; }
.alt:hover { border-color: var(--green); background: var(--green-soft); }
.alt:active { transform: scale(.99); }
.alt[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }
.alt .d { font-size: 40px; line-height: 1.9; }
.alt .m { font-size: 12px; color: var(--mute); text-align: right; display: grid; gap: 3px; justify-items: end; }
.tg { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 10.5px; padding: 3px 9px; border-radius: 999px; background: var(--chip); }
.tg.exact { background: var(--green); color: var(--on-green); } .tg.guess { background: var(--amber-bg); color: var(--amber); }
.sheet-foot { display: flex; justify-content: space-between; margin-top: 10px; }
.link { background: none; border: 0; color: var(--mute); font-weight: 600; min-height: 46px; padding: 0 4px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line); }
.link:hover { color: var(--ink); } .link:disabled { opacity: .3; cursor: default; }
.steps { padding-left: 22px; margin: 14px 0; display: grid; gap: 12px; }
.menu { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.menu a, .menu button { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 6px 12px; border: 0; border-radius: 18px; background: transparent; text-decoration: none; font-size: 17px; font-weight: 500; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--chip); }
.m-ic { width: 40px; height: 40px; border-radius: 14px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; flex: none; }

.toast { position: fixed; left: 50%; bottom: 112px; transform: translate(-50%, 16px); background: var(--ink); color: var(--card); padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 15px; opacity: 0; pointer-events: none; transition: .22s var(--ease); z-index: 30; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 56px; padding-top: 48px; align-items: start; }
  .col-out { position: sticky; top: 24px; margin-top: 18px; }
  .sheet { bottom: 50%; transform: translateY(50%); border-radius: 30px; max-width: 520px; animation-name: fade; }
  .toast { bottom: 28px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
