/* فونت‌ها از مجموعه‌ی خودت: «رخ» برای تیترها و «ایران‌سنس» برای متن */
@font-face { font-family: "Rokh"; font-weight: 700; font-display: swap; src: url("fonts/RokhFaNum-Bold.woff2") format("woff2"); }
@font-face { font-family: "Rokh"; font-weight: 900; font-display: swap; src: url("fonts/RokhFaNum-Black.woff2") format("woff2"); }
@font-face { font-family: "IRANSans"; font-weight: 400; font-display: swap; src: url("fonts/IRANSans-web.woff2") format("woff2"); }
@font-face { font-family: "IRANSans"; font-weight: 500; font-display: swap; src: url("fonts/IRANSans-Medium-web.woff2") format("woff2"); }
@font-face { font-family: "IRANSans"; font-weight: 700; font-display: swap; src: url("fonts/IRANSans-Bold-web.woff2") format("woff2"); }

/* ایده‌ی چیدمان: دفتر مطالعه. منو سمت راست، هر مهارت با رنگ ماژیک خودش. */
:root {
  --paper: #f6f8fc; --card: #ffffff; --ink: #1b2440; --muted: #5b6585; --line: #d9dfee;
  --yellow: #ffd84d; --pink: #ff7aa8; --mint: #3fcf9f; --sky: #4aa8ff; --violet: #9b7bff;
  --yellow-bg: #fff6cc; --pink-bg: #ffe3ec; --mint-bg: #d9f7ec; --sky-bg: #dcedff; --violet-bg: #ebe4ff;
  --on-color: #1b2440;
  --display: "Rokh", "IRANSans", Tahoma, sans-serif;
  --body: "IRANSans", Tahoma, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #131829; --card: #1b2238; --ink: #eef1fa; --muted: #a3acc8; --line: #2e3757;
    --yellow-bg: #3d3510; --pink-bg: #40182a; --mint-bg: #0f3a2c; --sky-bg: #12304f; --violet-bg: #2a2152;
  }
}

.c-yellow { --c: var(--yellow); --bg: var(--yellow-bg); }
.c-pink { --c: var(--pink); --bg: var(--pink-bg); }
.c-mint { --c: var(--mint); --bg: var(--mint-bg); }
.c-sky { --c: var(--sky); --bg: var(--sky-bg); }
.c-violet { --c: var(--violet); --bg: var(--violet-bg); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 2; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--display); line-height: 1.5; margin: 0; text-wrap: balance; }
h1 { font-weight: 900; font-size: clamp(28px, 5vw, 40px); }
h1:focus { outline: none; }
h1 mark, .brand mark { background: linear-gradient(transparent 55%, var(--yellow) 55%); color: inherit; padding: 0 6px; }
h2 { font-weight: 900; font-size: 24px; display: flex; align-items: center; gap: 10px; }
h2::before { content: ""; width: 14px; height: 28px; border-radius: 4px; background: var(--c, var(--sky)); flex: none; }
h3 { font-weight: 700; font-size: 19px; }
.en { direction: ltr; unicode-bidi: isolate; }
td.en { text-align: right; }
.muted { color: var(--muted); font-size: 15px; }
.lead { color: var(--muted); font-size: 17px; max-width: 65ch; }

/* قاب صفحه */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--card); border-inline-end: 1.5px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-family: var(--display); font-weight: 900; font-size: 28px; text-decoration: none; margin-bottom: 8px; }
.nav-group { font-size: 13px; color: var(--muted); margin-top: 14px; padding-inline: 12px; }
.side a:not(.brand) { text-decoration: none; padding: 2px 12px; border-radius: 10px; font-weight: 500; }
.side a:not(.brand):hover { background: var(--paper); }
.side a.active { background: var(--sky-bg); font-weight: 700; }
/* حلقه‌ی فوکوس یکدست؛ جوهری است چون آبی روی کاغذ روشن کنتراست ۳:۱ ندارد */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--ink); }
.content { padding: 36px clamp(16px, 4vw, 48px) 72px; display: flex; flex-direction: column; gap: 28px; max-width: 980px; }
section { display: flex; flex-direction: column; gap: 14px; }

/* کاشی‌های داشبورد */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.tile { background: var(--bg); border-inline-start: 8px solid var(--c); border-radius: 14px; padding: 14px 18px; text-decoration: none; display: flex; flex-direction: column; }
.tile b { font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 1.3; }

/* کارت‌ها */
.cards { display: grid; gap: 14px; }
.card { background: var(--bg); border-inline-start: 8px solid var(--c); border-radius: 14px; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.card.resolved { opacity: .55; }
.tag { font-weight: 700; font-size: 13px; letter-spacing: .04em; direction: ltr; background: var(--c); color: var(--on-color); border-radius: 6px; padding: 0 9px; align-self: flex-start; line-height: 1.9; }
.yt { align-self: flex-start; font-weight: 700; font-size: 14.5px; text-decoration: none; border-bottom: 2px solid #ff4d4d; }
.yt::before { content: "▶ "; color: #ff4d4d; }
ol.habits { list-style: none; counter-reset: h; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
ol.habits li { counter-increment: h; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
ol.habits li::before { content: counter(h, persian); font-family: var(--display); font-weight: 900; font-size: 22px; width: 38px; height: 38px; border-radius: 50%; background: var(--yellow); color: var(--on-color); display: grid; place-items: center; line-height: 1; }
ol.plain { margin: 0; padding-inline-start: 24px; }
.note { background: var(--card); border: 2px dashed var(--pink); border-radius: 14px; padding: 14px 20px; }
.status { background: var(--sky-bg); border-radius: 12px; padding: 8px 16px; }

/* جدول */
.tablewrap { overflow-x: auto; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); }
table { border-collapse: collapse; width: 100%; min-width: 520px; }
th, td { text-align: start; padding: 10px 16px; vertical-align: top; border-bottom: 1.5px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-family: var(--display); font-weight: 700; font-size: 17px; background: var(--sky-bg); white-space: nowrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-inline-end: 8px; }
table.nums td { font-variant-numeric: tabular-nums; }
td.hit { background: var(--mint-bg); font-weight: 700; }
td.miss { background: var(--pink-bg); }

/* فرم */
.form { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 16px 20px; }
.form.grid5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.form.grid5 > div { display: flex; flex-direction: column; }
.formrow { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
label { font-weight: 500; font-size: 14.5px; }
label.check { display: inline-flex; align-items: center; gap: 6px; }
input, select, textarea { font: inherit; color: inherit; background: var(--paper); border: 1.5px solid var(--line); border-radius: 10px; padding: 4px 12px; max-width: 100%; }
textarea { line-height: 1.8; resize: vertical; width: 100%; }
.form > input, .form > select { width: 100%; }
input[type="checkbox"] { width: 18px; height: 18px; padding: 0; accent-color: var(--mint); }
.btn { font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 10px; padding: 4px 20px; background: var(--ink); color: var(--paper); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.good { background: var(--mint); color: var(--on-color); }
.btn.bad { background: var(--pink); color: var(--on-color); }
.link { font: inherit; font-size: 14.5px; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; text-decoration: underline; }

/* زنجیره */
.chain { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.chain button { aspect-ratio: 1; border: 1.5px solid var(--line); background: var(--card); color: var(--muted); border-radius: 10px; font-family: var(--display); font-weight: 700; font-size: clamp(12px, 2.4vw, 17px); cursor: pointer; padding: 0; }
.chain button:hover { border-color: var(--ink); }
.chain button.mock { background: var(--yellow-bg); border-color: var(--yellow); }
.chain button.today { box-shadow: 0 0 0 3px var(--sky); }
.chain button[aria-pressed="true"] { background: var(--mint); border-color: var(--mint); color: var(--on-color); }
.chainmeta { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; color: var(--muted); font-size: 14.5px; }
.chainmeta b { font-family: var(--display); font-weight: 900; font-size: 22px; color: var(--ink); }
.key { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-inline-end: 6px; border: 1.5px solid var(--line); }
.key.done { background: var(--mint); border-color: var(--mint); }
.key.mock { background: var(--yellow-bg); border-color: var(--yellow); }
.key.today { box-shadow: 0 0 0 2px var(--sky); }

/* لایتنر */
.flash { background: var(--violet-bg); border-inline-start: 8px solid var(--violet); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 8px; min-height: 150px; justify-content: center; }
.flash-front { font-weight: 700; font-size: 26px; text-align: center; }
.flash-back { font-size: 19px; text-align: center; }
.flash-example { color: var(--muted); text-align: center; }

/* گفت‌وگو با مربی */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { white-space: pre-wrap; border-radius: 14px; padding: 10px 16px; max-width: 85%; overflow-wrap: anywhere; }
.bubble.me { background: var(--sky-bg); align-self: flex-start; }
.bubble.ai { background: var(--card); border: 1.5px solid var(--line); align-self: flex-end; }

/* خطای Blazor */
#blazor-error-ui { display: none; position: fixed; inset-inline: 0; bottom: 0; background: var(--pink-bg); border-top: 2px solid var(--pink); padding: 10px 20px; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-inline-end: 0; border-bottom: 1.5px solid var(--line); padding: 12px 16px; }
  .brand { width: 100%; margin: 0; }
  .nav-group { display: none; }
  .chain { gap: 5px; }
  .bubble { max-width: 100%; }
}

/* ===== اصلاحات بازبینی طراحی ===== */

/* F1 mobile overflow */
@media (max-width: 760px) { .shell { grid-template-columns: minmax(0, 1fr); } }
td:has(> b:first-child + br) { min-width: 17em; }

/* F3 sidebar colour tabs + dotted paper */
body { background: radial-gradient(circle, color-mix(in srgb, var(--muted) 28%, transparent) 1px, transparent 1.5px) 0 0 / 22px 22px, var(--paper); }
.side a:not(.brand) { display: flex; align-items: center; gap: 10px; padding: 4px 12px; }
.side a:not(.brand)::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--line)); transition: height .15s; }
.side a.active { background: var(--bg, var(--sky-bg)); }
.side a.active::before { height: 24px; }
.side a[href=""]:not(.brand), .side a[href^="methods"], .side a[href^="reminders"], .side a[href^="podcasts"] { --c: var(--sky); --bg: var(--sky-bg); }
.side a[href^="chain"], .side a[href^="habits"] { --c: var(--mint); --bg: var(--mint-bg); }
.side a[href^="leitner"], .side a[href^="coach"] { --c: var(--violet); --bg: var(--violet-bg); }
.side a[href^="bugs"], .side a[href^="schedule"] { --c: var(--pink); --bg: var(--pink-bg); }
.side a[href^="mocks"] { --c: var(--yellow); --bg: var(--yellow-bg); }

/* F2 compact mobile nav */
@media (max-width: 760px) {
  .side { gap: 2px 4px; padding: 10px 12px; }
  .brand { width: auto; font-size: 22px; margin-inline: 4px 8px; }
  .side a:not(.brand) { font-size: 14px; padding: 2px 10px; gap: 6px; border: 1.5px solid var(--line); border-radius: 999px; }
  .side a:not(.brand)::before { width: 8px; height: 8px; border-radius: 50%; }
  .side a.active { border-color: var(--c); }
  .side a.active::before { height: 8px; }
  .content { padding-top: 24px; }
}

/* F4 dark highlight + brighter dark tints */
@media (prefers-color-scheme: dark) {
  :root {
    --yellow-bg: color-mix(in srgb, var(--yellow) 22%, var(--card)); --pink-bg: color-mix(in srgb, var(--pink) 24%, var(--card));
    --mint-bg: color-mix(in srgb, var(--mint) 22%, var(--card)); --sky-bg: color-mix(in srgb, var(--sky) 24%, var(--card));
    --violet-bg: color-mix(in srgb, var(--violet) 28%, var(--card));
  }
  h1 mark, .brand mark { background: var(--yellow); color: var(--on-color); border-radius: 6px; }
}

/* F5 section colour flows into table header / form */
section:has(> h2.c-yellow) { --c: var(--yellow); --bg: var(--yellow-bg); }
section:has(> h2.c-pink) { --c: var(--pink); --bg: var(--pink-bg); }
section:has(> h2.c-mint) { --c: var(--mint); --bg: var(--mint-bg); }
section:has(> h2.c-sky) { --c: var(--sky); --bg: var(--sky-bg); }
section:has(> h2.c-violet) { --c: var(--violet); --bg: var(--violet-bg); }
th { background: var(--bg, var(--sky-bg)); }
.form { border-top: 5px solid var(--c, var(--line)); }

/* F6 forms */
:root { --field-line: #8e98b8; }
@media (prefers-color-scheme: dark) { :root { --field-line: #6b769c; } }
.form { gap: 0; padding: 20px 24px; }
.form > label { margin-top: 14px; margin-bottom: 4px; }
.form > label:first-child { margin-top: 0; }
.form > .formrow { margin-top: 16px; }
.form.grid5 { gap: 14px; }
.form.grid5 label { margin-bottom: 4px; }
input, select, textarea { border-color: var(--field-line); padding: 6px 12px; min-height: 46px; }
input::placeholder { color: var(--muted); opacity: .75; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; }
.btn { padding: 6px 22px; min-height: 46px; }
.link { text-decoration: none; font-weight: 500; padding: 4px 12px; border-radius: 8px; background: var(--pink-bg); }
.link:hover:not(:disabled) { background: var(--pink); color: var(--on-color); }

/* F7 chain */
.chain { grid-template-columns: repeat(14, 1fr); }
@media (max-width: 760px) { .chain { grid-template-columns: repeat(7, 1fr); gap: 6px; } }
.chain button.mock { border-width: 2px; color: var(--ink); }
.chain button.today { box-shadow: inset 0 0 0 3px var(--pink); border-color: var(--pink); color: var(--ink); }
.key.today { box-shadow: inset 0 0 0 2px var(--pink); border-color: var(--pink); }

/* F8 stat chips */
.chainmeta { gap: 10px 14px; }
.chainmeta span:has(> b) { display: inline-flex; align-items: baseline; gap: 8px; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 2px 14px; }
.chainmeta b { font-size: 26px; line-height: 1.5; }

/* F9 cards */
.cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.cards > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.card { padding: 20px 24px; gap: 8px; }
.card h3 { font-size: 21px; }
.card p { max-width: 70ch; }
.card .yt { margin-top: 4px; }

/* F10 status / note variants */
.status { border-inline-start: 6px solid var(--sky); }
.status.bad { background: var(--pink-bg); border-inline-start-color: var(--pink); }
.note.ok { border-color: var(--mint); background: var(--mint-bg); }

/* F11 flash card + bubbles */
.flash { min-height: 220px; gap: 12px; border: 1.5px solid var(--violet); border-inline-start-width: 8px; }
.flash-front { font-size: clamp(26px, 5vw, 36px); }
.bubble.ai { background: var(--violet-bg); border-color: transparent; }

/* F12 tiles */
.tile { transition: transform .15s, box-shadow .15s; }
a.tile:hover { transform: translateY(-3px); box-shadow: 0 6px 0 var(--c); }

/* F1b stacked reminder rows on mobile (needs class="stack" on the table in Reminders.razor) */
@media (max-width: 760px) {
  table.stack, table.stack tbody { display: block; min-width: 0; }
  table.stack thead { display: none; }
  table.stack tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 14px 16px; border-bottom: 1.5px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { padding: 0; border: 0; min-width: 0; }
  table.stack td:nth-child(3) { grid-column: 1 / -1; color: var(--muted); font-size: 14.5px; }
  table.stack td:nth-child(4) { grid-column: 1 / -1; }
  table.stack td:nth-child(5) { grid-row: 1; grid-column: 3; }
}

/* ===== اصلاحات بازبینی فرانت‌اند و اجزای جدید ===== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

/* جدول‌های دوستونه روی موبایل جا می‌شوند؛ فقط جدول‌های پهن اسکرول افقی می‌گیرند */
table { min-width: 0; }
.tablewrap.wide table, table.nums { min-width: 520px; }
.form.grid5 input { width: 100%; }

/* کارت حل‌شده کم‌رنگ می‌شود ولی دکمه‌هایش خوانا می‌مانند */
.card.resolved { opacity: 1; }
.card.resolved > :not(.formrow) { opacity: .55; }

.link:disabled { opacity: .45; cursor: not-allowed; }
.link.plain { background: var(--paper); }
.link.plain:hover:not(:disabled) { background: var(--line); color: inherit; }
.confirm { display: inline-flex; flex-wrap: wrap; gap: 6px; }

/* hover بعد از حالت‌ها می‌آید تا روی خانه‌های رنگ‌شده هم دیده شود */
.chain button.mock[aria-pressed="true"] { border-color: var(--yellow); }
.chain button:hover:not(:disabled) { border-color: var(--ink); }
/* فقط روزهای آینده کم‌رنگ‌اند؛ موقع Busy کل جدول چشمک نمی‌زند */
.chain button:disabled { cursor: progress; }
.chain button.locked { opacity: .6; cursor: not-allowed; border-color: var(--line); }
.chain button.locked.mock { border-color: var(--yellow); }
.chain button { position: relative; }
.chain button.mock::after { content: "★"; position: absolute; inset-block-start: 2px; inset-inline-end: 4px; font-size: 9px; line-height: 1.4; color: var(--ink); opacity: .7; }

/* داشبورد: دکمه‌ی اصلی روز، بنر جایزه و لینک هر ردیف برنامه */
.today-action { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }
.btn.big { font-size: 18px; padding: 8px 28px; background: var(--mint); color: var(--on-color); }
.btn.big.done { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.banner { background: var(--yellow-bg); border: 2px solid var(--yellow); border-radius: 14px; padding: 12px 20px; font-weight: 500; }
.banner.warn { background: var(--pink-bg); border-color: var(--pink); }
a.go { display: inline-block; white-space: nowrap; text-decoration: none; font-weight: 700; font-size: 14.5px; padding: 2px 14px; border-radius: 999px; background: var(--bg, var(--sky-bg)); border: 1.5px solid var(--c, var(--sky)); }
a.go:hover { background: var(--c, var(--sky)); color: var(--on-color); }

/* لایتنر: نوار پیشرفت جلسه */
.progress { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--violet); border-radius: 999px; transition: width .2s; }

#blazor-error-ui .dismiss { float: inline-end; }

/* ===== بازبینی زیبایی‌شناسی ===== */
:root { --field-line: #7682a6; }
@media (prefers-color-scheme: dark) { :root { --field-line: #6b769c; --muted: #b4bcd6; } }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.muted { font-size: 14.5px; }
.status, .chainmeta span:has(> b) { border-radius: 14px; }
.status { border-inline-start-width: 8px; }

/* ریتم عمودی: زیرتیتر به تیترش نزدیک‌تر است تا به بخش بعدی */
.content > h1 + .lead { margin-top: -18px; }
.content > section { margin-top: 10px; }
p { text-wrap: pretty; }

/* منو: حاشیه‌ی دفتر و hover دیدنی */
.side { height: 100dvh; border-inline-end: 4px double color-mix(in srgb, var(--pink) 70%, var(--line)); }
.side a:not(.brand):hover { background: color-mix(in srgb, var(--c, var(--line)) 14%, transparent); }
.side a.active, .side a.active:hover { background: var(--bg, var(--sky-bg)); }

/* دکمه‌ها همان زبان «برچسب» کاشی‌ها را می‌گیرند */
.btn { line-height: 1.6; display: inline-flex; align-items: center; justify-content: center; transition: transform .1s, box-shadow .1s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 30%, transparent); }
.btn:active:not(:disabled) { transform: none; box-shadow: none; }
.link, a.go { transition: background-color .15s; }

/* کاشی‌ها: پنج‌تایی در یک ردیف و برچسب انگلیسی جمع‌وجور */
.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile b { overflow-wrap: anywhere; }
.tile b:lang(en) { font-size: 26px; line-height: 2; }

/* زنجیره: خانه‌ها دکمه دیده می‌شوند و رنگ شدن بازخورد دارد */
.chain button { border-color: var(--field-line); transition: background-color .15s, border-color .15s, transform .1s; }
.chain button.mock { border-color: var(--yellow); }
.chain button.today { border-color: var(--pink); }
.chain button:active:not(:disabled) { transform: scale(.92); }
.chain button[aria-pressed="true"] { border-color: var(--mint); animation: pop .25s ease-out; }
@keyframes pop { 50% { transform: scale(1.12); } }

/* باگ حل‌شده خط می‌خورد، ولی خوانا می‌ماند */
.card.resolved > :not(.formrow) { opacity: 1; }
.card.resolved { --bg: var(--card); border: 1.5px dashed var(--line); border-inline-start: 8px solid var(--c); }
.card.resolved h3, .card.resolved p { color: var(--muted); }
.card.resolved h3 { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--c); }

/* یادداشت خنثی خاکستری است؛ صورتی فقط برای هشدار */
.note { border-color: var(--field-line); }
.note.warn { border-color: var(--pink); background: var(--pink-bg); }
.note.ok { border-color: var(--mint); background: var(--mint-bg); }
.empty { border: 2px dashed var(--line); border-radius: 14px; padding: 20px 24px; text-align: center; color: var(--muted); background: color-mix(in srgb, var(--card) 60%, transparent); }

/* فرم‌ها */
.form.grid5 > .formrow { grid-column: 1 / -1; flex-direction: row; }
.form > .formrow:first-child { margin-top: 0; }

/* گفت‌وگو */
.chat:not(:has(.bubble)) { display: none; }
.bubble { line-height: 1.8; max-width: min(85%, 70ch); }
.bubble.me { border-start-start-radius: 4px; }
.bubble.ai { border-start-end-radius: 4px; }

/* کارت لایتنر: فیش خط‌دار */
.flash { background: repeating-linear-gradient(transparent 0 35px, color-mix(in srgb, var(--violet) 18%, transparent) 35px 36px), var(--card);
         border: 1.5px solid var(--line); border-block-start: 8px solid var(--violet);
         box-shadow: 0 6px 0 color-mix(in srgb, var(--violet) 35%, transparent); }
.flash-back, .flash-example { animation: reveal .2s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } }
.flash + .formrow > .btn { flex: 1 1 150px; }

/* جدول ماک: زیرخط ماژیک به‌جای خانه‌ی تمام‌رنگ */
td.hit { background: linear-gradient(transparent calc(100% - 5px), var(--mint) 0); font-weight: 700; }
td.miss { background: linear-gradient(transparent calc(100% - 5px), var(--pink) 0); }

/* لینک‌ها و شماره‌ها در متن فارسی */
.content a:not([class]) { text-decoration-thickness: 2px; text-underline-offset: 6px; text-decoration-color: var(--sky); font-weight: 500; }
.yt { line-height: 1.6; white-space: nowrap; }
ol.plain { list-style: persian; }
td.en { text-align: end; }

/* حالت تاریک: شماره روی خانه‌ی سبزِ «امروز» یا «ماک» باید تیره بماند */
.chain button.mock[aria-pressed="true"], .chain button.today[aria-pressed="true"] { color: var(--on-color); }
.chain button.today[aria-pressed="true"] { border-color: var(--pink); }

.formrow.grow { flex: 1 1 260px; }
.sr-only { margin: -1px; padding: 0; border: 0; }
:root { --yt: #ff4d4d; }
.yt { border-bottom-color: var(--yt); }
.yt::before { color: var(--yt); }
details > summary { cursor: pointer; color: var(--muted); font-size: 14.5px; }
details[open] > summary { display: none; }
.note ol.plain { margin-top: 4px; }
@media (max-width: 760px) { table.stack td:nth-child(4) { min-width: 0; } }

/* ورود و خروج */
.login { min-height: 100dvh; max-width: 420px; margin-inline: auto; padding: 24px 16px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login .form { border-top: 5px solid var(--yellow); }
.login .form > input { width: 100%; }
.login .lead { font-size: 15px; }
.captcha { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.captcha img { border-radius: 10px; border: 1.5px solid var(--field-line); background: #f1f3f8; max-width: 100%; height: auto; }
.captcha input { width: 8em; flex: 1 1 8em; letter-spacing: .3em; text-align: center; }
.linkcode { font-size: 22px; letter-spacing: .15em; background: var(--yellow-bg); border-radius: 8px; padding: 2px 10px; }
.side .logout { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.side .logout .muted { padding-inline: 12px; font-size: 13px; }
.side .logout .link { width: 100%; text-align: start; padding: 6px 12px; }
@media (max-width: 760px) { .side .logout { margin: 0; padding: 0; flex-direction: row; align-items: center; } .side .logout .muted { display: none; } .side .logout .link { width: auto; border-radius: 999px; } }

/* منوی موبایل: یک ردیف چسبان که افقی اسکرول می‌شود */
@media (max-width: 760px) {
  .side { position: sticky; top: 0; z-index: 10; height: auto; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; gap: 6px; padding: 8px 12px; border-inline-end: 0; }
  .side::-webkit-scrollbar { display: none; }
  .side > * { flex: none; }
  .side a:not(.brand) { white-space: nowrap; padding: 6px 12px; font-size: 14.5px; }
  .brand { order: -2; }
  .side a.active { order: -1; }
  .bubble { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  a.tile:hover, .btn:hover:not(:disabled) { transform: none; }
}

/* ===== نصب روی موبایل (PWA) و قطع اتصال ===== */

/* پیام قطع اتصال: blazor.web.js به این عنصر کلاس می‌دهد؛ تا آن موقع پنهان است. */
#components-reconnect-modal { display: none; position: fixed; inset: 0; z-index: 1001; place-items: center; padding: 16px; background: color-mix(in srgb, var(--paper) 82%, transparent); }
#components-reconnect-modal:is(.components-reconnect-show, .components-reconnect-retrying, .components-reconnect-failed, .components-reconnect-rejected, .components-reconnect-paused, .components-reconnect-resume-failed) { display: grid; }
#components-reconnect-modal .rc-box { background: var(--card); border: 1.5px solid var(--line); border-top: 5px solid var(--yellow); border-radius: 14px; padding: 20px 24px; max-width: 420px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 6px 0 color-mix(in srgb, var(--ink) 15%, transparent); }
#components-reconnect-modal .btn { align-self: flex-start; text-decoration: none; }
#components-reconnect-modal .rc-lost { display: none; }
#components-reconnect-modal:is(.components-reconnect-failed, .components-reconnect-rejected, .components-reconnect-resume-failed) .rc-lost { display: block; }
#components-reconnect-modal:is(.components-reconnect-failed, .components-reconnect-rejected, .components-reconnect-resume-failed) .rc-trying { display: none; }

/* گوشی‌های بریدگی‌دار: محتوا زیر نوار وضعیت و نوار پایین نمی‌رود (viewport-fit=cover). */
.content { padding-bottom: max(72px, calc(40px + env(safe-area-inset-bottom))); }
.login { padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
@media (max-width: 760px) {
  .side { padding-top: max(8px, env(safe-area-inset-top)); padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
}

/* وقتی از صفحه‌ی اصلی گوشی باز شده (بدون نوار نشانی)، کشیدنِ صفحه نباید کل برنامه را کش بدهد یا متن دکمه‌ها را انتخاب کند. */
@media (display-mode: standalone) {
  html { overscroll-behavior-y: none; }
  .btn, .link, .side a, .chain button { -webkit-tap-highlight-color: transparent; user-select: none; }
}

/* جدول مدیر و برچسب «بسته» */
td .tag { margin-inline-start: 8px; display: inline-block; direction: rtl; letter-spacing: 0; }
