@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg-deep: #0B1220;
  --bg-panel: #121B2E;
  --bg-raised: #1A2540;
  --border: #26334D;
  --border-soft: #1E2A45;
  --text-primary: #E7ECF5;
  --text-muted: #8C99B3;
  --text-dim: #5C6A87;

  --teal: #35D0A6;
  --teal-dim: #1E5C4C;
  --amber: #F0A63D;
  --amber-dim: #5C4620;
  --red: #EF5C6E;
  --red-dim: #5C2530;
  --blue: #5B8DEF;
  --blue-dim: #223A66;

  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;

  --radius: 8px;
  --radius-sm: 5px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(91, 141, 239, 0.06), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(53, 208, 166, 0.05), transparent 40%);
  background-attachment: fixed;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-body); font-weight: 600; margin: 0 0 0.5em; letter-spacing: -0.01em; }
p { margin: 0 0 1em; color: var(--text-muted); }

.mono { font-family: var(--font-mono); }

/* ---------------------------------------------------------------- layout */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.brand:hover { text-decoration: none; color: var(--text-primary); }

.brand-logo {
  height: 36px;
  width: auto;
  border-radius: 9px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
  display: block;
}

.brand-text { display: inline-flex; align-items: baseline; gap: 7px; }

.brand .sub { color: var(--text-dim); font-weight: 400; font-size: 13px; }

.nav { display: flex; gap: 4px; align-items: center; }
.nav-user {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 0 4px 0 10px;
  border-left: 1px solid var(--border-soft);
  margin-left: 6px;
}
.nav a {
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
}
.nav a:hover { color: var(--text-primary); background: var(--bg-raised); text-decoration: none; }
.nav a.active { color: var(--teal); background: var(--teal-dim); }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.container-wide { max-width: 1140px; }

/* ---------------------------------------------------------------- cards */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s ease;
}

.card:hover { border-color: var(--border); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 860px) {
  .grid-2, .grid-5 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ dom cards */

.domain-code {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-dim);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.domain-weight {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.domain-name { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.meter-track {
  width: 100%;
  height: 6px;
  background: var(--bg-raised);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 12px;
}
.meter-fill { height: 100%; border-radius: 3px; background: var(--blue); }

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s ease;
}
.btn-primary { background: var(--teal); color: #06231A; }
.btn-primary:hover { background: #46e0b6; text-decoration: none; }
.btn-secondary { background: var(--bg-raised); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--blue); text-decoration: none; }
.btn-danger { background: var(--red-dim); color: var(--red); border-color: var(--red-dim); }
.btn-danger:hover { background: var(--red); color: #2a0a0f; text-decoration: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 20px; }

/* --------------------------------------------------------------- forms */

label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field { margin-bottom: 20px; }
select, input[type=number], input[type=text] {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
}
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }
.help-text { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }

.domain-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.domain-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  font-size: 13px; cursor: pointer;
  user-select: none;
}
.domain-chip input { display: none; }
.domain-chip.checked { border-color: var(--teal); background: var(--teal-dim); color: var(--teal); }

/* ----------------------------------------------------------- session UI */

.session-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}

.progress-track {
  flex: 1; height: 8px; background: var(--bg-raised);
  border-radius: 4px; overflow: hidden; margin: 0 20px;
}
.progress-fill { height: 100%; background: var(--blue); border-radius: 4px; transition: width 0.25s ease; }

.timer {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
.timer.low { color: var(--red); border-color: var(--red-dim); background: var(--red-dim); }

.q-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.q-tag {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 4px; letter-spacing: 0.03em;
}
.q-tag.domain { background: var(--blue-dim); color: var(--blue); }
.q-tag.diff { background: var(--amber-dim); color: var(--amber); }
.q-tag.type { background: var(--bg-raised); color: var(--text-muted); border: 1px solid var(--border); }

.q-stem { font-size: 17px; line-height: 1.6; margin-bottom: 24px; white-space: pre-wrap; }
.q-instructions { font-size: 13px; color: var(--text-dim); margin: -12px 0 20px; font-style: italic; }

.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-raised);
  cursor: pointer; font-size: 14.5px;
}
.choice:hover { border-color: var(--blue); }
.choice.selected { border-color: var(--blue); background: var(--blue-dim); }
.choice.correct { border-color: var(--teal); background: var(--teal-dim); }
.choice.incorrect { border-color: var(--red); background: var(--red-dim); }
.choice .letter {
  font-family: var(--font-mono); font-weight: 600; font-size: 12px;
  width: 22px; height: 22px; border-radius: 5px; background: var(--bg-panel);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--text-muted);
}

.order-list { display: flex; flex-direction: column; gap: 8px; }
.order-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-raised);
  font-size: 14px;
}
.order-item .pos { font-family: var(--font-mono); color: var(--text-dim); width: 20px; }
.order-item .arrows { display: flex; flex-direction: column; gap: 2px; margin-left: auto; }
.order-item button {
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 4px; width: 22px; height: 20px; cursor: pointer; font-size: 11px;
}
.order-item button:hover { color: var(--blue); border-color: var(--blue); }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.match-col-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 10px; }
.match-item {
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-raised);
  font-size: 13.5px; margin-bottom: 8px; cursor: pointer;
}
.match-item.selected { border-color: var(--blue); background: var(--blue-dim); }
.match-item.paired { border-color: var(--teal); }
.match-item .pair-tag {
  font-family: var(--font-mono); font-size: 10px; color: var(--teal);
  float: right;
}

.blank-field { margin-bottom: 14px; }
.blank-field label { font-family: var(--font-mono); font-size: 12px; }

.feedback-banner {
  padding: 16px 18px; border-radius: var(--radius-sm); margin-top: 20px;
  border: 1px solid; font-size: 14px;
}
.feedback-banner.correct { background: var(--teal-dim); border-color: var(--teal); color: var(--teal); }
.feedback-banner.incorrect { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.feedback-banner .expl { color: var(--text-primary); margin-top: 10px; font-size: 13.5px; line-height: 1.6; }

/* ------------------------------------------------------------- reports */

.score-hero {
  display: flex; align-items: center; gap: 32px;
  padding: 32px; margin-bottom: 28px;
}
.score-num { font-family: var(--font-mono); font-size: 56px; font-weight: 700; line-height: 1; }
.score-num.pass { color: var(--teal); }
.score-num.fail { color: var(--red); }
.score-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-top: 8px; }

.pass-pill {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 20px; display: inline-block; margin-top: 10px;
}
.pass-pill.pass { background: var(--teal-dim); color: var(--teal); }
.pass-pill.fail { background: var(--red-dim); color: var(--red); }

.domain-report-row { margin-bottom: 18px; }
.domain-report-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.domain-report-head .name { font-size: 14px; font-weight: 600; }
.domain-report-head .stat { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }

.weight-bar-track { height: 14px; background: var(--bg-raised); border-radius: 4px; overflow: hidden; display: flex; }
.weight-bar-fill { height: 100%; }
.weight-bar-fill.band-strong { background: var(--teal); }
.weight-bar-fill.band-ok { background: var(--blue); }
.weight-bar-fill.band-weak { background: var(--amber); }
.weight-bar-fill.band-critical { background: var(--red); }
.weight-bar-empty { background: var(--border-soft); flex: 1; }

.focus-list { list-style: none; padding: 0; margin: 0; }
.focus-list li {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--border-soft); font-size: 13.5px;
}
.focus-list li:last-child { border-bottom: none; }

table.obj-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.obj-table th { text-align: left; color: var(--text-dim); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
table.obj-table td { padding: 9px 10px; border-bottom: 1px solid var(--border-soft); }
table.obj-table tr:hover td { background: var(--bg-raised); }

.badge { font-family: var(--font-mono); font-size: 11px; padding: 2px 7px; border-radius: 4px; }
.badge.pass { background: var(--teal-dim); color: var(--teal); }
.badge.fail { background: var(--red-dim); color: var(--red); }
.badge.mid { background: var(--amber-dim); color: var(--amber); }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin: 32px 0 14px; }
.section-title:first-child { margin-top: 0; }

.history-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
}
.history-row:last-child { border-bottom: none; }
.history-meta { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }
