@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0d1117;
  --bg-2: #121821;
  --panel: #161d28;
  --panel-2: #1b2431;
  --line: #263142;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #5eead4;
  --accent-2: #38bdf8;
  --var-bg: rgba(94, 234, 212, 0.12);
  --var-text: #99f6e4;
  --missing-bg: rgba(251, 191, 36, 0.14);
  --missing-text: #fcd34d;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(900px 400px at 0% 0%, rgba(94, 234, 212, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Noto Sans Arabic", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.8;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 28px; }

.top { border-bottom: 1px solid var(--line); background: rgba(13, 17, 23, 0.7); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand strong { display: block; font-size: 16px; line-height: 1.3; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #052e2b;
  font-weight: 800; font-size: 20px;
}
.top-links { display: flex; gap: 20px; font-size: 14px; }
.top-links a { color: var(--muted); }
.top-links a:hover { color: var(--text); }

.hero { padding: 26px 0 14px; }
.hero h1 { font-size: 30px; line-height: 1.5; margin: 0 0 8px; font-weight: 800; }
.accent { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); margin: 0 0 16px; max-width: 900px; }

.search { position: relative; max-width: 760px; }
.search svg { position: absolute; right: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input {
  width: 100%; height: 52px; padding: 0 48px 0 56px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: inherit; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.15); }
.search input::placeholder { color: #66748a; }
.search kbd { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  font: inherit; font-size: 14px; color: var(--muted); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 14px; cursor: pointer; transition: all .15s;
}
.chip span { font-size: 12px; opacity: .75; margin-inline-start: 4px; }
.chip:hover { color: var(--text); border-color: #3a4a60; }
.chip.active { color: #052e2b; background: var(--accent); border-color: var(--accent); font-weight: 600; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 22px; padding: 10px 0 40px; align-items: start; }
.results-head { color: var(--muted); font-size: 13px; margin: 4px 2px 10px; }
.list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  text-align: right; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s, transform .15s, background .15s;
}
.card:hover { border-color: #3a4a60; transform: translateY(-1px); }
.card.active { border-color: var(--accent); background: var(--panel-2); box-shadow: inset 0 0 0 1px rgba(94,234,212,.25); }
.card h3 { margin: 0; font-size: 15px; line-height: 1.6; font-weight: 700; }
.card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tag { font-size: 11.5px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; }
.tag.cat { color: var(--accent); border-color: rgba(94,234,212,.3); }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

.detail {
  position: sticky; top: 80px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 24px; max-height: calc(100vh - 100px); overflow: auto;
}
.detail-empty { color: var(--muted); text-align: center; padding: 60px 0; }
.detail-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.detail-meta code { color: var(--muted); font-size: 12px; direction: ltr; }
.badge { color: #052e2b; background: var(--accent); border-radius: 999px; padding: 1px 12px; font-size: 12.5px; font-weight: 600; }
.detail h2 { margin: 10px 0 2px; font-size: 21px; line-height: 1.5; }
.muted { color: var(--muted); margin: 0 0 12px; }

.vars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 16px; }
.vars label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.vars label.wide { grid-column: 1 / -1; }
.vars input, .vars textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; outline: none; resize: vertical;
}
.vars textarea { min-height: 70px; }
.vars input:focus, .vars textarea:focus { border-color: var(--accent); }
.vars input::placeholder, .vars textarea::placeholder { color: #5d6a7e; }

.out-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.out-head h3 { margin: 0; font-size: 15px; }
.actions { display: flex; gap: 8px; }
.btn {
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; border-radius: 10px; padding: 6px 14px;
  border: 1px solid var(--accent); background: var(--accent); color: #052e2b;
}
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { border-color: #3a4a60; }
.btn.done { background: #22c55e; border-color: #22c55e; }

.output {
  margin: 0; white-space: pre-wrap; word-wrap: break-word; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; font-family: inherit; font-size: 14px; line-height: 2; color: #d5dde7;
}
.output .v { background: var(--var-bg); color: var(--var-text); border-radius: 5px; padding: 1px 5px; }
.output .v.missing { background: var(--missing-bg); color: var(--missing-text); }

.foot { color: var(--muted); font-size: 13px; padding: 18px 28px 30px; border-top: 1px solid var(--line); }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .detail { position: static; max-height: none; }
  .list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .hero h1 { font-size: 23px; }
  .vars { grid-template-columns: 1fr; }
  .top-links a:last-child { display: none; }
}
