/* Design system — "exam paper & atlas"
   Warm paper, ink type, hairline rules. Kurdish flag colours carry meaning:
   green = correct, red = wrong / penalty, sun-gold = the single highlight. */
@import url('/fonts/kufi/arabic-400.css');
@import url('/fonts/kufi/arabic-500.css');
@import url('/fonts/kufi/arabic-600.css');
@import url('/fonts/kufi/arabic-700.css');
@import url('/fonts/kufi/arabic-900.css');
@import url('/fonts/kufi/latin-400.css');
@import url('/fonts/kufi/latin-600.css');
@import url('/fonts/kufi/latin-700.css');
@import url('/fonts/plex-mono/latin-400.css');
@import url('/fonts/plex-mono/latin-500.css');

:root {
  --paper: #f3eee3;
  --paper-2: #e9e2d2;
  --sheet: #fcfaf5;
  --ink: #1c1a16;
  --ink-2: #4b463d;
  --muted: #8b8475;
  --rule: rgba(28, 26, 22, 0.13);
  --rule-2: rgba(28, 26, 22, 0.28);
  --sun: #d6961a;
  --sun-soft: #f4e2b8;
  --red: #c0352b;
  --red-soft: #f3d9d4;
  --green: #2a7a4b;
  --green-soft: #d6eadc;
  --shadow: 0 1px 0 rgba(28, 26, 22, 0.05), 0 10px 30px -12px rgba(28, 26, 22, 0.22);
  --shadow-lg: 0 2px 0 rgba(28, 26, 22, 0.05), 0 30px 60px -24px rgba(28, 26, 22, 0.35);
  --radius: 6px;
  --display: 'Noto Kufi Arabic', Tahoma, sans-serif;
  --font: 'Noto Kufi Arabic', Tahoma, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  /* kept for older selectors */
  --text: var(--ink);
  --line: var(--rule);
  --gold: var(--sun);
  --cyan: var(--ink-2);
  --bg: var(--paper);
  --panel: var(--sheet);
  --panel-solid: var(--sheet);
  --gold2: #b5761a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; color: inherit; }

/* subtle paper grain, reusable */
.grain {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.09 0 0 0 0 0.07 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* portrait: a square candidate photo, not a glowing orb */
.avatar {
  border-radius: 4px;
  background: var(--c);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--mono); }

/* controls */
.btn {
  appearance: none;
  border: 1px solid var(--rule-2);
  background: var(--sheet);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: #000; }
.btn.good { background: var(--green); border-color: var(--green); color: #fff; }
.btn.bad { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--rule-2); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.big { padding: 13px 20px; font-size: 16px; }
.btn.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }

input.field, textarea.field, select.field {
  width: 100%;
  background: var(--sheet);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}
input.field:focus, textarea.field:focus, select.field:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(28, 26, 22, .08); }
textarea.field { resize: vertical; min-height: 60px; line-height: 1.7; }

.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 16px; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 3px; font-size: 12px; font-weight: 600;
  background: var(--paper-2); border: 1px solid var(--rule);
}
.pill.good { background: var(--green-soft); color: var(--green); border-color: transparent; }
.pill.bad { background: var(--red-soft); color: var(--red); border-color: transparent; }
.pill.gold { background: var(--sun-soft); color: #7a5206; border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--red); }
.dot.on { background: var(--green); }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); border-right: 4px solid var(--red);
  padding: 10px 16px; border-radius: var(--radius); z-index: 1000; font-size: 14px;
  box-shadow: var(--shadow-lg); animation: toastIn .2s ease-out;
}
.toast.ok { border-right-color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login {
  width: min(400px, 100%); text-align: center; background: var(--sheet);
  border: 1px solid var(--rule); border-radius: 8px; padding: 34px 28px 26px; box-shadow: var(--shadow-lg);
  position: relative;
}
.login::before { content: ''; position: absolute; inset: 0 0 auto; height: 5px; border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, var(--red) 0 33.3%, var(--sheet) 33.3% 66.6%, var(--green) 66.6%); }
.login h1 { margin: 0 0 4px; font-family: var(--display); font-size: 28px; font-weight: 900; }
.login p { margin: 0 0 22px; color: var(--muted); }
.login input { text-align: center; font-family: var(--mono); font-size: 26px; letter-spacing: 10px; padding: 12px; direction: ltr; }
.login .btn { width: 100%; margin-top: 12px; }
.login .err { color: var(--red); margin-top: 12px; min-height: 1.2em; }
