:root {
  color-scheme: dark;
  --ink: #f4f7fb;
  --muted: #aab4c0;
  --line: #2f3a46;
  --panel: #111820;
  --panel-soft: #151f29;
  --wash: #0d131a;
  --accent: #49d4b8;
  --accent-dark: #25a892;
  --amber: #f0b35b;
  --wrong: #ff7b7b;
  --right: #7ce2a0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(73, 212, 184, 0.16), transparent 32rem),
    linear-gradient(135deg, #070b10 0%, #101722 55%, #090d13 100%);
  color: var(--ink);
}

button,
select,
input,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.quiz-panel {
  max-width: 1040px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #16212b 0%, #111820 100%);
}

.eyebrow,
.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.85rem;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.chapter-picker {
  display: grid;
  gap: 6px;
  min-width: min(320px, 100%);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1118;
  color: var(--ink);
}

select {
  min-height: 40px;
  padding: 0 12px;
}

input {
  min-height: 40px;
  padding: 0 12px;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab.is-active {
  border-color: rgba(73, 212, 184, 0.42);
  background: rgba(73, 212, 184, 0.12);
  color: var(--accent);
  font-weight: 750;
}

.view {
  display: none;
  padding: 24px;
}

.view.is-active {
  display: block;
}

.chapter-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--wash);
}

.chapter-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.questions {
  display: grid;
  gap: 16px;
  margin: 20px 0;
}

.question-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel-soft);
}

.question-card legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 12px;
  font-weight: 760;
  line-height: 1.35;
}

.question-card legend + * {
  clear: both;
}

.question-hint {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.question-hint summary {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(73, 212, 184, 0.38);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 760;
  list-style: none;
}

.question-hint summary::-webkit-details-marker {
  display: none;
}

.question-hint summary::before {
  content: "?";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 850;
}

.question-hint[open] summary {
  background: rgba(73, 212, 184, 0.1);
}

.question-hint p {
  margin: 10px 0 0;
}

.question-hint strong {
  color: var(--accent);
}

.answers {
  display: grid;
  gap: 8px;
}

.chart-visual {
  margin: 0 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  background: #171c27;
}

.chart-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
  color: #f7f7f5;
  font-size: 0.92rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.chart-heading strong {
  color: var(--ink);
}

.chart-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-bg {
  fill: #171c27;
}

.grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.fvg-zone {
  fill: rgba(18, 130, 105, 0.72);
  stroke: rgba(35, 174, 143, 0.9);
  stroke-width: 1;
}

.is-invalid-zone .fvg-zone {
  fill: rgba(167, 42, 58, 0.78);
  stroke: rgba(209, 68, 86, 0.9);
  stroke-dasharray: none;
}

.chart-title,
.comparison-title {
  fill: #f8f8f4;
  font-size: 40px;
  font-weight: 900;
  text-anchor: middle;
  text-transform: uppercase;
  paint-order: stroke;
  stroke: rgba(23, 28, 39, 0.7);
  stroke-width: 4px;
}

.comparison-title {
  font-size: 24px;
}

.zone-label {
  fill: #f8f8f4;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  paint-order: stroke;
  stroke: rgba(23, 28, 39, 0.86);
  stroke-width: 4px;
}

.ce-line {
  stroke: rgba(255, 255, 255, 0.26);
  stroke-width: 1;
  stroke-dasharray: 6 6;
}

.level-line {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1;
  stroke-dasharray: 7 6;
}

.level-line.liquidity {
  stroke: rgba(255, 255, 255, 0.36);
}

.level-line.structure,
.level-line.equilibrium {
  stroke: rgba(255, 255, 255, 0.3);
}

.level-line.target,
.level-line.stop {
  stroke: rgba(255, 255, 255, 0.42);
}

.chart-level text,
.chart-callout text {
  fill: #f8f8f4;
  font-size: 12px;
  font-weight: 780;
  paint-order: stroke;
  stroke: rgba(23, 28, 39, 0.9);
  stroke-width: 4px;
}

.chart-callout circle {
  fill: #f8f8f4;
  stroke: #171c27;
  stroke-width: 2;
}

.chart-callout line {
  stroke: rgba(248, 248, 244, 0.6);
  stroke-width: 1.5;
}

.candle line {
  stroke-width: 2.2;
  stroke-linecap: round;
}

.candle rect {
  stroke-width: 1;
}

.candle.is-up line,
.candle.is-up rect {
  fill: #f8f8f4;
  stroke: #f8f8f4;
}

.candle.is-down line,
.candle.is-down rect {
  fill: #8c8d8e;
  stroke: #b9bab9;
}

.candle text {
  fill: rgba(248, 248, 244, 0.78);
  font-size: 11px;
  font-weight: 760;
  text-anchor: middle;
}

.chart-visual figcaption {
  margin: 0;
  padding: 0 16px 14px;
  color: rgba(248, 248, 244, 0.72);
  font-size: 0.86rem;
  line-height: 1.4;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}

.comparison-market {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.comparison-market strong {
  display: none;
}

.comparison-market svg {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
}

.answer {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.answer:has(input:checked) {
  border-color: rgba(73, 212, 184, 0.55);
  background: rgba(73, 212, 184, 0.1);
}

.question-card.is-correct {
  border-color: rgba(124, 226, 160, 0.62);
}

.question-card.is-wrong {
  border-color: rgba(255, 123, 123, 0.62);
}

.feedback {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

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

.actions,
.generator-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

button {
  border-radius: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: #06100e;
  font-weight: 800;
}

.primary:hover {
  background: var(--accent-dark);
  color: #fff;
}

.secondary {
  background: #0b1118;
  border-color: var(--line);
  color: var(--ink);
}

.score-card {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid rgba(124, 226, 160, 0.38);
  background: rgba(124, 226, 160, 0.1);
  color: var(--right);
  font-weight: 760;
}

.generator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.input-panel,
.output-panel {
  display: grid;
  gap: 10px;
  align-content: start;
}

.input-panel label,
.generator-controls label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

.generated-empty,
.generated-error,
.generated-question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}

.generated-empty {
  color: var(--muted);
}

.generated-error {
  border-color: rgba(255, 123, 123, 0.45);
  background: rgba(255, 123, 123, 0.1);
  color: var(--wrong);
}

.generated-list {
  display: grid;
  gap: 12px;
}

.generated-question p {
  margin-bottom: 8px;
  font-weight: 760;
}

.generated-question ul {
  margin: 0;
  padding-left: 22px;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

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

  .topbar {
    display: grid;
  }

  .view {
    padding: 16px;
  }

  .mode-tabs {
    padding: 10px 16px;
  }

  .generator-layout {
    display: grid;
  }

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

  .chart-title {
    font-size: 27px;
  }

  .comparison-title {
    font-size: 21px;
  }

  .chart-level text,
  .chart-callout text,
  .zone-label {
    font-size: 10px;
  }
}
