:root {
  --bg: #14080a;
  --bg2: #1c0c10;
  --panel: rgba(36, 12, 16, 0.94);
  --stroke: rgba(255, 80, 90, 0.22);
  --text: #fdecee;
  --muted: #c4a0a6;
  --accent: #e30613;
  --accent2: #ff4d57;
  --danger: #ff6b7a;
  --warn: #f5c14a;
  --ok: #3ddc97;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 8% -8%, rgba(227, 6, 19, 0.28), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(255, 77, 87, 0.14), transparent 50%),
    linear-gradient(180deg, var(--bg), #0a0406 80%);
}

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

.wrap {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.4rem 0.55rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.jt-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}
.brand p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.nav a, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.15s ease;
  text-decoration: none;
}
.nav a:hover, .btn:hover {
  border-color: rgba(227, 6, 19, 0.65);
  background: rgba(227, 6, 19, 0.16);
  text-decoration: none;
}
.nav a.active {
  background: rgba(227, 6, 19, 0.28);
  border-color: rgba(255, 77, 87, 0.75);
}
.btn-primary {
  background: linear-gradient(135deg, #e30613, #b80510);
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.tab {
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
}
.tab.active {
  color: var(--text);
  background: rgba(227, 6, 19, 0.22);
  border-color: rgba(255, 77, 87, 0.55);
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
th, td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: left;
  font-size: 0.92rem;
}
th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(255,255,255,0.025); }
.dp-name { font-weight: 700; letter-spacing: 0.02em; }
.badge {
  display: inline-flex;
  min-width: 2rem;
  justify-content: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}
.badge-ok { background: rgba(61,220,151,0.15); color: var(--ok); }
.badge-warn { background: rgba(245,193,74,0.15); color: var(--warn); }
.badge-muted { background: rgba(147,160,184,0.15); color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.9rem;
}
.stat .label { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; }
.stat .value { font-size: 1.45rem; font-weight: 800; margin-top: 0.2rem; }

.form-grid {
  display: grid;
  gap: 0.9rem;
}
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}
input, select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--bg2);
  color: var(--text);
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  outline: none;
}
input:focus, select:focus {
  border-color: rgba(227, 6, 19, 0.75);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.18);
}

.quiz-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.progress {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.75rem 0 1.25rem;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  width: 0%;
  transition: width 0.2s ease;
}

.q-card {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.9rem;
  background: rgba(255,255,255,0.02);
}
.q-card h3 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  line-height: 1.45;
}
.q-card .cat {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 0.45rem;
}
.options { display: grid; gap: 0.45rem; }
.opt {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  background: transparent;
}
.opt:hover { border-color: rgba(227, 6, 19, 0.5); }
.opt input { width: auto; margin-top: 0.15rem; accent-color: var(--accent); }
.opt.selected {
  border-color: rgba(227, 6, 19, 0.8);
  background: rgba(227, 6, 19, 0.12);
}
.opt.wrong { border-color: rgba(255,107,122,0.7); background: rgba(255,107,122,0.08); }
.opt.right-mark { border-color: rgba(61,220,151,0.7); background: rgba(61,220,151,0.08); }

.result-box {
  text-align: center;
  padding: 1.5rem 1rem;
}
.result-box .score {
  font-size: 3rem;
  font-weight: 800;
  margin: 0.4rem 0;
}
.result-box.pass .score { color: var(--ok); }
.result-box.fail .score { color: var(--danger); }
.hidden { display: none !important; }
.footer-note {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand h1 { font-size: 1.15rem; }
  .jt-logo { height: 30px; max-width: 96px; }
}

textarea#essay-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--bg2);
  color: var(--text);
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 120px;
  line-height: 1.45;
}
textarea#essay-input:focus {
  border-color: rgba(227, 6, 19, 0.75);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.18);
}
.essay-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
  line-height: 1.4;
}
.essay-count {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}
.essay-card {
  border-color: rgba(227, 6, 19, 0.4);
}
