: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);
  --home-section-width: 820px;
}

* { 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: 1040px;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.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: visible;
  padding: 4px 0;
}

.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;
  position: relative;
  overflow: hidden;
}

.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),
    0 0 0 1px rgba(99, 200, 255, 0.2);
}

.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);
}

@keyframes correctPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1.015);
  }
}

@keyframes celebrationBurst {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.6) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--burst-x), var(--burst-y)) scale(1) rotate(var(--burst-rotate));
  }
}

.celebration-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.celebration-particle {
  position: absolute;
  opacity: 0;
  background: var(--particle-color);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.18);
  animation: celebrationBurst 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: var(--burst-delay);
}

.achievement-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 10;
  pointer-events: none;
  opacity: 0;

  padding: 14px 22px;
  border-radius: 999px;

  background: rgba(8, 23, 47, 0.96);
  border: 1px solid rgba(64, 214, 181, 0.35);

  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(64, 214, 181, 0.18);

  color: var(--brand-text);

  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-align: center;

  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.achievement-toast-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 720px) {
  .achievement-toast {
    max-width: calc(100% - 24px);
    text-align: center;
  }
}

.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;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    opacity 0.18s ease;
}
.answer-btn:hover:not(:disabled),
.primary-btn:hover:not(:disabled),
.ghost-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
}

.primary-btn:hover:not(:disabled) {
  box-shadow: 0 10px 24px rgba(39, 157, 255, 0.35);
  filter: brightness(1.05);
}

.answer-btn:active:not(:disabled),
.primary-btn:active:not(:disabled),
.ghost-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.answer-btn:active:not(:disabled),
.ghost-btn:active:not(:disabled) {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.primary-btn:active:not(:disabled) {
  box-shadow: 0 6px 14px rgba(39, 157, 255, 0.25);
}

.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,
.answer-btn.correct:disabled {
  background: var(--brand-correct);
  color: var(--brand-text);
  box-shadow:
    0 0 0 2px var(--brand-correct-ring),
    0 6px 16px rgba(64, 214, 181, 0.25);
  transform: scale(1.015);
  animation: correctPop 0.18s ease;
}

.answer-btn:disabled:not(.correct) {
  opacity: 0.5;
}

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

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
  box-shadow: none;
}

.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: visible;
  padding: 4px 0;
}

.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;
}

.shared-challenge-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(99, 200, 255, 0.26);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99, 200, 255, 0.14), rgba(64, 214, 181, 0.1));
  color: #d8ecff;
}

.shared-challenge-title {
  color: var(--brand-primary);
  font-size: 0.92rem;
}

.shared-challenge-banner span {
  color: var(--brand-muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.report-share-feedback {
  min-height: 1.2rem;
  margin: 14px 0 0;
  color: var(--brand-muted);
  font-size: 0.92rem;
  text-align: center;
}

.report-share-feedback.is-success {
  color: #0f766e;
}

.report-share-feedback.is-error {
  color: #b45309;
}

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

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

  .report-actions {
    flex-direction: column;
  }

  .report-actions button {
    width: 100%;
  }

  .shared-challenge-banner {
    margin-bottom: 14px;
  }
}


.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;
}

.home-shell {
  display: grid;
  gap: 32px;
  width: 100%;
}

.hero-card {
  width: 100%;
  padding: 48px 36px 40px;
  text-align: left;
}

.hero-copy {
  max-width: var(--home-section-width);
  margin: 0 auto;
  text-align: center;
}

/* can be removed */
.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(99, 200, 255, 0.12);
  border: 1px solid var(--brand-border);
  color: var(--brand-primary);
  font-size: 0.88rem;
  font-weight: 700;
}

.hero-title {
  margin: 0;
  font-size: clamp(1.45rem, 2.7vw, 1.9rem);
  line-height: 1.2;
}

.hero-subtitle {
  margin: 0 auto;
  max-width: 640px;
  color: var(--brand-muted);
  font-size: clamp(0.92rem, 1.35vw, 1rem);
  line-height: 1.7;
  font-weight: 500;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 28px 0 22px;
  justify-content: center;
}

.hero-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hero-subject-prompt {
  margin-top: 4px;
  color: var(--brand-text);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hero-subject-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.subject-btn {
  min-width: 164px;
}

.hero-supporting-copy {
  margin-top: 28px;
}

.topic-links-section {
  margin-top: 28px;
  padding: 8px 4px 20px;
}

.topic-link-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 20px;
  justify-content: stretch;
  align-items: start;
  width: 100%;
  max-width: var(--home-section-width);
  margin: 0 auto;
}

.topic-link-column {
  min-width: 0;
  padding: 20px 18px 18px;
  background: rgba(9, 24, 48, 0.52);
  border: 1px solid rgba(125, 168, 255, 0.16);
  border-radius: 22px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.topic-link-column h3 {
  margin: 0 0 16px;
  font-size: 1.08rem;
}

.topic-link-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.topic-link-list li + li {
  margin-top: 12px;
}

.topic-link-list a {
  display: inline-flex;
  align-items: center;
  line-height: 1.6;
  font-weight: 600;
}

.dot-separator {
  color: var(--brand-muted);
}

.home-section {
  padding: 18px 6px;
}

.section-heading {
  max-width: var(--home-section-width);
  margin: 0 auto 22px;
}

.section-heading h2 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
  line-height: 1.2;
}

.section-heading p {
  margin: 0;
  color: var(--brand-muted);
  font-size: 0.98rem;
  line-height: 1.75;
}

.feature-grid {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: var(--home-section-width);
  margin: 0 auto;
}

.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card,
.example-card,
.cta-card,
.audience-item {
  background: rgba(9, 24, 48, 0.58);
  border: 1px solid rgba(125, 168, 255, 0.16);
  border-radius: 24px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.feature-card {
  padding: 24px 20px;
}

.feature-card h3 {
  margin: 0 0 10px;
  font-size: 1.02rem;
}

.feature-card p {
  margin: 0;
  color: var(--brand-muted);
  font-size: 0.95rem;
  line-height: 1.75;
}

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

.example-card {
  width: 100%;
  max-width: var(--home-section-width);
  margin: 0 auto;
  padding: 20px;
}

.example-question,
.example-explanation {
  background: rgba(8, 23, 47, 0.46);
  border: 1px solid rgba(125, 168, 255, 0.14);
  border-radius: 18px;
  padding: 16px;
}

.example-question p,
.example-explanation p {
  margin: 0;
  line-height: 1.7;
}

.example-label {
  margin-bottom: 10px;
  color: var(--brand-primary);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.example-answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.example-answer {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15, 36, 71, 0.78);
  border: 1px solid rgba(125, 168, 255, 0.16);
}

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

.audience-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  max-width: var(--home-section-width);
  margin: 0 auto;
}

.audience-item {
  padding: 22px 20px;
  font-weight: 600;
  font-size: 0.96rem;
  line-height: 1.7;
}

.cta-card {
  width: 100%;
  padding: 28px 24px;
  text-align: center;
  margin: 12px auto 0;
  max-width: var(--home-section-width);
}

.cta-card h2 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  text-align: center;
}

.cta-card p {
  margin: 0 0 18px;
  color: var(--brand-muted);
  font-size: 0.96rem;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .three-up,
  .audience-list {
    grid-template-columns: 1fr;
  }

  .topic-link-directory {
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
  }
}

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

  .hero-card {
    padding: 28px 18px 24px;
  }

  .hero-title {
    font-size: clamp(1.35rem, 6vw, 1.7rem);
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-link-btn,
  .subject-btn {
    width: 100%;
  }

  .hero-supporting-copy {
    margin-top: 22px;
  }

  .home-section {
    padding: 14px 2px;
  }

  .section-heading {
    margin-bottom: 18px;
  }

  .example-answers {
    grid-template-columns: 1fr;
  }
}

.hero-subtitle,
.section-heading p,
.feature-card p {
  line-height: 1.75;
}
