/* رمل من — ساختار؛ رنگ‌ها و حال‌وهوا در theme.css */
@font-face {
  font-family: "Vazirmatn RM";
  src: url("/fonts/vazirmatn-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Vazirmatn RM", Tahoma, sans-serif;
  font-size: 1rem;
  line-height: 1.9;
  color: var(--ink);
  background: var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--accent); }
button, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 8px; top: 8px; background: var(--bg); padding: 6px 10px; z-index: 9; }

/* سربرگ */
.top {
  position: relative; display: flex; justify-content: center;
  max-width: 44rem; margin: 0 auto; padding: 14px 16px 0;
}
.brand { display: block; line-height: 0; border-radius: 50%; }
.brand img { width: 72px; height: 72px; border-radius: 50%; }
.top .icon-btn { position: absolute; inset-inline-end: 8px; top: 8px; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%; cursor: pointer; opacity: .55;
}
.icon-btn:hover { opacity: .85; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }

main { max-width: 44rem; margin: 0 auto; padding: 0 16px; }

/* سرآغاز */
.hero { text-align: center; padding: 12px 0 6px; }
.hero h1 { font-size: clamp(1.5rem, 6vw, 2.15rem); font-weight: 300; line-height: 1.55; margin: 0; letter-spacing: 0; }
.mission { margin: 4px auto 0; color: var(--mute); font-size: .95rem; max-width: 30rem; }

/* ریختن زایچه */
.cast { margin: 18px 0 8px; }
textarea {
  width: 100%; resize: vertical; min-height: 3.2em; padding: 10px 12px; line-height: 1.7;
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r);
}
.modes { display: flex; justify-content: center; gap: 4px; margin: 14px 0 8px; }
.modes button {
  min-height: 44px; padding: 0 18px; background: none; border: 0; cursor: pointer;
  color: var(--mute); border-bottom: 1px solid transparent;
}
.modes button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--line); }

.mothers { display: flex; justify-content: center; gap: 10px; min-height: 52px; margin: 6px 0 2px; }
.slot { width: 26px; height: 52px; border-bottom: 1px solid var(--line); }
.slot .fig { width: 26px; height: 52px; fill: var(--dot); }
.fig-title { text-align: center; color: var(--mute); margin: 4px 0 6px; font-size: .9rem; min-height: 1.7em; }

.lines { display: grid; gap: 8px; }
.loading { text-align: center; color: var(--mute); font-size: .9rem; padding: 40px 8px; }
.line {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  min-height: 76px; padding: 0 16px; cursor: pointer; touch-action: manipulation; user-select: none;
  -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  background: var(--pad); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.line-lab { color: var(--mute); font-size: .9rem; flex: none; }
.line-mark { position: absolute; inset: 0; pointer-events: none; }
.line-mark .dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--dot); }

.msg { min-height: 1.6em; margin: 6px 0; text-align: center; font-size: .88rem; color: var(--warn); }
.bar, .chart-actions { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.primary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 26px;
  background: var(--btn); color: var(--btnink); border: 0; border-radius: var(--r); text-decoration: none; cursor: pointer;
}
.primary[aria-disabled="true"] { opacity: .45; }
.quiet { min-height: 44px; padding: 0 14px; background: none; border: 0; color: var(--mute); cursor: pointer; }
.quiet:hover { color: var(--ink); }

.picks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pick { display: grid; grid-template-columns: 1fr 26px; align-items: center; gap: 4px 8px; }
.pick-lab { grid-column: 1 / -1; font-size: .85rem; color: var(--mute); }
.pick select { min-height: 44px; padding: 0 8px; background: var(--field); border: 1px solid var(--line); border-radius: var(--r); }
.pick-fig .fig { width: 22px; height: 44px; fill: var(--dot); }
#pane-pick .primary { display: flex; margin: 4px auto 0; }

/* زایچه: چیدمان کلاسیک، خانهٔ ۱ سمت راست */
.chart-wrap { margin: 22px 0 6px; scroll-margin-top: 12px; }
.chart { direction: ltr; max-width: 30rem; margin: 0 auto; padding: var(--chart-pad); background: var(--chart-bg); border: var(--chart-border); border-radius: var(--r-chart); container-type: inline-size; }
.chart .row { display: grid; gap: 0; }
.row-1 { grid-template-columns: repeat(8, 1fr); }
.row-2 { grid-template-columns: repeat(4, 1fr); }
.row-3 { grid-template-columns: repeat(2, 1fr); }
.row-4, .row-5 { grid-template-columns: 1fr; justify-items: center; }
.row-4 .house, .row-5 .house { width: 25%; }
.house {
  display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 3px 0 7px; direction: rtl;
  background: none; border: 0; box-shadow: 0 0 0 .5px var(--rule); border-radius: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color .25s;
}
.house .hn { font-size: max(8px, 1.8cqw); color: var(--mute); line-height: 1.2; opacity: .8; }
.house .fig { width: min(26px, 6.2cqw); height: min(52px, 12.4cqw); fill: var(--dot); margin-top: 3px; }
.house.same { background: var(--same); }
.chart-actions { margin-top: 16px; }
.note { text-align: center; color: var(--mute); font-size: .82rem; margin: 6px 0 0; }

/* معرفی */
.first-visit { display: block; text-align: center; margin: 18px 0 0; color: var(--mute); text-decoration: none; font-size: .9rem; }
.first-visit[hidden] { display: none; }
.about { margin: 36px 0 20px; padding-top: 18px; border-top: 1px solid var(--rule); }
.about h2 { font-size: 1.2rem; font-weight: 500; margin: 22px 0 6px; }
.about p, .about li { max-width: 36rem; color: var(--ink-2); }
.steps { padding-inline-start: 1.3em; }
.steps li { margin-bottom: 8px; }
.steps strong { font-weight: 600; color: var(--ink); }

.foot { max-width: 44rem; margin: 0 auto; padding: 18px 16px 28px; text-align: center; color: var(--mute); font-size: .85rem; border-top: 1px solid var(--rule); }
.foot nav { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.foot a { color: var(--mute); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.foot a:hover { color: var(--ink); }
.foot p { margin: 4px 0 0; }

.tafsir { text-align: center; padding: 30px 16px; }
.tafsir h1 { font-weight: 300; }

@media (min-width: 720px) {
  .picks { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
.tafsir-q { opacity: .75; }
.tafsir-status { opacity: .7; min-height: 1.5em; }
.tafsir-text { text-align: right; max-width: 38em; margin: 0 auto; line-height: 2.1; }
.tafsir-text p { margin: 0 0 1em; }
