:root {
  --bg: #050505;
  --panel: #151515;
  --ink: #f7f4e8;
  --muted: #b8b4a8;
  --line: #3a3934;
  --accent: #f3c400;
  --accent-strong: #050505;
  --red: #d9271c;
  --blue: #1464d2;
  --yellow: #f3c400;
  --good: #71d28a;
  --bad: #ff7a70;
  --warn: #f0c36a;
  --soft: #24231f;
  font-family: Inter, Arial, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  background:
    linear-gradient(90deg, transparent 0 72%, rgba(20, 100, 210, 0.18) 72% 74%, transparent 74%),
    linear-gradient(180deg, transparent 0 62%, rgba(217, 39, 28, 0.14) 62% 64%, transparent 64%),
    var(--bg);
  color: var(--ink);
  touch-action: pan-y;
  overscroll-behavior: none;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #0b0b0b;
  color: var(--ink);
  border-radius: 0;
  min-height: 42px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 900;
}

button:hover {
  border-color: var(--yellow);
}

button.primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #050505;
}

button.primary:hover {
  background: #ffe05d;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 28px clamp(18px, 4vw, 54px) 20px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, var(--red) 0 86px, transparent 86px),
    linear-gradient(90deg, transparent 0 calc(100% - 160px), var(--blue) calc(100% - 160px) calc(100% - 96px), transparent calc(100% - 96px)),
    #050505;
}

.eyebrow {
  margin: 0 0 5px;
  color: #d7d7dc;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2.5vw, 2rem);
}

h3 {
  font-size: 1.03rem;
  line-height: 1.45;
}

.badge,
.source-badge,
.keyword-row span {
  border-radius: 0;
  background: var(--soft);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.source-badge {
  border: 1px solid var(--line);
  background: #0b0b0b;
  color: #ddd8c9;
}

.layout {
  display: grid;
  grid-template-columns: minmax(250px, 320px) 1fr;
  gap: 18px;
  max-width: 100%;
  padding: 18px clamp(14px, 3vw, 34px) 28px;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.42);
}

.sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  padding: 14px;
}

.mode-group {
  display: grid;
  gap: 8px;
}

.mode {
  text-align: left;
  font-weight: 700;
}

.mode.is-active {
  color: #050505;
  background: var(--yellow);
  border-color: var(--yellow);
}

.controls {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #0b0b0b;
  color: var(--ink);
}

select,
input {
  min-height: 42px;
  padding: 0 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.toggle-row label {
  display: block;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px;
}

.stats div:nth-child(1) {
  border-top: 5px solid var(--red);
}

.stats div:nth-child(2) {
  border-top: 5px solid var(--yellow);
}

.stats div:nth-child(3) {
  border-top: 5px solid var(--blue);
}

.stats strong,
.stats span {
  display: block;
}

.stats span {
  color: var(--muted);
  font-size: 0.78rem;
}

.workspace {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.questions {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: min(62vh, 720px);
}

.question {
  display: flex;
  min-width: 0;
  min-height: min(62vh, 720px);
  flex-direction: column;
  justify-content: center;
  padding: clamp(22px, 4vw, 54px);
  transition: border-color 160ms ease, box-shadow 160ms ease;
  border-left: 12px solid var(--yellow);
}

.question h3 {
  max-width: 1000px;
  margin-bottom: 28px;
  font-size: clamp(1.35rem, 2.4vw, 2.7rem);
  line-height: 1.18;
}

.question:focus-within {
  border-color: rgba(244, 244, 245, 0.7);
  box-shadow: 0 0 0 3px rgba(244, 244, 245, 0.09);
}

.q-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result {
  font-size: 0.85rem;
  font-weight: 900;
}

.question.correct .result,
.question.good-enough .result {
  color: var(--good);
}

.question.incorrect .result {
  color: var(--bad);
}

.question.partial .result {
  color: var(--warn);
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  display: grid;
  grid-template-columns: 1fr;
  min-width: 0;
  gap: 9px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 16px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.option:hover {
  transform: translateY(-1px);
  border-color: var(--yellow);
  background: #202018;
}

.option input {
  position: absolute;
  width: 1px;
  min-height: 0;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.option.is-right {
  border-color: rgba(113, 210, 138, 0.55);
  background: #102018;
}

.option.is-wrong {
  border-color: rgba(255, 122, 112, 0.55);
  background: #261311;
}

.feedback,
.answer-box {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.feedback strong,
.answer-box strong {
  color: var(--ink);
}

.feedback ul,
.answer-box ul {
  margin: 8px 0 12px;
  padding-left: 20px;
}

.feedback li,
.answer-box li {
  margin: 5px 0;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.case-prompt {
  white-space: pre-line;
  color: #d7d7dc;
  line-height: 1.55;
}

.actions {
  position: sticky;
  bottom: 0;
  justify-content: space-between;
  box-shadow: 0 -10px 22px rgba(0, 0, 0, 0.35);
  border-top: 8px solid var(--blue);
}

.actions button {
  min-width: min(220px, 100%);
}

.actions button:first-child {
  border-left: 8px solid var(--red);
}

.actions button:last-child {
  border-right: 8px solid var(--yellow);
}

@media (max-width: 850px) {
  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    position: static;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

}
