/* PSC Game — owner manual
   One stylesheet for every page. Dark, calm, RTL, print-friendly.
   No frameworks, no external fonts, no build step. */

:root {
  --bg: #0d1017;
  --bg-soft: #12161f;
  --surface: #171c26;
  --surface-2: #1d2431;
  --line: #263044;
  --line-soft: #1e2534;
  --ink: #e8ecf3;
  --ink-soft: #a9b4c6;
  --ink-mute: #78859a;
  --accent: #6ee7b7;
  --accent-dim: #123c30;
  --warn: #f0b46b;
  --warn-dim: #3a2b14;
  --stop: #f2857b;
  --stop-dim: #3a1c1a;
  --radius: 14px;
  --radius-sm: 10px;
  --pad: clamp(1rem, 3vw, 1.75rem);
  --font: "Vazirmatn", "Vazir", "IRANSans", "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.9;
  text-align: right;
  direction: rtl;
  overflow-wrap: break-word;
}

/* ---------------------------------------------------------------- chrome */

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--pad);
}

.topbar {
  border-bottom: 1px solid var(--line-soft);
  background: rgba(13, 16, 23, 0.92);
}

.topbar .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  min-height: 64px;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.brandline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  color: var(--ink);
}

.brandline .mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #07231a;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-inline-start: auto;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.8rem;
  border-radius: 999px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
}

.topnav a:hover,
.topnav a:focus-visible { background: var(--surface-2); color: var(--ink); }
.topnav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }

/* ------------------------------------------------------------------ type */

h1, h2, h3, h4 { line-height: 1.5; margin: 0; font-weight: 700; }

h1 {
  font-size: clamp(1.6rem, 4.5vw, 2.35rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  margin-top: 0;
}

h3 { font-size: 1.08rem; }

p { margin: 0 0 0.9rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); }

.lead {
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 62ch;
}

.muted { color: var(--ink-soft); }
.small { font-size: 0.88rem; line-height: 1.8; }
.tiny { font-size: 0.8rem; line-height: 1.7; color: var(--ink-mute); }

code, .ltr {
  font-family: ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", monospace;
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  font-size: 0.9em;
}

code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.45em;
  color: #cde7db;
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
  font-size: 0.86rem;
  line-height: 1.7;
}

pre code { background: none; border: 0; padding: 0; color: #d7e3ee; }

/* --------------------------------------------------------------- blocks */

header.page-head {
  padding: clamp(1.6rem, 5vw, 2.8rem) 0 1rem;
}

header.page-head .kicker {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  margin-bottom: 0.9rem;
}

section.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--pad);
  margin: 0 0 1.15rem;
}

section.card > h2 + p,
section.card > h2 + .lead { margin-top: 0.5rem; }

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.8rem;
  margin-bottom: 0.75rem;
}

.card-head .where {
  font-size: 0.8rem;
  color: var(--ink-mute);
}

/* numbered steps */
ol.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 2.4rem;
  min-height: 1.9rem;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 0.15rem;
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

ul.plain {
  margin: 0;
  padding-inline-start: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

ul.plain li::marker { color: var(--ink-mute); }

/* notes */
.note {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin: 1rem 0 0;
  font-size: 0.92rem;
  line-height: 1.85;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.note b { color: var(--ink); }
.note > :last-child { margin-bottom: 0; }

.note.ok { border-color: #1f4d3d; background: var(--accent-dim); }
.note.ok b { color: var(--accent); }
.note.warn { border-color: #4c3a1c; background: var(--warn-dim); }
.note.warn b { color: var(--warn); }
.note.stop { border-color: #4d2723; background: var(--stop-dim); }
.note.stop b { color: var(--stop); }

.note .label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
  color: var(--ink-soft);
}

/* field table */
table.fields {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin-top: 0.4rem;
}

table.fields th,
table.fields td {
  text-align: right;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

table.fields th {
  color: var(--ink-mute);
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
  width: 34%;
}

table.fields tr:last-child th,
table.fields tr:last-child td { border-bottom: 0; }

/* screenshots */
figure.shot {
  margin: 1rem 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-soft);
}

figure.shot img { display: block; width: 100%; height: auto; }

figure.shot figcaption {
  padding: 0.6rem 0.8rem;
  font-size: 0.82rem;
  color: var(--ink-mute);
  border-top: 1px solid var(--line-soft);
}

/* menu cards */
.menu {
  display: grid;
  gap: 0.9rem;
  margin: 0 0 1.15rem;
}

.menu a {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.15rem var(--pad);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.menu a:hover,
.menu a:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.menu .title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.12rem;
  margin-bottom: 0.2rem;
}

.menu .title .arrow { color: var(--accent); font-weight: 400; }
.menu .what { color: var(--ink-soft); font-size: 0.92rem; }
.menu .count { color: var(--ink-mute); font-size: 0.8rem; margin-top: 0.3rem; }

/* two-column list of small links */
.grid-2 {
  display: grid;
  gap: 0.6rem;
}

@media (min-width: 620px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* contents toggle — <details>, no script needed */
details.toc {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.9rem var(--pad);
  margin: 0 0 1.15rem;
}

details.toc > summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 32px;
}

details.toc > summary::-webkit-details-marker { display: none; }

details.toc > summary::before {
  content: "▾";
  color: var(--accent);
  font-size: 0.8rem;
}

details.toc[open] > summary::before { content: "▴"; }

details.toc ol {
  margin: 0.6rem 0 0;
  padding-inline-start: 1.2rem;
  display: grid;
  gap: 0.25rem;
  font-size: 0.92rem;
}

details.toc a { color: var(--ink-soft); text-decoration: none; }
details.toc a:hover { color: var(--accent); text-decoration: underline; }

/* footer */
footer.site {
  border-top: 1px solid var(--line-soft);
  margin-top: 2.5rem;
  padding: 1.6rem 0 2.6rem;
  color: var(--ink-mute);
  font-size: 0.85rem;
}

footer.site .wrap { display: grid; gap: 0.4rem; }

/* anchor breathing room */
[id] { scroll-margin-top: 1.2rem; }

/* ---------------------------------------------------------------- print */

@media print {
  :root {
    --bg: #fff;
    --bg-soft: #fff;
    --surface: #fff;
    --surface-2: #f4f5f7;
    --line: #c9ced8;
    --line-soft: #d8dce4;
    --ink: #101318;
    --ink-soft: #333a45;
    --ink-mute: #5b6472;
    --accent: #0f6b4f;
    --accent-dim: #eef6f2;
    --warn: #7a4c07;
    --warn-dim: #fdf5e7;
    --stop: #8a2020;
    --stop-dim: #fdf0ef;
  }

  body { font-size: 11.5pt; line-height: 1.7; background: #fff; }
  .topbar, details.toc, footer.site { display: none; }
  section.card, figure.shot, .note { break-inside: avoid; page-break-inside: avoid; }
  section.card { border: 1px solid #ccc; padding: 10pt; margin-bottom: 10pt; }
  figure.shot img { max-height: 78mm; object-fit: contain; }
  h1, h2, h3 { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
  code, pre { border: 1px solid #ccc; }
  .print-url::after { content: " (" attr(data-url) ")"; font-size: 0.8em; color: #555; }
}

/* --------------------------------------------------------------- mobile */

@media (max-width: 520px) {
  body { font-size: 16px; }
  .topnav a { padding: 0 0.6rem; font-size: 0.84rem; }
  table.fields th { width: 40%; font-size: 0.78rem; }
}
