/* Friend Questions, pixel theme.
   Palette is PICO-8 style: navy ground, cream panels, pink/yellow/blue accents.
   Borders are drawn with four hard box-shadows so every corner is stepped, like an 8-bit UI. */

@font-face { font-family: "Press Start 2P"; font-weight: 400; font-display: swap;
  src: url("fonts/press-start-2p-latin-400-normal.woff2") format("woff2"); }

/* Latin first, Arabic after, so the Arabic face wins for the half-space (U+200C) used in Persian. */
@font-face { font-family: "Vazirmatn"; font-weight: 400; font-display: swap;
  src: url("fonts/vazirmatn-latin-400-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+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Vazirmatn"; font-weight: 400; font-display: swap;
  src: url("fonts/vazirmatn-arabic-400-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, 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-weight: 700; font-display: swap;
  src: url("fonts/vazirmatn-latin-700-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+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Vazirmatn"; font-weight: 700; font-display: swap;
  src: url("fonts/vazirmatn-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, 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-weight: 900; font-display: swap;
  src: url("fonts/vazirmatn-latin-900-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+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Vazirmatn"; font-weight: 900; font-display: swap;
  src: url("fonts/vazirmatn-arabic-900-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

/* Optional Persian pixel font. Build noqte.ttf from github.com/mehdisadeghi/Noqte (OFL license),
   put it in fonts/, remove this comment, and add "Noqte" at the front of --fa-display below.
@font-face { font-family: "Noqte"; src: url("fonts/noqte.ttf") format("truetype"); font-display: swap; }
*/

:root {
  --navy: #1D2B53;
  --ink: #0B1030;
  --cream: #FFF1E8;
  --pink: #FF77A8;
  --yellow: #FFEC27;
  --blue: #29ADFF;
  --green: #00E436;
  --red: #C0003A;
  --lav: #83769C;
  --muted: #4A4F73;
  --px: 4px;
  --bd: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink);
  --fa: "Vazirmatn", Tahoma, system-ui, sans-serif;
  --fa-display: "Vazirmatn", Tahoma, system-ui, sans-serif;
  --pixel: "Press Start 2P", "Courier New", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--navy);
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.05) 75%),
    linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.05) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
  color: var(--cream);
  font-family: var(--fa);
  font-size: 16px;
  line-height: 1.9;
  padding-block: 28px 72px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.page { max-width: 680px; margin-inline: auto; display: flex; flex-direction: column; gap: 32px; }
.stack { display: flex; flex-direction: column; gap: 32px; }
[hidden] { display: none !important; }

/* Panels: cream box, stepped ink border, hard drop shadow. */
.panel {
  background: var(--cream);
  color: var(--ink);
  box-shadow: var(--bd);
  margin: var(--px);
  padding: 20px;
  filter: drop-shadow(6px 6px 0 rgba(0, 0, 0, .4));
  min-width: 0;
}
.banner { background: var(--yellow); display: flex; flex-direction: column; gap: 14px; }
h1 {
  margin: 0;
  font-family: var(--fa-display);
  font-weight: 900;
  font-size: clamp(2rem, 9vw, 2.9rem);
  line-height: 1.5;
  text-shadow: 3px 3px 0 var(--pink);
  text-wrap: balance;
}
.lead { margin: 0; max-width: 46ch; font-weight: 500; }
.hint { margin: 0; color: var(--muted); font-size: .9rem; }

.hud {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  font-family: var(--pixel); font-size: 10px; line-height: 1.6; direction: ltr;
}
.tag { display: inline-block; background: var(--ink); color: var(--yellow); padding: 6px 8px; }
.tag.pink { background: var(--pink); color: var(--ink); }
.lives { display: inline-flex; gap: 6px; align-items: center; }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.sprite { display: block; flex: none; }

.level { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 4px 14px; font-family: var(--fa-display); }
.level h2 { margin: 0; font-size: 1.25rem; font-weight: 700; text-shadow: 2px 2px 0 var(--ink); }
.level small { font-weight: 400; font-size: .9rem; opacity: .85; }
.level .tag { font-family: var(--pixel); }

.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field { margin-top: 20px; }
.label { font-weight: 700; }

input[type="text"], input[type="password"], textarea {
  display: block;
  width: calc(100% - 8px);
  margin: 4px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  box-shadow: var(--bd);
}
textarea { min-height: 88px; resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 4px solid var(--blue); outline-offset: 4px;
}
.chip input:focus-visible + span { outline: 4px solid var(--blue); outline-offset: 4px; }
::placeholder { color: #6b6f8f; opacity: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 14px 12px; }
.chip { position: relative; display: inline-flex; margin: 4px; }
.chip input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; color: var(--ink); padding: 6px 16px; box-shadow: var(--bd);
}
.chip b { display: flex; font-weight: 400; }
.chip input:checked + span { background: var(--yellow); font-weight: 700; box-shadow: var(--bd), inset 0 -4px 0 0 rgba(0, 0, 0, .25); }

.q {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px;
  padding-block: 18px; border-top: 4px dotted rgba(11, 16, 48, .2);
}
.q:first-child { border-top: 0; padding-top: 4px; }
.q:last-child { padding-bottom: 4px; }
.num {
  font-family: var(--pixel); font-size: 10px; line-height: 1; direction: ltr;
  background: var(--navy); color: var(--yellow); padding: 8px 6px; height: max-content; margin-top: 4px;
}
.q-text { display: block; margin: 0 0 10px; font-weight: 700; }

.btn {
  font: inherit; font-weight: 700; font-size: 1rem; color: var(--ink);
  background: var(--pink); border: 0; border-radius: 0; margin: 4px; padding: 10px 24px; cursor: pointer;
  box-shadow: var(--bd), inset 0 -4px 0 0 rgba(0, 0, 0, .25);
}
.btn:hover { background: var(--yellow); }
.btn:active { transform: translateY(4px); }
.btn.blue { background: var(--blue); }
.btn.white { background: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.actions { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.bar { display: flex; flex-wrap: wrap; gap: 4px; direction: ltr; }
.bar i { width: 12px; height: 16px; background: var(--lav); opacity: .45; }
.bar i.on { background: var(--green); opacity: 1; }
.count { font-size: .9rem; color: var(--muted); }
.status { margin: 0; min-height: 1.9em; font-weight: 700; }
.status.warn { color: var(--red); }
.status.ok { color: #00702a; }

.done { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.done h2 { margin: 0; font-family: var(--fa-display); font-size: 1.7rem; font-weight: 900; }
.saved { margin: 0; font-weight: 700; color: #00702a; }
.copybox { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.copybox textarea { min-height: 200px; font-size: .9rem; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Admin */
.resp { background: var(--cream); color: var(--ink); box-shadow: var(--bd); margin: var(--px); padding: 10px 16px; filter: drop-shadow(6px 6px 0 rgba(0, 0, 0, .4)); }
.resp summary { cursor: pointer; font-weight: 700; }
.resp summary span { font-weight: 400; color: var(--muted); }
.resp dl { margin: 14px 0 6px; display: flex; flex-direction: column; gap: 12px; }
.resp dt { color: var(--muted); font-size: .9rem; }
.resp dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.resp .row { margin-top: 10px; }
.list { display: flex; flex-direction: column; gap: 26px; }

@media (prefers-reduced-motion: reduce) {
  .blink { animation: none; }
  * { scroll-behavior: auto !important; transition: none !important; }
}
