/* Insight Compass — shared styles. Palette taken from the logo: black shield, gold trim. */
:root {
  --bg: #0c0b09;
  --bg-2: #15130f;
  --panel: #1b1914;
  --panel-2: #242018;
  --line: #3a3224;
  --text: #f3ecdc;
  --muted: #b3a88f;
  --gold: #d4a43a;
  --gold-2: #f2d27a;
  --gold-3: #8a6420;
  --danger: #e0745a;
  --ok: #8fc27a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at top, #1d1a12 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.8;
}
a { color: var(--gold-2); }
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; }
main.wide { max-width: 1100px; }

/* ---------- header ---------- */
.site-header { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 20px 16px 4px; }
.site-header img { width: 64px; height: auto; display: block; }
.site-header .title { font-size: 20px; font-weight: 700; color: var(--gold-2); letter-spacing: .3px; }

/* ---------- cards & controls ---------- */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}
h1, h2, h3 { line-height: 1.4; margin: 0 0 12px; }
h1, h2 { color: var(--gold-2); }
.muted { color: var(--muted); }
.notice {
  border: 1px solid var(--gold-3);
  background: rgba(212, 164, 58, .08);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; cursor: pointer;
  border: 1px solid var(--gold-3); border-radius: 10px;
  padding: 10px 22px; color: var(--text); background: var(--panel-2);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #1a1305; border-color: var(--gold); }
.btn:disabled { opacity: .5; cursor: default; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 15px; }

/* ---------- footer ---------- */
.site-footer { text-align: center; padding: 18px 16px 22px; border-top: 1px solid var(--line); font-size: 15px; }
.site-footer a { color: var(--gold-2); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .card { padding: 22px 16px; }
}

/* ---------- control panel ---------- */
.narrow { max-width: 460px; margin: 0 auto; }
.small { font-size: 14px; }
.btn.small { padding: 5px 12px; font-size: 14px; font-weight: 500; }
.btn.danger { border-color: #6b3427; color: var(--danger); }
.grow { flex: 1; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.warn { color: var(--danger); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; }
.tab { font: inherit; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 6px 14px; cursor: pointer; }
.tab.on { color: var(--gold-2); border-color: var(--gold-3); background: var(--panel); }
.savebar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(12, 11, 9, .92); padding: 8px 0; margin-bottom: 12px; }
.cols { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-bottom: 16px; }
.col { padding: 18px; }
main.wide .card + .card { margin-top: 16px; }
ol.pick { list-style: none; margin: 0 0 12px; padding: 0; max-height: 420px; overflow: auto; }
ol.pick button { width: 100%; text-align: right; font: inherit; font-size: 15px; color: var(--text); background: transparent;
  border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; cursor: pointer; line-height: 1.5; }
ol.pick button:hover { background: var(--panel-2); }
ol.pick button.on { border-color: var(--gold-3); background: var(--panel-2); color: var(--gold-2); }
ol.pick small { color: var(--muted); }
ol.items { padding-inline-start: 22px; }
ol.items li { margin-bottom: 14px; }
ol.items select { width: auto; padding: 4px 8px; font-size: 14px; }
ol.src { color: var(--muted); font-size: 15px; }
details summary { cursor: pointer; color: var(--gold-2); margin: 8px 0; }
label.field.inline { display: inline-block; min-width: 180px; margin-bottom: 0; }
label.check { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 15px; }
label.check input { width: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--panel-2);
  border: 1px solid var(--gold); color: var(--text); padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); }
.toast.bad { border-color: var(--danger); }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }

/* ---------- flow editor ---------- */
.tabs.sub { margin-bottom: 12px; }
.badge { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--gold-3); color: var(--gold-2); }
.box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; background: rgba(0, 0, 0, .15); }
.box > input, .box > textarea { margin-bottom: 8px; }
.box .row select, .box .row input { width: auto; }
ol.items .row input { flex: 1; min-width: 140px; width: auto; }
ol.items .row select { flex: 1; min-width: 160px; }
table.weights { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
table.weights th { color: var(--muted); font-weight: 500; text-align: right; padding: 2px 4px; }
table.weights td { padding: 3px 4px; vertical-align: middle; }
table.weights input.w { width: 64px; padding: 4px 6px; }
table.weights input[type=checkbox] { width: auto; }
ul.map { list-style: none; margin: 0; padding-inline-start: 22px; border-inline-start: 1px dashed var(--line); }
ul.map.root { padding-inline-start: 0; border: 0; }
ul.map li { margin: 6px 0; }
ul.map .edge { color: var(--muted); font-size: 14px; }
ul.map .edge::after { content: ' ←'; }
h4 { margin: 18px 0 6px; color: var(--gold-2); }
.col h3.grow { margin: 0; }

/* ---------- test-taker page ---------- */
/* Animated background: a slow warm glow and drifting gold specks. Off for people who prefer less motion. */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(212, 164, 58, .14), transparent 70%); animation: glow 14s ease-in-out infinite alternate; }
.sky i { position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold-2); opacity: 0;
  box-shadow: 0 0 8px 2px rgba(242, 210, 122, .5); animation: rise 18s linear infinite; }
.sky i:nth-child(1) { left: 6%; animation-delay: 0s; } .sky i:nth-child(2) { left: 14%; animation-delay: 6s; animation-duration: 22s; }
.sky i:nth-child(3) { left: 23%; animation-delay: 11s; } .sky i:nth-child(4) { left: 31%; animation-delay: 3s; animation-duration: 25s; }
.sky i:nth-child(5) { left: 42%; animation-delay: 8s; } .sky i:nth-child(6) { left: 50%; animation-delay: 14s; animation-duration: 20s; }
.sky i:nth-child(7) { left: 58%; animation-delay: 1s; animation-duration: 24s; } .sky i:nth-child(8) { left: 67%; animation-delay: 9s; }
.sky i:nth-child(9) { left: 75%; animation-delay: 4s; animation-duration: 21s; } .sky i:nth-child(10) { left: 83%; animation-delay: 12s; }
.sky i:nth-child(11) { left: 90%; animation-delay: 7s; animation-duration: 26s; } .sky i:nth-child(12) { left: 96%; animation-delay: 16s; }
@keyframes rise { 0% { transform: translateY(0) scale(.6); opacity: 0; } 10% { opacity: .7; } 80% { opacity: .35; } 100% { transform: translateY(-105vh) translateX(30px) scale(1); opacity: 0; } }
@keyframes glow { from { opacity: .7; } to { opacity: 1; } }

.stage { opacity: 0; transform: translateY(10px); transition: opacity .35s ease, transform .35s ease; }
.stage.in { opacity: 1; transform: none; }
.stage h1, .stage h2 { text-align: center; }
.stage h2 { font-size: 22px; color: var(--text); margin: 6px 0 20px; }
.stage h1:focus, .stage h2:focus, .stage .msg:focus { outline: none; }
.art { display: block; width: 72px; height: 72px; margin: 4px auto 10px; }
.art g { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.progress { height: 6px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; margin-bottom: 18px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .5s ease; }
.prompt { text-align: center; margin: 0 0 4px; }
.options { display: grid; gap: 10px; }
.opt { font: inherit; text-align: right; color: var(--text); background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; line-height: 1.6; }
.opt:hover, .opt.on { border-color: var(--gold); background: rgba(212, 164, 58, .08); }
.opt.picked { border-color: var(--gold-2); background: rgba(212, 164, 58, .18); transform: scale(.99); }
label.opt.check { display: flex; gap: 12px; align-items: center; color: var(--text); font-size: inherit; }
label.opt.check input { width: 20px; height: 20px; accent-color: var(--gold); flex: none; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pt { font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; transition: border-color .15s ease, background .15s ease; line-height: 1.4; }
.pt b { font-size: 20px; color: var(--gold-2); }
.pt span { font-size: 13px; color: var(--muted); }
.pt:hover { border-color: var(--gold); }
.pt.picked { border-color: var(--gold-2); background: rgba(212, 164, 58, .18); }
.btn.link { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; text-decoration: underline; text-underline-offset: 4px; }
.btn.link:hover { color: var(--gold-2); }
.btn.dk { display: block; margin: 14px auto 0; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.hint { text-align: center; margin: 6px 0 0; }
@media (hover: none) { .hint { display: none; } }
.msg { font-size: 18px; }
.startform { margin-top: 18px; }
.startform .btn { width: 100%; }
.urgent { border: 1px solid var(--danger); background: rgba(224, 116, 90, .1); border-radius: 12px; padding: 4px 16px; margin: 14px 0; }
.part { margin: 18px 0; }
.part h3 { color: var(--gold-2); font-size: 19px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.part .line p { margin: 8px 0; }
@media (max-width: 560px) {
  .scale { grid-template-columns: 1fr; }
  .pt { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 12px 16px; }
  .pt span { font-size: 15px; color: var(--text); }
  .stage h2 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .sky, .sky i { animation: none; }
  .sky i { display: none; }
  .stage { transition: none; opacity: 1; transform: none; }
  .progress span { transition: none; }
}

/* ---------- AI tab ---------- */
.tablewrap { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table.models { width: 100%; border-collapse: collapse; font-size: 14px; }
table.models th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-weight: 500; text-align: right; padding: 6px 8px; }
table.models td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
table.models tr.on td { background: rgba(212, 164, 58, .08); }
table.models input[type=radio] { width: auto; accent-color: var(--gold); }
ol.trial li { margin: 6px 0; }
ol.trial li.ok { color: var(--ok); }
ol.trial li.no { color: var(--muted); }
.notice.small { font-size: 14px; }
.waiting { text-align: center; margin: 10px 0 0; }

/* reports tab */
.badge.danger { border-color: var(--danger); color: var(--danger); }
table.reports tr.on td { background: var(--panel-2); }
table.reports td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
ol.log li { margin: 4px 0; }
.row > select { width: auto; }

/* preview of the test from the control panel */
.preview-note { text-align: center; font-size: 14px; color: var(--gold-2); border: 1px dashed var(--gold-3); border-radius: 10px; padding: 6px 10px; margin: 0 0 12px; }
.badge.draft { border-color: var(--danger); color: var(--danger); }
.blockers { border: 1px solid var(--danger); border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; }
.blockers.ok { border-color: var(--gold-3); }
.blockers ul { margin: 6px 0 0; padding-inline-start: 20px; max-height: 180px; overflow: auto; }
.reports .code { font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }
