@font-face { font-family: "Vazirmatn"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/vazirmatn-arabic-wght-normal.woff2) format("woff2-variations"), url(/fonts/vazirmatn-arabic-wght-normal.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/vazirmatn-latin-wght-normal.woff2) format("woff2-variations"), url(/fonts/vazirmatn-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #14171c; --muted: #4d5561; --line: #d5d9e0;
  --accent: #1f5fbf; --accent-ink: #ffffff; --good: #17803d; --bad: #b42318; --warn-bg: #fff4d6; --warn-ink: #6b4a00;
  --class: #1f5fbf; --alex: #c2410c; --it: #6d28d9;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif; font-size: 18px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
.wrap { max-width: 560px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; line-height: 1.35; margin: 8px 0 12px; }
h2 { font-size: 1.15rem; margin: 18px 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }
.btn { display: block; width: 100%; min-height: 56px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 700; font-size: 1.1rem; padding: 12px 16px; cursor: pointer; text-align: center; text-decoration: none; touch-action: manipulation; }
.btn:disabled { opacity: 0.5; }
.btn.secondary { background: #e7ecf4; color: var(--ink); }
input[type=text] { width: 100%; min-height: 52px; font: inherit; font-size: 1.1rem; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
input[type=text]:focus { outline: none; border-color: var(--accent); }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
span.ltr { white-space: nowrap; }
.credit { font-size: 0.78rem; color: var(--muted); margin-top: 20px; border-top: 1px solid var(--line); padding-top: 10px; }
.banner-sim { background: var(--warn-bg); color: var(--warn-ink); border: 2px solid #e0b100; border-radius: 10px; padding: 8px 14px; font-weight: 800; text-align: center; }
.hidden { display: none !important; }

/* ---------- game 1 trial ---------- */
.stage-wrap { position: fixed; inset: 0; background: #808080; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 4vh; touch-action: manipulation; }
.stage { position: relative; width: min(86vw, 46vh); height: min(86vw, 46vh); }
.stage > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage img { visibility: hidden; image-rendering: auto; }
.stage canvas { visibility: hidden; }
.fix { display: flex; align-items: center; justify-content: center; visibility: hidden; color: #000; font-size: 44px; font-weight: 400; font-family: Arial, sans-serif; }
.show { visibility: visible !important; }
.choices { width: min(96vw, 520px); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 3vh; }
.choice { min-height: 58px; display: flex; align-items: center; gap: 10px; justify-content: flex-start; padding: 6px 14px; border-radius: 12px;
  border: 2px solid #1d2733; background: #fff; color: #111; font: inherit; font-size: 1.15rem; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.choice svg { width: 30px; height: 30px; flex: none; stroke: #1d2733; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.choice:active { background: #dfe8f6; }
.trial-count { color: #fff; font-size: 0.9rem; margin-top: 8px; min-height: 1.6em; text-shadow: 0 1px 2px #0006; }
.feedback { font-weight: 800; font-size: 1.2rem; color: #fff; min-height: 1.8em; text-shadow: 0 1px 2px #0008; }

/* ---------- bars ---------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 7.5em 1fr 3.6em; align-items: center; gap: 8px; }
.bar-track { height: 28px; background: #eceff3; border-radius: 8px; position: relative; overflow: hidden; }
.bar-fill { position: absolute; inset-block: 0; right: 0; border-radius: 8px; }
.bar-val { font-weight: 800; text-align: left; }
.big-score { font-size: 3rem; font-weight: 900; line-height: 1.1; color: var(--class); }

/* ---------- game 2 board ---------- */
.board { position: relative; width: min(94vw, 62vh, 540px); height: min(94vw, 62vh, 540px); margin: 8px auto; background: #fff; border: 2px solid #9aa3af; border-radius: 12px; touch-action: none; overflow: hidden;
  background-image: linear-gradient(#eef1f5 1px, transparent 1px), linear-gradient(90deg, #eef1f5 1px, transparent 1px); background-size: 10% 10%; }
.tile { position: absolute; width: 17%; height: 17%; margin: -8.5% 0 0 -8.5%; border-radius: 50%; border: 3px solid #2b3440; overflow: hidden; touch-action: none; cursor: grab; background: #808080; user-select: none; -webkit-user-select: none; }
.tile img { width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; }
.tile.drag { border-color: var(--accent); box-shadow: 0 4px 14px #0004; z-index: 5; cursor: grabbing; }
.mats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.mat { text-align: center; }
.mat canvas { width: 150px; height: 150px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 6px; }
.legend { direction: ltr; display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 0.8rem; color: var(--muted); }
.legend span.grad { width: 120px; height: 10px; border-radius: 4px; background: linear-gradient(to right, #440154, #3b528b, #21918c, #5ec962, #fde725); }

/* ---------- projector ---------- */
body.screen { font-size: 22px; }
.screen .wrap { max-width: 1500px; padding: 20px 28px; }
.screen h1 { font-size: 2.1rem; margin: 0; }
.screen-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.screen-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; margin-top: 14px; }
.stat { font-size: 3.2rem; font-weight: 900; line-height: 1; }
.stat-label { color: var(--muted); font-size: 1rem; }
.stats { display: flex; gap: 36px; }
.hist { display: flex; align-items: flex-end; gap: 6px; height: 150px; border-bottom: 2px solid #9aa3af; direction: ltr; }
.hist div { flex: 1; background: var(--class); border-radius: 6px 6px 0 0; min-height: 2px; position: relative; }
.hist div span { position: absolute; top: -1.5em; left: 0; right: 0; text-align: center; font-size: 0.8rem; font-weight: 700; color: var(--ink); }
.hist-labels { display: flex; gap: 6px; direction: ltr; font-size: 0.72rem; color: var(--muted); }
.hist-labels span { flex: 1; text-align: center; }
ol.lb { margin: 0; padding-inline-start: 1.6em; font-size: 1.15rem; }
ol.lb li { padding: 3px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 12px; }
ol.lb li b { font-variant-numeric: tabular-nums; }
.qr { width: 150px; height: 150px; background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--line); }
.foot { font-size: 0.8rem; color: var(--muted); margin-top: 16px; }
.screen .mat canvas { width: 250px; height: 250px; }
@media (max-width: 900px) { .screen-grid { grid-template-columns: 1fr; } }
