/* ---------- fonts (self-hosted: no external CDNs from Iran) ---------- */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-FD-Regular.e0e713cd90d9.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-FD-Medium.746006b64c8e.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-FD-Bold.49790e8b277d.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-FD-Black.33a07e1a1f3b.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Lalezar"; src: url("../fonts/Lalezar.d29aca20adbd.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Nastaliq"; src: url("../fonts/Nastaliq.1d9ba7ff26a9.woff2") format("woff2"); font-display: swap; }

:root {
  --bg: #121010;
  --bg-2: #1b1816;
  --bg-3: #252120;
  --line: #3a3330;
  --text: #ece4d6;
  --muted: #a89c8c;
  --paper: #f1e8d4;
  --paper-2: #e6d9bd;
  --ink: #2a2420;
  --ink-soft: #5c5148;
  --red: #b3261e;
  --red-2: #d6453a;
  --gold: #c9a45c;
  --green: #4f8a5b;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Vazirmatn", Tahoma, sans-serif;
  --display: "Lalezar", "Vazirmatn", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.9;
  background-image: radial-gradient(ellipse at top, #2a201c 0%, var(--bg) 60%);
  background-attachment: fixed;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.5; margin: 0 0 .6em; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: 0; }
h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.4rem, 3.5vw, 2rem); }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* ---------- header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); background: rgba(18, 16, 16, .85); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.logo { font-family: var(--display); font-size: 1.8rem; color: var(--text); display: flex; align-items: center; gap: 10px; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 34px; height: 34px; border: 2px solid var(--red); color: var(--red); border-radius: 6px; display: grid; place-items: center; font-size: 1.1rem; transform: rotate(-6deg); }
.nav { display: flex; gap: 6px; margin-inline-start: auto; align-items: center; flex-wrap: wrap; }
.nav a, .nav button { color: var(--text); padding: 6px 12px; border-radius: 8px; font: inherit; font-size: .95rem; background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--bg-3); text-decoration: none; }
.nav form { margin: 0; }
.site-footer { border-top: 1px solid var(--line); margin-top: 80px; padding: 32px 0; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
:target { scroll-margin-top: 88px; }
.foot-links { display: flex; flex-direction: column; gap: 2px; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--gold); }
.badge { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: .75rem; line-height: 1.6; text-align: center; }

/* ---------- buttons, forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 1rem; padding: 10px 22px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; background: var(--red); color: #fff; transition: background .15s, transform .05s; }
.btn:hover { background: var(--red-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; border-color: var(--line); color: var(--text); }
.btn.secondary:hover { background: var(--bg-3); }
.btn.gold { background: var(--gold); color: #1d1712; }
.btn.gold:hover { background: #d8b673; }
.btn.small { padding: 6px 14px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; margin-bottom: 4px; }
input[type=text], input[type=tel], input[type=password], input[type=email], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 164, 92, .2); }
.helptext, .field .help { color: var(--muted); font-size: .85rem; }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: #ff8a80; font-size: .9rem; }

.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.auth-card { max-width: 440px; margin: 48px auto; }
textarea { resize: vertical; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.contact-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 24px; align-items: start; margin-top: 24px; }
.contact-grid .facts a { direction: ltr; }
.tips { padding-inline-start: 1.2em; }
.tips li { margin-bottom: 6px; }

.messages { list-style: none; padding: 0; margin: 20px 0 0; }
.messages li { padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; border: 1px solid var(--line); background: var(--bg-3); }
.messages li.success { border-color: #3f6e49; background: #1c2a1f; }
.messages li.error { border-color: #7a2c26; background: #2c1715; }

/* ---------- home ---------- */
.hero { padding: 72px 0 48px; display: grid; gap: 40px; grid-template-columns: 1.2fr 1fr; align-items: center; }
.hero p.lead { font-size: 1.15rem; color: #d7ccbb; max-width: 34em; }
.hero-art { position: relative; aspect-ratio: 4 / 3.3; }
.hero-art .sheet { position: absolute; background: var(--paper); color: var(--ink); border-radius: 4px; box-shadow: var(--shadow); padding: 18px; font-size: .8rem; line-height: 1.8; }
.hero-art .sheet.s1 { inset: 4% 18% 22% 4%; transform: rotate(-5deg); }
.hero-art .sheet.s2 { inset: 20% 2% 2% 30%; transform: rotate(4deg); background: var(--paper-2); }
.stamp { display: inline-block; border: 3px solid var(--red); color: var(--red); font-weight: 900; padding: 2px 12px; border-radius: 6px; transform: rotate(-8deg); letter-spacing: 1px; opacity: .85; }
.kicker { color: var(--gold); font-weight: 700; letter-spacing: .5px; font-size: .95rem; margin-bottom: 8px; display: block; }

.section { padding: 48px 0; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.step { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step .num { font-family: var(--display); font-size: 2rem; color: var(--red); line-height: 1; display: block; margin-bottom: 8px; }

.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.case-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s; }
.case-card:hover { transform: translateY(-3px); border-color: #5a4d44; }
.case-card .cover { aspect-ratio: 16 / 10; background: #0d0b0a; display: block; overflow: hidden; }
.case-card .cover img, .case-card .cover svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.case-card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.case-card h3 { font-family: var(--display); font-weight: 400; font-size: 1.5rem; margin: 0; }
.case-card h3 a { color: var(--text); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .8rem; padding: 2px 10px; border-radius: 99px; background: var(--bg-3); border: 1px solid var(--line); color: #d9cfbf; white-space: nowrap; }
.price { font-weight: 900; font-size: 1.2rem; white-space: nowrap; line-height: 1.5; }
.price del { color: var(--muted); font-weight: 400; font-size: .85rem; margin-inline-start: 6px; }
.case-card .price del { display: block; margin: 0; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; }

.faq details { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 10px 0 0; color: #d4c9b8; }

/* ---------- case detail ---------- */
.detail { display: grid; grid-template-columns: 1fr 360px; gap: 32px; padding-top: 40px; align-items: start; }
.detail .cover { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-bottom: 24px; }
.detail .cover img, .detail .cover svg { display: block; width: 100%; }
.buy-box { position: sticky; top: 88px; }
.buy-box .price { font-size: 1.6rem; display: block; margin-bottom: 12px; }
.facts { list-style: none; padding: 0; margin: 0 0 18px; }
.facts li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 8px 0; }
.facts li span:first-child { color: var(--muted); }
.prose { color: #ddd2c1; }
.prose h3 { color: var(--text); margin-top: 1.4em; }
.prose ul { padding-inline-start: 1.3em; }
.people-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.person { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; text-align: center; }
.person .portrait { width: 84px; height: 84px; margin: 0 auto 8px; border-radius: 50%; overflow: hidden; background: var(--bg-3); }
.person .portrait svg { width: 100%; height: 100%; display: block; }
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Real photos look like ID pictures clipped to the file. */
.person .portrait.photo { width: 84px; height: 112px; border-radius: 3px; border: 3px solid var(--paper); box-shadow: 0 6px 14px rgba(0, 0, 0, .45); transform: rotate(-1.5deg); }
.person:nth-child(even) .portrait.photo { transform: rotate(1.5deg); }
.person strong { display: block; }
.person span { font-size: .82rem; color: var(--muted); }

/* ---------- library ---------- */
.lib-item { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; }
.lib-item + .lib-item { margin-top: 16px; }
.lib-item .cover { border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 10; background: #0d0b0a; }
.lib-item .cover img, .lib-item .cover svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.progress-bar { height: 8px; background: var(--bg-3); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress-bar span { display: block; height: 100%; background: var(--gold); }
.files { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- play board ---------- */
.board { display: grid; grid-template-columns: 1fr 340px; gap: 24px; padding-top: 28px; align-items: start; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; padding-top: 28px; }
.stage-track { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-track span { font-size: .85rem; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.stage-track span.done { border-color: #3f6e49; color: #9fd3a8; }
.stage-track span.now { border-color: var(--gold); color: var(--gold); font-weight: 700; }
.objective { border-inline-start: 4px solid var(--red); }
.objective .label { color: var(--red-2); font-weight: 900; font-size: .85rem; letter-spacing: 1px; }
.answer-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.answer-form input, .answer-form select { flex: 1 1 220px; }
.attempts { list-style: none; padding: 0; margin: 10px 0 0; font-size: .85rem; color: var(--muted); }
.attempts li::before { content: "✗ "; color: var(--red-2); }

.envelope { margin-top: 24px; }
.envelope-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.envelope-head h3 { margin: 0; }
.env-badge { background: var(--paper-2); color: var(--ink); font-weight: 900; border-radius: 4px; padding: 0 10px; font-size: .9rem; }
.envelope.locked { opacity: .55; }
.envelope.locked .locked-box { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.doc-tile { background: var(--paper); color: var(--ink); border-radius: 4px; padding: 14px 14px 12px; min-height: 120px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); position: relative; transition: transform .12s; }
.doc-tile:nth-child(3n+1) { transform: rotate(-.6deg); }
.doc-tile:nth-child(3n+2) { transform: rotate(.5deg); }
.doc-tile:hover { transform: translateY(-3px) rotate(0); text-decoration: none; }
.doc-tile .code { font-weight: 900; color: var(--red); font-size: .85rem; }
.doc-tile .t { font-weight: 700; line-height: 1.6; }
.doc-tile .k { font-size: .78rem; color: var(--ink-soft); margin-top: auto; }

.side .card + .card { margin-top: 16px; }
.side h3 { display: flex; align-items: center; gap: 8px; }
.hint { background: var(--bg-3); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: .95rem; }
.hint .cost { color: var(--muted); font-size: .8rem; }
#notes { min-height: 220px; resize: vertical; line-height: 1.8; }
.save-state { font-size: .8rem; color: var(--muted); }
.mini-people { list-style: none; padding: 0; margin: 0; }
.mini-people li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.mini-people .portrait { width: 44px; height: 44px; flex: none; border-radius: 50%; overflow: hidden; background: var(--bg-3); }
.mini-people .portrait svg { width: 100%; height: 100%; display: block; }
.mini-people .portrait.photo { width: 42px; height: 56px; border-radius: 3px; border: 2px solid var(--paper); }
.mini-people small { display: block; color: var(--muted); line-height: 1.5; }
.tag-victim { color: var(--red-2); font-size: .75rem; font-weight: 700; }

.accuse-card { border: 1px solid var(--red); background: linear-gradient(180deg, #2a1514, var(--bg-2)); }
.accuse-card fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.accuse-card legend { font-weight: 700; margin-bottom: 6px; }
.choice-list { display: grid; gap: 6px; }
.choice-list label { display: flex; gap: 10px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.choice-list input { accent-color: var(--red); }
.choice-list label:has(input:checked) { border-color: var(--gold); background: #231d15; }

/* ---------- document reader ---------- */
.reader { padding: 24px 0 40px; }
.reader-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.paper { background: var(--paper); color: var(--ink); border-radius: 3px; box-shadow: var(--shadow); padding: clamp(18px, 5vw, 56px); max-width: 860px; margin: 0 auto; line-height: 2; font-size: 1rem; position: relative; }
.paper a { color: #7a4a12; }

/* ---------- solution ---------- */
.verdict { text-align: center; padding: 40px 24px; }
.score { font-family: var(--display); font-size: 4rem; line-height: 1; color: var(--gold); }
.result-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.result-table td, .result-table th { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: start; vertical-align: top; }
.ok { color: #8fd19a; font-weight: 700; }
.bad { color: #ff8a80; font-weight: 700; }

/* ---------- fake gateway ---------- */
.gateway { max-width: 420px; margin: 60px auto; background: #fff; color: #222; border-radius: 12px; padding: 28px; }
.gateway h2 { font-family: var(--font); font-weight: 900; color: #222; }

@media (max-width: 900px) {
  .hero, .detail, .board, .contact-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 40px; }
  .hero-art { max-width: 420px; }
  .buy-box { position: static; }
  .lib-item { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .site-header { position: static; }
  .site-header .wrap { padding: 8px 0; }
  .nav { margin-inline-start: 0; width: 100%; justify-content: flex-start; }
  .nav a, .nav button { padding: 4px 8px; font-size: .9rem; }
  .card { padding: 18px; }
}
