:root {
  /* تم تیره‌ی نرم: سرمه‌ای دودی + آکسان نیلی/بنفش ملایم و زمردی */
  --bg: #141824;
  --card: #1b2030;
  --field: #151a28;
  --text: #e4e8f1;
  --muted: #9fa8bf;
  --line: #2b3248;
  --accent: #5a68de;          /* پس‌زمینه‌ی دکمه‌ی اصلی */
  --accent-text: #ffffff;
  --accent-ink: #aab4ff;      /* متن/حاشیه‌ی تأکیدی روی زمینه‌ی تیره */
  --accent-soft: #252c4d;
  --emerald: #3fb68f;
  --emerald-soft: #1b2e2e;
  --danger: #ff9f99;
  --danger-soft: #38222a;
  --warn-soft: #373220;
  --warn-text: #e9d291;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Vazirmatn, "Vazir", Tahoma, "Segoe UI", system-ui, -apple-system, "Noto Naskh Arabic", sans-serif;
  line-height: 1.8; font-size: 16px;
}
.top, main, footer { max-width: 760px; margin-inline: auto; padding-inline: 16px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 20px 0 4px; }
.lead { color: var(--muted); margin: 8px 0 18px; }
.banner { background: var(--warn-soft); color: var(--warn-text); padding: 10px 16px; text-align: center; font-size: .92rem; }
.card { min-width: 0; max-width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
textarea, select, input[type="text"] {
  width: 100%; font: inherit; color: inherit; background: var(--field);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 120px; }
.counter { text-align: end; color: var(--muted); font-size: .8rem; direction: ltr; }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 2px; }
fieldset.chips { border: 0; padding: 0; margin: 14px 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.chips legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.chip { margin: 0; font-weight: 400; position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--field); font-size: .92rem; }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent-ink); color: var(--accent-ink); font-weight: 600; }
.chip input:focus-visible + span { outline: 3px solid var(--accent-ink); outline-offset: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
button { font: inherit; cursor: pointer; border-radius: 10px; padding: 10px 18px; border: 1px solid transparent; }
button.primary { background: var(--accent); color: var(--accent-text); font-weight: 700; }
#submitBtn { width: 100%; padding: 13px; font-size: 1.05rem; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button:disabled { opacity: .55; cursor: not-allowed; }
.status { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--accent-ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.error { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.error p { margin: 0 0 8px; }
.q { margin-bottom: 14px; }
.q .hint { margin: 2px 0 0; }
#resultPrompt {
  display: block; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  text-align: start; unicode-bidi: plaintext;
  font-family: inherit; font-size: .98rem; line-height: 1.9; letter-spacing: normal;
  background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 14px;
  margin: 0; max-height: 60vh; overflow: auto;
}
#explanation { overflow-wrap: anywhere; margin: 0; color: var(--muted); unicode-bidi: plaintext; }
footer { color: var(--muted); font-size: .8rem; padding-block: 8px 28px; text-align: center; }
[hidden] { display: none !important; }

/* دکمه‌های ارتباطی */
.contact { display: flex; gap: 10px; margin-bottom: 12px; }
.btn-link {
  flex: 1; display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem;
  background: var(--field); transition: border-color .15s, background .15s;
}
.btn-link:hover { background: var(--accent-soft); border-color: var(--accent-ink); }
.btn-link.support { border-color: var(--emerald); color: var(--emerald); }
.btn-link.support:hover { background: var(--emerald-soft); }
/* بنرهای تبلیغاتی */
.ads { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
@media (min-width: 560px) { .ads { grid-template-columns: 1fr 1fr; } }
.ad { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); line-height: 0; }
.ad img { width: 100%; height: auto; aspect-ratio: 4 / 1; object-fit: cover; display: block; }
.ad:hover { border-color: var(--accent-ink); }
