:root {
  font-family: 'Sora', Arial, Helvetica, sans-serif;
  color: #e5eefc;
  background: #071226;

  --brand-bg: #071226;
  --brand-bg-accent: #0a1a35;
  --brand-panel: rgba(10, 26, 53, 0.92);
  --brand-panel-strong: #08172f;
  --brand-text: #e5eefc;
  --brand-muted: #93a8ca;
  --brand-border: rgba(125, 168, 255, 0.22);
  --brand-primary: #63c8ff;
  --brand-primary-strong: #279dff;
  --brand-primary-soft: #12284d;
  --brand-answer: #0f2447;
  --brand-answer-disabled: #1a2d4f;
  --brand-correct: #133d3d;
  --brand-correct-ring: #40d6b5;
  --brand-shadow: rgba(0, 0, 0, 0.28);
  --brand-danger: #f08ba2;
  --brand-danger-border: rgba(240, 139, 162, 0.3);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100vh;
  color: var(--brand-text);
  background:
    radial-gradient(circle at top, rgba(39, 157, 255, 0.16), transparent 32%),
    linear-gradient(180deg, #08152b 0%, #071226 100%);
}

body { display: block; }

[hidden] { display: none !important; }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 14px 28px;
}

.view { min-height: calc(100vh - 48px); }

.view-home,
.view-report {
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-card,
.setup-card,
.panel,
.report-card {
  background: var(--brand-panel);
  border: 1px solid var(--brand-border);
  border-radius: 24px;
  box-shadow: 0 20px 50px var(--brand-shadow);
}

.home-card {
  width: min(100%, 760px);
  padding: 32px 24px 28px;
  text-align: center;
}

.home-logo {
  width: min(560px, 100%);
  height: auto;
  display: block;
  margin: 0 auto 24px;
}

.hero-btn { min-width: 220px; }

.setup-header,
.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.setup-logo,
.question-logo,
.report-logo {
  width: min(300px, 70vw);
  height: auto;
  display: block;
}

.setup-card { padding: 24px; }

.setup-title {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
}

.setup-subtitle {
  margin: 0 0 20px;
  color: var(--brand-muted);
}

.setup-steps {
  display: grid;
  gap: 16px;
}

.compact-setup-steps {
  gap: 12px;
}

.step-card {
  background: rgba(8, 23, 47, 0.72);
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  padding: 16px;
}

.compact-step-card {
  padding: 12px 14px 14px;
}

.step-meta {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.step-meta h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.step-meta p {
  margin: 0;
  color: var(--brand-muted);
  font-size: 0.95rem;
}

.compact-step-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.step-number {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  font-weight: 800;
  flex: 0 0 auto;
}

.question-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.question-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lab-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  background: rgba(8, 23, 47, 0.82);
  color: var(--brand-primary);
  font-size: 0.9rem;
  font-weight: 700;
}

.report-card {
  width: min(100%, 820px);
  padding: 28px 24px;
  text-align: center;
}

.report-title {
  margin: 22px 0 8px;
  font-size: clamp(1.9rem, 3vw, 2.5rem);
}

.report-subtitle {
  margin: 0 auto 18px;
  max-width: 560px;
  color: var(--brand-muted);
  line-height: 1.6;
}

.report-pill { margin: 0 auto 22px; }

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.report-stat {
  background: rgba(8, 23, 47, 0.72);
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  padding: 18px 16px;
  text-align: left;
}

.report-label {
  display: block;
  margin-bottom: 8px;
  color: var(--brand-muted);
  font-size: 0.92rem;
}

.report-stat strong {
  display: block;
  color: var(--brand-primary);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.report-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

select,
button {
  font: inherit;
}

.read-only-editor {
  width: 100%;
  min-height: 5.5rem;
  padding: 16px 18px;
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  background: var(--brand-panel-strong);
  color: var(--brand-text);
  line-height: 1.65;
  overflow-y: visible;
  white-space: normal;
}

.read-only-editor .katex-display {
  margin: 0.85em 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.read-only-editor br + br {
  content: '';
}

select,
button {
  font: inherit;
}

select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  background: var(--brand-panel-strong);
  color: var(--brand-text);
}

select:focus,
.read-only-editor:focus,
button:focus-visible {
  outline: 2px solid rgba(99, 200, 255, 0.65);
  outline-offset: 2px;
}

.read-only-editor:focus {
  outline: none;
}

.panel {
  margin-top: 8px;
  padding: 16px;
}

.primary-btn,
.answer-btn,
.ghost-btn {
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease, background 0.14s ease;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand-primary-strong), var(--brand-primary));
  color: #061120;
  box-shadow: 0 8px 20px rgba(39, 157, 255, 0.28);
}

.ghost-btn {
  background: rgba(8, 23, 47, 0.82);
  color: var(--brand-text);
  border-color: var(--brand-border);
}

.danger-btn {
  color: var(--brand-danger);
  border-color: var(--brand-danger-border);
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.answer-btn {
  background: var(--brand-answer);
  color: var(--brand-text);
  border-color: var(--brand-border);
  font-weight: 600;
}

.answer-btn:hover:not(:disabled),
.primary-btn:hover:not(:disabled),
.ghost-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.answer-btn:hover:not(:disabled) {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.answer-btn:disabled {
  background: var(--brand-answer-disabled);
  color: var(--brand-muted);
  cursor: not-allowed;
}

.answer-btn.correct {
  background: var(--brand-correct);
  box-shadow: 0 0 0 2px var(--brand-correct-ring);
}

#score-display { font-weight: 800; }

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shortcut-hint {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--brand-muted);
  text-align: right;
}

@media (hover: none) and (pointer: coarse) {
  .shortcut-hint {
    display: none;
  }
}

.answer-btn.keyboard-press {
  transform: scale(0.97);
  box-shadow: inset 0 0 0 2px var(--brand-primary);
}

.session-stats {
  display: flex;
  gap: 16px;
  align-items: center;
  font-weight: 800;
  color: var(--brand-primary);
  flex-wrap: wrap;
  justify-content: flex-end;
}

label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.answer-btn.dont-know {
  background: #16253f;
  font-style: italic;
}

@media (max-width: 720px) {
  .container { padding-inline: 10px; }

  .view { min-height: calc(100vh - 40px); }

  .home-card,
  .report-card { padding: 24px 16px 22px; }

  .setup-header,
  .question-header {
    flex-direction: column;
    align-items: stretch;
  }

  .question-actions { justify-content: space-between; }

  .answers { grid-template-columns: repeat(2, 1fr); }

  .session-stats {
    justify-content: space-between;
    width: 100%;
  }

  .shortcut-hint { text-align: left; }

  .lab-pill { white-space: normal; }

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

@media (max-width: 520px) {
  .answers { grid-template-columns: 1fr; }

  .hero-btn,
  .ghost-btn,
  .primary-btn { width: 100%; }

  .question-actions,
  .report-actions { align-items: stretch; }
}


.answer-btn {
  min-height: 68px;
  text-align: left;
  line-height: 1.45;
}

.answer-btn .katex-display {
  margin: 0.35em 0 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.answer-btn.dont-know {
  text-align: center;
}


.repeat-lab-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 14px 16px;
  background: rgba(8, 23, 47, 0.82);
  border: 1px solid var(--brand-border);
  border-radius: 18px;
}

.repeat-lab-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.repeat-lab-label {
  color: var(--brand-muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.repeat-lab-summary {
  color: var(--brand-primary);
  font-size: 0.98rem;
  line-height: 1.4;
}

.repeat-lab-btn {
  min-width: 140px;
}

@media (max-width: 640px) {
  .repeat-lab-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .repeat-lab-btn {
    width: 100%;
  }
}


.level-caption {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(20, 184, 166, 0.08);
  color: #0f766e;
  font-size: 0.92rem;
  line-height: 1.4;
}

.inline-link {
  color: var(--brand-primary);
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-block;
  margin-top: 8px;
}

.inline-link:hover {
  text-decoration: underline;
}
