/* ==========================================================
   seespanish · تم مدرن، روشن و تیره
   این فایل بعد از استایل‌های هر صفحه بارگذاری می‌شود و آن‌ها را بازنویسی می‌کند.
   ========================================================== */

/* ---------- رنگ‌ها ---------- */
:root,
html[data-theme="light"] {
  --paper: #F6F3EC;
  --paper-2: #ECE7DA;
  --surface: #FFFFFF;
  --graphite: #1E1E26;
  --graphite-soft: #6E6E7B;
  --pencil: #F2C230;
  --accent-ink: #1E1E26;
  --ok: #D9EFD0;
  --bad: #F8D7D7;
  --line: #E3DDCD;
  --shadow: rgba(30, 30, 38, .10);
}

html[data-theme="dark"] {
  --paper: #111116;
  --paper-2: #1B1B23;
  --surface: #1C1C25;
  --graphite: #F1EEE6;
  --graphite-soft: #9D9DAB;
  --pencil: #F2C230;
  --accent-ink: #17171E;
  --ok: #22402A;
  --bad: #4A2727;
  --line: #2A2A35;
  --shadow: rgba(0, 0, 0, .45);
}

/* ---------- پس‌زمینه: نقطه‌های ظریف به جای خط‌های دفتر ---------- */
body {
  background-color: var(--paper) !important;
  background-image: radial-gradient(var(--line) 1px, transparent 1px) !important;
  background-size: 22px 22px !important;
  background-attachment: fixed !important;
  line-height: 1.8 !important;
  color: var(--graphite) !important;
}

/* ---------- هدر ---------- */
header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
  border-bottom: none !important;
  padding: 14px 0 16px !important;
  margin-bottom: 18px !important;
}

.logo {
  font-family: "Caveat", cursive !important;
  font-size: 2.4rem !important;
  color: var(--graphite) !important;
}
.logo span {
  background: var(--pencil) !important;
  color: var(--accent-ink) !important;
  border-radius: 10px !important;
  padding: 0 8px !important;
}

header nav {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  justify-content: flex-end !important;
  align-items: center !important;
}
header nav a,
.nav a,
.navlink,
.back {
  font-family: var(--body) !important;
  font-size: .95rem !important;
  color: var(--graphite) !important;
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  padding: 6px 14px !important;
  margin: 0 !important;
  text-decoration: none !important;
  box-shadow: 0 1px 2px var(--shadow) !important;
  white-space: nowrap;
}
header nav a:hover,
.nav a:hover,
.navlink:hover,
.back:hover { border-color: var(--pencil) !important; }

/* دکمه‌ی تغییر حالت روشن/تیره */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--graphite);
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 1px 2px var(--shadow);
  flex: 0 0 auto;
}

/* روی موبایل، منوی بالا حذف می‌شود چون منوی پایین جایش را گرفته */
@media (max-width: 640px) {
  header nav { display: none !important; }
  header { padding-top: 10px !important; }
}

/* ---------- کارت‌ها و سطح‌ها ---------- */
.card,
.panel,
.book,
.today,
.pathdetail,
.result,
.opts li,
.results button,
.explain-body,
.explain-text {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 18px !important;
  box-shadow: 0 8px 24px var(--shadow) !important;
}
.result { border-style: solid !important; }
.result.ok { background: var(--ok) !important; }
.result.bad { background: var(--bad) !important; }

/* کارت‌های کج و سایه‌های سخت قبلی حذف شدند */
.book,
.book:nth-child(odd),
.book:nth-child(even) {
  transform: none !important;
}
.book:hover { transform: translateY(-3px) !important; }
.book::before { display: none !important; }

.panel h2,
.today h2,
.path-wrap h2 {
  font-family: var(--head) !important;
  color: var(--graphite) !important;
}

/* ---------- دکمه‌ها و سطح‌ها ---------- */
.btn,
.act,
.levels button,
.back,
.tabs button,
.results button {
  font-family: var(--head) !important;
  color: var(--graphite) !important;
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  min-height: 42px;
}
.btn.main,
button.act,
.levels button[aria-pressed="true"],
.tabs button[aria-selected="true"],
.pathdetail button {
  background: var(--pencil) !important;
  color: var(--accent-ink) !important;
  border-color: transparent !important;
}
.btn:hover,
.act:hover,
.levels button:hover { border-color: var(--pencil) !important; transform: none !important; }

/* حالت‌های مسیر درس */
.node {
  background: var(--surface) !important;
  border: 2px solid var(--line) !important;
  color: var(--graphite) !important;
  box-shadow: 0 6px 16px var(--shadow) !important;
}
.node.done { background: var(--ok) !important; border-color: transparent !important; }
.node.current { background: var(--pencil) !important; border-color: transparent !important; color: var(--accent-ink) !important; }
.node.locked { background: var(--paper-2) !important; color: var(--graphite-soft) !important; border-style: dashed !important; }
.node:not(:first-child)::before { background: var(--line) !important; }

/* ---------- ورودی‌ها ---------- */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
textarea {
  background: var(--surface) !important;
  color: var(--graphite) !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
}
input::placeholder, textarea::placeholder { color: var(--graphite-soft); }

/* نوار پیشرفت */
.bar, .book-progress {
  background: var(--paper-2) !important;
  border: none !important;
}
.bar i, .book-progress i, .today .bar i {
  background: var(--pencil) !important;
}

/* ---------- منوی پایین موبایل: قرص شناور ---------- */
.tabbar {
  border: 1px solid var(--line) !important;
  border-radius: 22px !important;
  background: var(--surface) !important;
  box-shadow: 0 10px 30px var(--shadow) !important;
  padding: 6px !important;
  gap: 4px !important;
  justify-content: space-between !important;
  left: 12px !important;
  right: 12px !important;
  bottom: calc(12px + env(safe-area-inset-bottom)) !important;
  top: auto !important;
}
.tabbar a {
  flex: 1 1 0;
  justify-content: center !important;
  font-family: var(--body) !important;
  font-size: .95rem !important;
  font-weight: 600;
  color: var(--graphite-soft) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 16px !important;
  padding: 8px 4px !important;
  min-height: 44px !important;
  text-align: center;
}
.tabbar a[aria-current="page"] {
  background: var(--pencil) !important;
  color: var(--accent-ink) !important;
  font-weight: 800;
}

/* در نمایش موبایل، جای منوی پایین خالی می‌ماند */
@media (max-width: 640px) {
  .tabbar { display: flex !important; }
  body { padding-bottom: 110px !important; }
}

/* ---------- تایپوگرافی ---------- */
h1, h2, h3 { letter-spacing: 0; }
.muted, .topic-note, .book-meta, .pct, .stat, .score, .count, .topic {
  color: var(--graphite-soft) !important;
}

::selection { background: var(--pencil); color: var(--accent-ink); }

/* ==========================================================
   اصلاحات بعد از بررسی روی موبایل
   ========================================================== */

/* ---- لوگو: افکت Spotlight (نور که روی حروف حرکت می‌کند) ---- */
:root { --ink: currentColor; --ink-2: #FF4FD8; --ink-3: #4FF8FF; }

.logo span.fx-spotlight {
  font: 800 2.1rem/1.2 "JetBrains Mono", "Nunito", ui-monospace, monospace !important;
  letter-spacing: .04em;
  padding: 0 !important;
  border-radius: 0 !important;
  background: radial-gradient(3.5ch 100% at 50% 50%,
      var(--graphite) 20%,
      color-mix(in srgb, var(--graphite) 14%, transparent) 75%
    ) 0 0 / 300% 100%;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
  animation: fx-spotlight 3.4s ease-in-out infinite alternate;
}
@keyframes fx-spotlight {
  0%   { background-position: 100% 0; }
  100% { background-position: 0% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .logo span.fx-spotlight { animation: none; }
}

/* ---- هدر: لوگو و دکمه‌ی حالت کنار هم بمانند ---- */
header { flex-wrap: nowrap !important; }
header > div:first-child { flex: 1 1 auto; min-width: 0; }
header > .theme-toggle { margin-inline-start: auto; }

/* ---- سطح‌ها: اندازه‌ی مناسب و بدون نشانه‌ی نقطه ---- */
.levels { gap: 8px !important; }
.levels button {
  font-size: 1.15rem !important;
  padding: 4px 16px !important;
  min-height: 40px !important;
}
.levels button.pending::after { content: none !important; }

/* ---- اطلاعیه: متن در حالت تیره دیده شود ---- */
.notice {
  background: var(--surface) !important;
  color: var(--graphite) !important;
  border: 1px dashed var(--line) !important;
  border-radius: 14px !important;
}

/* ---- برنامه‌ی امروز: تیتر کوچک‌تر و فهرست مرتب ---- */
.today h2 { font-size: 1.35rem !important; }
.today ul { list-style: none !important; padding: 0 !important; }
.today li {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px 10px !important;
  padding: 8px 0 !important;
  border-bottom: 1px dashed var(--line);
}
.today li:last-child { border-bottom: 0; }
.today .go {
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  padding: 4px 12px !important;
  background: var(--paper-2) !important;
  color: var(--graphite) !important;
  margin: 0 !important;
  font-size: .95rem !important;
}

/* ---- دکمه‌ها: اندازه‌ی یکنواخت ---- */
.btn, .act, .theme-toggle, .tabs button { min-height: 42px; }
.btn { font-size: 1.1rem !important; padding: 4px 18px !important; }

/* ==========================================================
   نسخه‌ی دوم طراحی: کنترل‌های بخش‌بندی‌شده، منوی آیکون‌دار
   ========================================================== */

/* سطح‌ها: یک نوار بخش‌بندی‌شده به جای دکمه‌های جدا */
.levels {
  display: flex !important;
  gap: 4px !important;
  padding: 4px !important;
  margin: 0 0 18px !important;
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  box-shadow: 0 6px 18px var(--shadow) !important;
}
.levels li { flex: 1 1 0; min-width: 0; }
.levels button {
  width: 100% !important;
  min-height: 38px !important;
  padding: 4px 0 !important;
  font-size: 1.05rem !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 999px !important;
  color: var(--graphite-soft) !important;
  box-shadow: none !important;
}
.levels button[aria-pressed="true"] {
  background: var(--pencil) !important;
  color: var(--accent-ink) !important;
  font-weight: 800 !important;
}
.levels button.pending::after { content: none !important; }

/* منوی پایین: آیکون + برچسب، با نشانگر فعال */
.tabbar a {
  flex-direction: column !important;
  gap: 2px !important;
  font-size: .78rem !important;
  padding: 6px 2px !important;
  min-height: 52px !important;
  color: var(--graphite-soft) !important;
}
.tabbar a svg { flex: 0 0 auto; }
.tabbar a span { line-height: 1; }
.tabbar a[aria-current="page"] {
  background: transparent !important;
  color: var(--graphite) !important;
  font-weight: 800 !important;
  position: relative;
}
.tabbar a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 4px;
  border-radius: 999px;
  background: var(--pencil);
}
.tabbar a[aria-current="page"] svg { color: var(--graphite); }

/* دکمه‌ی تم، هم‌اندازه‌ی بقیه‌ی کنترل‌ها */
.theme-toggle {
  width: 42px !important;
  height: 42px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---- کارت کتاب با جلد ---- */
.books {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
  gap: 14px !important;
  padding: 0 !important;
  list-style: none !important;
}
.book {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  width: 100% !important;
  text-align: right !important;
  padding: 12px !important;
  cursor: pointer;
}
.book .cover {
  width: 84px !important;
  height: 118px !important;
  border-radius: 10px !important;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 8px 18px var(--shadow);
}
.book .book-text { display: block; min-width: 0; flex: 1 1 auto; }
.book .book-title { font-size: 1.1rem; font-weight: 800; color: var(--graphite) !important; margin: 0 0 4px; }
.book .book-meta { color: var(--graphite-soft) !important; font-size: .88rem; margin-bottom: 8px; }
.book .book-progress { height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.book .book-progress i { display: block; height: 100%; background: var(--pencil); }
.book::before { display: none !important; }

/* ==========================================================
   نمای دسکتاپ: عرض بیشتر، منوی بالا کامل، شبکه‌ی مرتب
   (روی گوشی هیچ تغییری نمی‌کند)
   ========================================================== */
@media (min-width: 900px) {
  .wrap {
    max-width: 1120px !important;
    padding-left: 32px !important;
    padding-right: 32px !important;
  }
  header {
    flex-wrap: wrap !important;
    padding-top: 22px !important;
  }
  header nav.top-nav {
    display: flex !important;
    gap: 8px !important;
  }
  header nav.top-nav a.navlink {
    font-size: .98rem !important;
    padding: 8px 16px !important;
    min-height: 40px !important;
    display: inline-flex;
    align-items: center;
  }
  header nav.top-nav a.navlink[aria-current="page"] {
    background: var(--pencil) !important;
    color: var(--accent-ink) !important;
    border-color: transparent !important;
    font-weight: 800 !important;
  }
  .books {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  }
  .path {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, 64px) !important;
    justify-content: center !important;
    gap: 18px 40px !important;
  }
  .node:nth-child(odd),
  .node:nth-child(even) { margin: 0 !important; }
  .node:not(:first-child)::before { display: none !important; }
}

/* روی گوشی، منوی بالا پنهان است و منوی پایین کار را انجام می‌دهد */
@media (max-width: 899px) {
  header nav.top-nav { display: none !important; }
}

/* ==========================================================
   نسخه‌ی سوم ظاهر: کارت‌ها و دکمه‌ها با لبه‌ی سه‌بعدی (مثل اپ‌های آموزشی)
   ========================================================== */
:root { --edge: #CFC6AE; --edge-accent: #B98F12; }
html[data-theme="dark"] { --edge: #0B0B0F; --edge-accent: #9A7410; }

.book,
.today,
.card,
.pathdetail,
.result {
  box-shadow: 0 6px 0 var(--edge), 0 12px 24px var(--shadow) !important;
  transition: transform .15s ease, box-shadow .15s ease;
}
.book:hover { transform: translateY(-2px) !important; }
.book:active { transform: translateY(3px) !important; box-shadow: 0 2px 0 var(--edge) !important; }

.btn.main,
.levels button[aria-pressed="true"],
.pathdetail button {
  box-shadow: 0 4px 0 var(--edge-accent) !important;
}
.btn.main:active,
.levels button[aria-pressed="true"]:active,
.pathdetail button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--edge-accent) !important;
}

.btn:not(.main),
.levels button:not([aria-pressed="true"]) {
  box-shadow: 0 4px 0 var(--edge) !important;
}
.btn:not(.main):active,
.levels button:not([aria-pressed="true"]):active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--edge) !important;
}

.node {
  box-shadow: 0 5px 0 var(--edge) !important;
}
.node:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge) !important; }
.node.current { box-shadow: 0 5px 0 var(--edge-accent) !important; }

.tabbar a[aria-current="page"] { font-weight: 800 !important; }

/* ==========================================================
   انیمیشن‌های تشویق و پاسخ (js/fx.js)
   ========================================================== */
@keyframes fx-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); box-shadow: 0 0 0 6px rgba(242, 194, 48, .35); }
  100% { transform: scale(1); }
}
@keyframes fx-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.fx-pop { animation: fx-pop .6s ease; }
.fx-shake { animation: fx-shake .5s ease; }

.fx-confetti {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 999;
}
.fx-confetti span {
  position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px;
  animation-name: fx-fall; animation-timing-function: cubic-bezier(.2,.6,.4,1); animation-fill-mode: forwards;
}
@keyframes fx-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: .2; }
}
@media (prefers-reduced-motion: reduce) {
  .fx-pop, .fx-shake { animation: none; }
  .fx-confetti { display: none; }
}

/* ==========================================================
   صفحه‌ی ورود و ثبت‌نام (هم‌خانواده‌ی طراحی Subify)
   ========================================================== */
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 26px;
  box-shadow: 0 10px 30px var(--shadow); padding: 26px 22px 22px; margin: 6px 0 18px;
}
.auth-card h3 { font-family: var(--head); font-size: 1.5rem; margin: 0 0 6px; }
.auth-card .lead { color: var(--graphite-soft); font-size: .95rem; margin: 0 0 18px; }
.auth-provider {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 56px;
  padding: 0 10px 0 18px; margin-bottom: 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper-2); color: var(--graphite); font: inherit; font-weight: 700; cursor: pointer;
  text-decoration: none; box-sizing: border-box;
}
.auth-provider .ico {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); font-weight: 800; flex: 0 0 auto;
}
.auth-provider[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--graphite-soft); margin: 14px 0; font-size: .9rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-seg {
  display: flex; padding: 4px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); margin-bottom: 14px;
}
.auth-seg button {
  flex: 1; min-height: 44px; border: 0; border-radius: 999px; background: transparent;
  color: var(--graphite-soft); font: inherit; font-weight: 700; cursor: pointer;
}
.auth-seg button[aria-pressed="true"] { background: var(--pencil); color: var(--accent-ink); }
.auth-label { font-size: .9rem; color: var(--graphite-soft); margin: 10px 4px 6px; display: block; }
.auth-input {
  width: 100%; min-height: 54px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--graphite); font: inherit; box-sizing: border-box; direction: ltr; text-align: left;
}
.auth-input[dir="rtl"] { direction: rtl; text-align: right; }
.auth-submit {
  width: 100%; min-height: 56px; margin-top: 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--pencil); color: var(--accent-ink); font: inherit; font-weight: 800; font-size: 1.05rem;
  box-shadow: 0 4px 0 #B98F12;
}
.auth-submit:disabled { opacity: .55; cursor: not-allowed; }
.auth-note { color: var(--graphite-soft); font-size: .85rem; text-align: center; margin: 14px 0 0; line-height: 1.9; }
.auth-msg { color: var(--bad-ink, #B3261E); font-size: .92rem; min-height: 1.4em; margin: 8px 4px 0; }

/* ===== نوار انگیزه: روز پیاپی، امتیاز و هدف روزانه ===== */
#gameBar { display:grid; grid-template-columns: auto auto 1fr; gap:10px; align-items:center; margin:6px 0 16px; }
.gb-item { display:flex; flex-direction:column; align-items:center; min-width:74px; padding:10px 12px; border-radius:18px; background:var(--surface); border:1px solid var(--line); box-shadow:0 4px 0 var(--edge, #CFC6AE); text-align:center; }
.gb-item span { font-size:20px; line-height:1.1; }
.gb-item b { font-size:17px; font-variant-numeric: tabular-nums; color:var(--graphite); }
.gb-item small, .gb-goal small { color:var(--graphite-soft); font-size:11px; }
.gb-goal { padding:10px 14px; border-radius:18px; background:var(--surface); border:1px solid var(--line); box-shadow:0 4px 0 var(--edge, #CFC6AE); }
.gb-goal-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.gb-goal-top b { font-size:13px; color:var(--graphite); }
.gb-bar { height:12px; border-radius:999px; background:var(--paper-2); overflow:hidden; }
.gb-bar i { display:block; height:100%; background:linear-gradient(90deg, var(--pencil), #B98F12); border-radius:999px; transition:width .4s ease; }
.gb-goal.done .gb-bar i { background:#B3D93B; }
.gb-goal.done .gb-goal-top b::after { content:" ✓"; color:#3F6B0A; }
@media (max-width:420px) { #gameBar { grid-template-columns: auto auto; } .gb-goal { grid-column: 1 / -1; } }

/* AUDIT-FIX-1: لوگوی یک‌خطی و منوی ناوبری روی دسکتاپ */
.logo, .logo span.fx-spotlight { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 480px) { .logo span.fx-spotlight { font-size: 1.5rem !important; } }
@media (min-width: 641px) {
  .tabbar {
    display: flex !important; left: 50% !important; right: auto !important; transform: translateX(-50%);
    width: min(560px, calc(100% - 24px)); position: fixed;
  }
}

/* AUDIT-FIX-2: جعبه‌ی لوگو سبک و فشرده (فاصله‌ی خط ارثی ۱٫۸ آن را بلند می‌کرد) */
.logo { line-height: 1.2 !important; font-size: 1.6rem !important; margin: 0 !important; }

/* AUDIT-FIX-3: نوار پیشرفتِ خالی در حالت تیره دیده شود */
.bar, .gb-bar, .track, .meter, .progress { box-shadow: inset 0 0 0 1px var(--line); }
