/* ══════════════════════════════════════════════════════════
   مظنون‌های عجیب — استایل

   کلِ بازی داخلِ یک صفحه‌ی به‌قدِ پنجره جا می‌شود: نه نوارِ اسکرولِ صفحه،
   نه دکمه‌ای که زیرِ خطِ تا گم شود. هرچه جای بیشتری باشد سهمِ بوم می‌شود.
   ══════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../assets/fonts/vazirmatn-arabic.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011,
                 U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../assets/fonts/vazirmatn-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+2212, U+FEFF, U+FFFD;
}

:root {
  --paper:      #FFF7EC;
  --paper-2:    #FFFDF8;
  --ink:        #232019;
  --ink-soft:   #6B6357;
  --line:       #232019;
  --red:        #E4572E;
  --blue:       #2F80ED;
  --yellow:     #FFC94A;
  --green:      #2A9D5C;
  --purple:     #8E5BD6;
  --shadow:     4px 4px 0 var(--line);
  --shadow-sm:  3px 3px 0 var(--line);
  --radius:     18px;

  /* کاغذِ دفترچه */
  --rule-gap:   5.5556%;              /* ۱۸ خط، هر اندازه‌ای که باشد */
  --rule-color: rgba(214, 66, 48, .32);
  --margin-color: rgba(211, 58, 44, .60);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Vazirmatn', system-ui, 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;

  background-image:
    radial-gradient(circle at 12% 18%, rgba(255,201,74,.20), transparent 42%),
    radial-gradient(circle at 88% 8%,  rgba(47,128,237,.14), transparent 40%),
    radial-gradient(circle at 70% 92%, rgba(228,87,46,.12), transparent 42%);
  background-attachment: fixed;

  /* ستونِ به‌قدِ پنجره — صفحه هیچ‌وقت اسکرول نمی‌خورد */
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { margin: 0; line-height: 1.4; font-weight: 800; }

button { font: inherit; color: inherit; cursor: pointer; }

.hidden { display: none !important; }

/* ── نوار بالا ─────────────────────────────────────────── */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px clamp(12px, 3vw, 28px) 8px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { font-size: 26px; line-height: 1; }
.brand h1 {
  font-size: clamp(18px, 3.6vw, 25px);
  letter-spacing: -.5px;
  white-space: nowrap;
}
.topbar-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.counter {
  font-size: 14px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.counter b { color: var(--ink); font-size: 16px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 2px solid var(--line);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  box-shadow: 2px 2px 0 var(--line);
  white-space: nowrap;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--yellow);
  border: 1.5px solid var(--line);
  flex: none;
  animation: blip 1.1s ease-in-out infinite;
}
.pill.ready .dot { background: var(--green); animation: none; }
.pill.basic .dot { background: var(--red); animation: none; }
.pill.offline .dot { background: #999; animation: none; }
@keyframes blip { 50% { opacity: .25; } }

/* ── چیدمان اصلی ───────────────────────────────────────── */
.screen {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 2px clamp(12px, 3vw, 28px) clamp(10px, 2vh, 18px);
}
#playScreen {
  display: grid;
  grid-template-columns: minmax(240px, 330px) 1fr;
  gap: clamp(12px, 2vw, 22px);
  align-items: stretch;
  overflow: hidden;
}

/* ── پنل سرنخ‌ها ───────────────────────────────────────── */
.clue-panel {
  position: relative;
  background: var(--paper-2);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* در چیدمانِ دو ستونه، پنل سرنخ باید دقیقاً تا پایینِ ردیفِ بازی کش بیاید. */
@media (min-width: 861px) {
  .clue-panel { height: 100%; max-height: none; }
}
.file-tab {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  letter-spacing: .3px;
}
.stamp {
  border: 2px solid var(--red);
  color: var(--red);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
  transform: rotate(-4deg);
  opacity: .85;
}
.clue-title { flex: none; font-size: 18px; margin-bottom: 10px; }
.clues {
  list-style: none;
  margin: 0;
  padding: 0 2px 2px 0;
  display: grid;
  gap: 9px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.clues li {
  position: relative;
  background: #FFFBF2;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 9px 38px 9px 13px;
  font-size: 14.5px;
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
  animation: pop .32s cubic-bezier(.2,1.4,.5,1) backwards;
}
.clues li::before {
  content: '“';
  position: absolute;
  inset-inline-start: 12px;
  top: 2px;
  font-size: 30px;
  color: var(--yellow);
  -webkit-text-stroke: 1.5px var(--line);
  line-height: 1.4;
}
.clues li:nth-child(1) { animation-delay: .02s }
.clues li:nth-child(2) { animation-delay: .10s }
.clues li:nth-child(3) { animation-delay: .18s }
.clues li:nth-child(4) { animation-delay: .26s }
.clues li.qa-clue {
  border-color: var(--red);
  background: #FFF5D8;
  display: grid;
  gap: 3px;
}
.clues li.qa-clue::before { content: '?'; font-size: 20px; top: 8px; }
.qa-question, .qa-answer { display: block; }
.qa-question { color: var(--ink-soft); font-size: 12px; padding-bottom: 3px; border-bottom: 1px dashed color-mix(in srgb, var(--line) 25%, transparent); }
.qa-answer { padding-top: 2px; font-weight: 700; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }

.clue-foot {
  flex: none;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ── بوم ───────────────────────────────────────────────── */
.draw-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
  min-height: 0;
}
.canvas-wrap {
  position: relative;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 0;
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.canvas-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  font-size: clamp(20px, 5vw, 30px);
  font-weight: 800;
  color: rgba(35,32,25,.17);
  pointer-events: none;
  transition: opacity .25s;
}
.canvas-hint.gone { opacity: 0; }

/* ── ابزارها ───────────────────────────────────────────── */
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}
.tool-group {
  display: flex;
  gap: 5px;
  align-items: center;
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  border-radius: 999px;
  padding: 5px 7px;
  box-shadow: var(--shadow-sm);
}
/* دکمه‌ی «تمام شد» ردیفِ خودش را دارد ولی داخلِ همان ستونِ به‌قدِ پنجره است */
.draw-panel .btn-done { justify-self: start; }

.swatch {
  width: 25px; height: 25px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  padding: 0;
  transition: transform .12s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.custom {
  position: relative;
  overflow: hidden;
  padding: 0;
  background: conic-gradient(#E4372E, #F3CE2B, #3CA55C, #2F80ED, #8E5BD6, #E4372E);
  cursor: pointer;
  display: inline-block;
  flex: none;
}
.swatch.custom input {
  position: absolute;
  inset: -25%;
  width: 150%;
  height: 150%;
  border: none;
  padding: 0;
  background: transparent;
  opacity: 0;
  cursor: pointer;
}
.swatch.custom::after {
  content: '';
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: var(--custom, transparent);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.8);
}

.swatch[aria-pressed="true"] {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5.5px var(--line);
}

.size {
  width: 29px; height: 29px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  background: transparent;
  display: grid;
  place-content: center;
  padding: 0;
}
.size i {
  display: block;
  border-radius: 50%;
  background: var(--ink);
}
.size[aria-pressed="true"] { border-color: var(--line); background: #FFEFC9; }

.tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13.5px;
  font-weight: 700;
}
.tool:hover { background: #FFEFC9; }
.tool[aria-pressed="true"] { background: var(--yellow); box-shadow: inset 0 0 0 2px var(--line); }
.tool-ico { font-size: 15px; }

/* ── دکمه‌ها ───────────────────────────────────────────── */
.btn {
  border: 3px solid var(--line);
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 16.5px;
  font-weight: 800;
  box-shadow: var(--shadow);
  transition: transform .1s, box-shadow .1s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--line); }
.btn-done { background: var(--yellow); color: var(--ink); }
.btn-done:hover { background: #FFD873; }
.btn-ghost { background: var(--paper-2); font-size: 15px; padding: 9px 18px; }
.btn-share { background: var(--green); color: #fff; font-size: 15px; padding: 9px 18px; }
.btn-share:hover { background: #248a50; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── رونمایی ───────────────────────────────────────────── */
#revealScreen {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.reveal-card {
  background: var(--paper-2);
  border: 3px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: clamp(14px, 2.4vw, 24px);
  display: grid;
  gap: 18px;
  animation: rise .35s cubic-bezier(.2,1.2,.4,1) backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.verdict {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 26px);
  flex-wrap: wrap;
}
.score-ring { position: relative; width: 112px; height: 112px; flex: none; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg) scaleX(-1); }
.ring-bg, .ring-fg {
  fill: none;
  stroke-width: 13;
  stroke-linecap: round;
}
.ring-bg { stroke: #EDE3D4; }
.ring-fg {
  stroke: var(--green);
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.3,1), stroke .4s;
}
.score-num {
  position: absolute;
  inset: 0;
  display: grid;
  grid-auto-flow: column;
  place-content: center;
  align-items: baseline;
  gap: 1px;
  font-size: 31px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
}
.score-num i { font-size: 16px; font-style: normal; opacity: .55; line-height: 1; }

.verdict-text { flex: 1 1 220px; }
.verdict-kicker { margin: 0; font-size: 13px; color: var(--ink-soft); }
.verdict-text h2 { font-size: clamp(22px, 4.4vw, 30px); margin: 2px 0 6px; }
.verdict-msg { margin: 0; font-size: 16px; }
.effort-hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 2vw, 18px);
}
.compare figure { margin: 0; display: grid; gap: 8px; }
.frame {
  border: 3px solid var(--line);
  border-radius: 16px;
  background-color: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.compare img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; display: block; }
/* عکسِ مظنون باید کامل دیده شود؛ حاشیه بهتر از بریدنِ سر یا بدنِ کاراکتر است. */
#realImg { object-fit: contain; object-position: center; background: #fff; }
/* طرحِ بازیکن زمینه‌ی شفاف دارد، پس کاغذِ پشتش پیداست */
#sketchImg { object-fit: contain; background: transparent; }
.compare figcaption {
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ── اشتراک‌گذاری ──────────────────────────────────────── */
.share-box {
  border: 2.5px dashed var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: #FFFBF0;
  display: grid;
  gap: 10px;
}
.share-lead { margin: 0; font-size: 14.5px; font-weight: 700; }
.share-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-form input {
  flex: 1 1 160px;
  min-width: 0;
  font: inherit;
  font-size: 15px;
  color: inherit;
  padding: 8px 14px;
  border: 2.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.share-form input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.share-note { margin: 0; font-size: 13px; color: var(--ink-soft); min-height: 1.2em; }
.share-note.ok { color: var(--green); font-weight: 700; }
.share-note.bad { color: var(--red); font-weight: 700; }

.reveal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 8px 0;
  background: linear-gradient(to top, var(--paper-2) 72%, transparent);
}

/* ── نمایشگاهِ نقاشی‌های بقیه ───────────────────────────── */
.gallery-box { display: grid; gap: 10px; }
.gallery-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-top: 2.5px dashed #E0D5C2;
  padding-top: 12px;
}
.gallery-head h3 { font-size: 17px; }
.gallery-count { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
}
.gallery-item {
  display: grid;
  gap: 5px;
  padding: 0;
  border: none;
  background: none;
  text-align: center;
  animation: pop .3s cubic-bezier(.2,1.4,.5,1) backwards;
}
.gallery-item .frame {
  aspect-ratio: 4 / 3;
  box-shadow: 2px 2px 0 var(--line);
  transition: transform .12s;
}
.gallery-item:hover .frame { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--line); }
.gallery-item img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  min-width: 0;
}

/* ── پرسش از شاهد ───────────────────────────────────────── */
.witness-qa {
  flex: none;
  margin-top: 10px;
  border-top: 2px dashed color-mix(in srgb, var(--line) 32%, transparent);
}
.witness-qa summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}
.witness-qa summary::-webkit-details-marker { display: none; }
.witness-qa summary::before { content: '＋'; color: var(--red); font-size: 15px; }
.witness-qa[open] summary::before { content: '−'; }
.witness-qa summary small { margin-inline-start: auto; color: var(--ink-soft); font-size: 11px; font-weight: 500; white-space: nowrap; }
.witness-qa-body { padding-top: 7px; }
.question-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.question-form[hidden], .question-answer[hidden] { display: none !important; }
.question-form input {
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.question-form input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 55%, transparent); }
.question-form button {
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--yellow);
  color: var(--ink);
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--line);
}
.question-form button:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--line); }
.question-form :disabled { opacity: .55; cursor: not-allowed; }
.question-answer {
  min-height: 1.5em;
  margin: 7px 1px 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}
.gallery-when {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
  white-space: nowrap;
}
.gallery-meta b {
  color: var(--ink);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-score {
  flex: none;
  background: var(--yellow);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0 6px;
  font-weight: 800;
  color: var(--ink);
}
.gallery-empty { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.gallery-skeleton {
  border: 3px solid #E7DCC9;
  border-radius: 16px;
  aspect-ratio: 4 / 3;
  background: #F3EADB;
  animation: blip 1.2s ease-in-out infinite;
}

/* ── لایه‌ی بارگذاری / راهنما / بزرگ‌نمایی ─────────────── */
.busy {
  position: fixed;
  inset: 0;
  background: rgba(35,32,25,.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-content: center;
  padding: 20px;
  z-index: 50;
}
.busy-box {
  background: var(--paper-2);
  border: 3px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 24px 26px;
  text-align: center;
  max-width: 420px;
  width: min(420px, 92vw);
}
.magnifier { font-size: 40px; animation: sway 1.6s ease-in-out infinite; }
@keyframes sway { 50% { transform: translateY(-8px) rotate(-12deg); } }
.busy-box p { margin: 8px 0 0; font-size: 15px; }
.bar {
  margin-top: 14px;
  height: 12px;
  border: 2.5px solid var(--line);
  border-radius: 999px;
  background: #F0E7D8;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 8%;
  background: var(--blue);
  border-radius: 999px;
  transition: width .3s;
}
.intro-box h2 { font-size: 24px; margin: 8px 0 4px; }
.intro-box .btn { margin-top: 16px; }
.intro-note { font-size: 12px !important; color: var(--ink-soft); margin-top: 14px !important; }

.lightbox-box {
  background: var(--paper-2);
  border: 3px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 10px;
  width: min(560px, 92vw);
  justify-items: center;
}
.lightbox-box .frame { width: 100%; }
.lightbox-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.lightbox-cap { margin: 0; font-size: 14px; }

/* ── کاغذِ دفترچه ───────────────────────────────────────────
   خط‌های نازکِ قرمز + حاشیه‌ی عمودیِ سمتِ راست. چون فقط تصویرِ
   زمینه است، هیچ‌وقت واردِ خودِ بوم نمی‌شود: مدل نمی‌بیندش،
   بازیکن می‌بیند. اندازه‌ها درصدی‌اند تا در بندانگشتی‌های
   نمایشگاه هم همان شکل بماند. */
.paper {
  background-color: #FFFDF6;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--rule-gap) - 1px),
      var(--rule-color) calc(var(--rule-gap) - 1px),
      var(--rule-color) var(--rule-gap)
    ),
    linear-gradient(var(--margin-color), var(--margin-color));
  background-size: 100% 100%, 1.5px 100%;
  background-position: 0 0, right 9% top;
  background-repeat: repeat, no-repeat;
}

/* ── موبایل ────────────────────────────────────────────── */
@media (max-width: 860px) {
  #playScreen {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
  }

  .topbar { padding: 8px clamp(10px, 3vw, 28px) 6px; gap: 8px; }
  .brand-mark { font-size: 21px; }
  .brand h1 { font-size: 17px; }
  .topbar-side { gap: 7px; flex: none; }
  .counter { font-size: 12px; }
  .pill { font-size: 11px; padding: 3px 9px; max-width: 42vw; }

  .clue-panel { padding: 10px 12px 8px; max-height: 36vh; }
  .file-tab { margin-bottom: 5px; font-size: 11px; }
  .clue-title { font-size: 15.5px; margin-bottom: 7px; }
  .clues { gap: 7px; }
  .clues li {
    font-size: 13.5px;
    line-height: 1.65;
    padding: 7px 32px 7px 11px;
    box-shadow: 2px 2px 0 var(--line);
  }
  .clues li::before { font-size: 24px; inset-inline-start: 10px; }
  .clue-foot { margin-top: 7px; font-size: 12px; }
  .witness-qa { margin-top: 7px; }
  .witness-qa summary { padding-top: 6px; }
  .question-answer { margin-top: 5px; }

  .tools { gap: 6px; justify-content: center; }
  .tool-lbl { display: none; }
  .tool { padding: 4px 8px; }
  .draw-panel .btn-done {
    justify-self: stretch;
    padding: 9px 18px;
    font-size: 16px;
  }

  .verdict { justify-content: center; text-align: center; }
  .verdict-text { text-align: center; }
  .reveal-actions .btn { flex: 1 1 140px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
}

@media (max-width: 420px) {
  .topbar { flex-wrap: wrap; gap: 4px 10px; }
  .topbar-side { width: 100%; justify-content: flex-start; }
  .pill { max-width: 62vw; }
  .swatch { width: 21px; height: 21px; }
  .size { width: 25px; height: 25px; }
  .tool-group { padding: 4px 5px; gap: 4px; }
  .brand h1 { font-size: 16px; }
  .compare { grid-template-columns: 1fr 1fr; }
  .score-ring { width: 92px; height: 92px; }
  .score-num { font-size: 26px; }
}

/* صفحه‌های کوتاهِ موبایل: سرنخ‌ها کمترین جا را می‌گیرند تا بوم بماند.
   این محدودیت نباید پنلِ دسکتاپ را کوتاه کند. */
@media (max-width: 860px) and (max-height: 700px) {
  .clue-panel { max-height: 30vh; }
  .clue-foot { display: none; }
  .brand-mark { display: none; }
}
@media (max-width: 860px) and (max-height: 560px) {
  .clue-panel { max-height: 34vh; }
  .clue-title { display: none; }
  .topbar { padding-block: 4px; }
}

/* گوشیِ خوابیده: صفحه پهن ولی خیلی کوتاه است — سرنخ‌ها می‌روند کنارِ بوم،
   وگرنه برای بوم چند ده پیکسل بیشتر نمی‌ماند. */
@media (max-width: 900px) and (max-height: 560px) and (orientation: landscape) {
  #playScreen {
    grid-template-columns: minmax(180px, 34%) 1fr;
    grid-template-rows: minmax(0, 1fr);
  }
  .clue-panel { max-height: none; }
  .clue-title, .clue-foot, .file-tab { display: none; }
  .topbar { padding-block: 3px; }
  .brand h1 { font-size: 15px; }
  .tool-group { padding: 3px 5px; }
  .draw-panel { gap: 6px; }
  .draw-panel .btn-done { padding: 6px 16px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
