:root {
  /* فقط تم تاریک */
  color-scheme: dark;
  --bg: #1a1716;
  --surface: #24201e;
  --surface-2: #2d2826;
  --text: #efe8e2;
  --muted: #a69b92;
  --line: #3a3431;
  --accent: #e08598;
  --accent-2: #f0a3b3;
  --accent-soft: #3a2429;
  --ok: #7cc79b;
  --ok-soft: #1f3328;
  --warn: #e8b766;
  --warn-soft: #3a2f1c;
  --man: #7fa9dd;
  --woman: #e08598;
  --radius: 16px;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.hidden { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

button, .btn {
  font: inherit;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: background .15s, opacity .15s;
}
button:hover { background: var(--accent-2); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button.ghost:hover { background: var(--surface-2); }
button.soft { background: var(--accent-soft); color: var(--accent-2); }
button.big { padding: 16px 20px; font-size: 1.1rem; width: 100%; }

input, textarea {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; min-height: 96px; }
label { display: block; margin-bottom: 6px; font-weight: 500; }

.role-card {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.role-card:hover { border-color: var(--accent); background: var(--surface); }
.role-card .em { font-size: 2.2rem; display: block; }
.role-card .who { font-size: 1.15rem; font-weight: 600; }

.pin {
  font-size: 3rem;
  letter-spacing: .4em;
  font-weight: 700;
  direction: ltr;
  text-align: center;
  padding: 16px;
  background: var(--accent-soft);
  color: var(--accent-2);
  border-radius: var(--radius);
  margin: 16px 0;
  font-variant-numeric: tabular-nums;
}
.pin-input { font-size: 2rem; letter-spacing: .5em; text-align: center; direction: ltr; max-width: 240px; margin: 0 auto; display: block; }

.note {
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: .9rem;
}
.note.ok { background: var(--ok-soft); color: var(--ok); }
.error { color: #ff8a80; min-height: 1.5em; font-size: .92rem; }

/* home */
.module {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.module:first-child { border-top: 0; }
.module .num {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); font-weight: 700;
}
.module.done .num { background: var(--ok-soft); color: var(--ok); }
.module.locked { opacity: .55; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { font-size: .82rem; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.module .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.module .actions button { padding: 8px 14px; font-size: .92rem; }

/* session */
.session-head { position: sticky; top: 0; background: var(--bg); padding: 12px 0; z-index: 2; }
.presence { display: flex; gap: 14px; font-size: .88rem; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line); margin-inline-end: 6px; vertical-align: middle; }
.dot.on { background: var(--ok); }
.timer { font-variant-numeric: tabular-nums; direction: ltr; color: var(--muted); font-size: .9rem; }

.stage {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0 16px;
}
.bubble {
  border-radius: 20px;
  padding: 18px 20px;
  font-size: 1.07rem;
  white-space: pre-wrap;
  animation: fade .35s ease;
}
.bubble.counselor { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.bubble.person { background: var(--accent-soft); align-self: flex-start; max-width: 92%; }
.bubble.person.man { background: color-mix(in srgb, var(--man) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--man) 45%, transparent); }
.bubble.person.woman { background: color-mix(in srgb, var(--woman) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--woman) 45%, transparent); }
.who-label { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.overlay-msg {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}
.overlay-msg .big { font-size: 2rem; display: block; margin-bottom: 8px; }
.turn { text-align: center; font-weight: 600; margin: 4px 0 10px; }
.turn.mine { color: var(--accent); }
.composer { display: grid; gap: 10px; }
.composer .row button { flex: 1; }

/* assessment */
.q { padding: 14px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.scale label { margin: 0; font-weight: 400; }
.scale input { display: none; }
.scale span {
  display: block; text-align: center; font-size: .78rem; padding: 8px 2px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; line-height: 1.4;
}
.scale input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
.result { padding: 12px 0; border-top: 1px solid var(--line); }
.result .bars { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; font-size: .85rem; margin-top: 6px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; }
.bar.man i { background: var(--man); }
.bar.woman i { background: var(--woman); }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.brand { font-weight: 700; font-size: 1.1rem; }
.conn { position: fixed; bottom: 16px; left: 16px; right: 16px; max-width: 520px; margin: 0 auto; z-index: 5; text-align: center; }

/* نشانگر بارگذاری */
.spinner {
  display: inline-block;
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* جلسه‌ی مشترک: پیام و جواب مشاور کنار هم */
.pair { display: flex; flex-direction: column; gap: 12px; }
.pair .bubble.person { align-self: flex-start; }

/* ================= نسخه‌ی عمومی ================= */
button.ok { background: var(--ok); color: #14241b; }
button.ok:hover { background: color-mix(in srgb, var(--ok) 85%, #fff); }
button.sm { padding: 6px 12px; font-size: .88rem; }
a { color: var(--accent-2); }
.link { background: none; border: 0; padding: 0; color: var(--accent-2); text-decoration: underline; cursor: pointer; font: inherit; }
.link:hover { background: none; }
.ltr { direction: ltr; unicode-bidi: embed; }
input.ltr { text-align: left; }
.note.info { background: var(--accent-soft); color: var(--accent-2); }
.chip.free { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.role-card.sel { border-color: var(--accent); background: var(--accent-soft); }
.hero-ic { font-size: 2.4rem; }
.module.locked { opacity: .6; }
.module.locked .num { font-size: 1rem; }

/* کد تأیید */
.otp { display: flex; gap: 10px; justify-content: center; direction: ltr; margin: 14px 0; }
.otp input {
  width: 56px; height: 62px; padding: 0; text-align: center; font-size: 1.6rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* کارت «برنامه‌ی کامل» */
.unlock { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

/* پرداخت */
.steps-line { display: flex; margin: 6px 0 16px; font-size: .78rem; color: var(--muted); }
.steps-line span { flex: 1; text-align: center; border-top: 3px solid var(--line); padding-top: 4px; }
.steps-line span.on { border-color: var(--accent); color: var(--accent-2); font-weight: 700; }
.kv { display: flex; justify-content: space-between; gap: 12px; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.cardnum { background: linear-gradient(135deg, #b5566b, #7d3446); color: #fff; border-radius: 18px; padding: 18px; margin: 12px 0; }
.cardnum .n { font-size: 1.25rem; letter-spacing: .04em; white-space: nowrap; direction: ltr; text-align: center; font-weight: 700; margin: 10px 0; font-variant-numeric: tabular-nums; }
.cardnum .row { justify-content: space-between; font-size: .88rem; }
.cardnum button { background: rgba(255,255,255,.2); color: #fff; padding: 2px 12px; font-size: .82rem; border-radius: 8px; }
.upload { display: block; border: 2px dashed var(--line); border-radius: 14px; padding: 20px; text-align: center; color: var(--muted); margin-bottom: 12px; cursor: pointer; font-weight: 400; }
.upload:hover { border-color: var(--accent); }
.upload .em { font-size: 1.8rem; display: block; }
.upload img { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; margin: 0 auto 8px; }
.field { margin-bottom: 12px; }
.field input { margin: 0; }

/* حلقه‌ی درصد هم‌نظری */
.ring { --p: 0; margin: 4px auto 10px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring div { width: 80%; height: 80%; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; }
