:root {
  color-scheme: light;
  --bg: #eef5fb;
  --bg-deep: #dce9f6;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --panel-tint: #f7fbff;
  --border: rgba(26, 46, 84, 0.12);
  --border-strong: rgba(26, 46, 84, 0.18);
  --text: #12233f;
  --muted: #5f728f;
  --accent: #1463ff;
  --accent-strong: #0d55df;
  --accent-soft: #e8f1ff;
  --accent-soft-strong: #d7e8ff;
  --success: #15803d;
  --success-soft: #eaf8ef;
  --warning-bg: #fff3df;
  --warning-text: #975406;
  --danger: #c2410c;
  --danger-soft: #fff2e8;
  --shadow-lg: 0 22px 80px rgba(17, 35, 63, 0.12);
  --shadow-md: 0 14px 36px rgba(17, 35, 63, 0.08);
  --shadow-sm: 0 10px 24px rgba(17, 35, 63, 0.06);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --container: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(20, 99, 255, 0.06), transparent 34%),
    linear-gradient(180deg, #f7fbff 0%, #eef5fb 52%, #e9f0f7 100%);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
}

h1,
h2,
h3,
h4,
h5,
p,
ul,
ol {
  margin: 0;
}

a,
button,
summary,
input {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder {
  color: #8a9bb3;
}

input:focus {
  outline: none;
  border-color: rgba(20, 99, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(20, 99, 255, 0.12);
  background: #ffffff;
}

.site-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.backdrop-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.32;
}

.orb-one {
  width: 30rem;
  height: 30rem;
  top: -8rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(20, 99, 255, 0.12) 0%, rgba(20, 99, 255, 0) 72%);
}

.orb-two {
  width: 28rem;
  height: 28rem;
  right: -9rem;
  top: 4rem;
  background: radial-gradient(circle, rgba(255, 132, 76, 0.1) 0%, rgba(255, 132, 76, 0) 70%);
}

.backdrop-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(18, 35, 63, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 35, 63, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.24), transparent 72%);
}

.review-warning {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.95rem 1.25rem;
  background: rgba(255, 243, 223, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(151, 84, 6, 0.18);
  color: var(--warning-text);
}

.review-warning p {
  width: min(100% - 2rem, var(--container));
  margin: 0 auto;
  line-height: 1.55;
  font-size: 0.94rem;
}

.page-shell,
.app-shell {
  width: min(100% - 2rem, var(--container));
  margin: 0 auto;
}

.page-shell {
  padding: 3.5rem 0 2rem;
}

.gate-shell,
.admin-shell {
  min-height: calc(100vh - 5rem);
}

.hero-panel,
.portal-grid,
.workspace {
  display: grid;
  gap: 1.5rem;
}

.hero-panel,
.portal-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: stretch;
}

.hero-copy,
.entry-card,
.glass-card {
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-xl);
}

.hero-copy {
  padding: 2.5rem;
  display: grid;
  align-content: start;
  gap: 1.4rem;
}

.hero-copy h1,
.portal-copy-card h2,
.portal-form-card h2,
.context-header h2 {
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  letter-spacing: -0.04em;
}

.hero-copy h1 {
  font-size: clamp(2.6rem, 4vw, 4.5rem);
  line-height: 0.98;
  max-width: 11ch;
}

.hero-text,
.panel-copy,
.gate-copy,
.context-copy,
.invite-empty,
.invite-meta,
.topbar-note {
  color: var(--muted);
  line-height: 1.7;
}

.hero-highlights,
.stat-grid,
.admin-feature-list,
.question-list,
.nav-list,
.invite-list,
.stack-form,
.content,
.questions-panel,
.admin-tools,
.invite-list-wrap {
  display: grid;
  gap: 1rem;
}

.highlight-card,
.stat-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-sm);
}

.highlight-card h2,
.highlight-card p {
  font-size: 1rem;
  line-height: 1.6;
}

.highlight-kicker,
.panel-kicker,
.eyebrow,
.field-label,
.nav-kicker,
.stat-label {
  display: inline-block;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.highlight-kicker,
.panel-kicker,
.eyebrow {
  color: var(--accent);
}

.entry-card,
.portal-form-card {
  padding: 2rem;
  display: grid;
  align-content: start;
  gap: 1rem;
}

.entry-card h2,
.portal-form-card h2,
.portal-copy-card h2 {
  font-size: clamp(1.85rem, 3vw, 2.7rem);
  line-height: 1.05;
}

.field-label,
.stat-label,
.nav-kicker {
  color: #667995;
}

.stack-form {
  gap: 0.8rem;
}

.primary-btn,
.ghost-btn,
.solution-btn {
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.primary-btn {
  border-radius: 999px;
  padding: 0.95rem 1.2rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(180deg, #1f6dff 0%, #1463ff 100%);
  box-shadow: 0 16px 28px rgba(15, 101, 255, 0.24);
}

.primary-btn:hover,
.solution-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(15, 101, 255, 0.28);
}

.ghost-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.ghost-btn:hover {
  border-color: rgba(20, 99, 255, 0.28);
  color: var(--accent);
  background: rgba(232, 241, 255, 0.88);
}

.compact-btn {
  padding: 0.72rem 0.95rem;
}

.micro-note {
  font-size: 0.88rem;
  color: var(--muted);
}

.micro-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.status-text {
  min-height: 1.35rem;
  color: var(--accent);
  font-weight: 600;
  line-height: 1.5;
}

.portal-topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.portal-copy-card,
.sidebar,
.context-header {
  padding: 1.6rem;
}

.admin-feature-list {
  gap: 0.85rem;
}

.admin-feature {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 0;
  border-top: 1px solid rgba(18, 35, 63, 0.08);
}

.admin-feature:first-of-type {
  border-top: none;
  padding-top: 0;
}

.feature-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #1463ff;
  flex-shrink: 0;
  margin-top: 0.45rem;
}

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

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 2rem;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
}

.admin-toolbar,
.invite-result-head,
.invite-list-header,
.topbar,
.brand,
.topbar-actions,
.topbar-meta,
.part-preview-head,
.part-heading,
.question-header,
.admin-state-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-toolbar,
.invite-list-header {
  justify-content: space-between;
}

.admin-state {
  font-size: 0.95rem;
  font-weight: 700;
}

.invite-result {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(20, 99, 255, 0.16);
  background: rgba(236, 244, 255, 0.96);
  padding: 1rem 1.1rem;
}

.invite-result code {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-strong);
  word-break: break-word;
}

.invite-list {
  gap: 0.85rem;
}

.invite-row {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow-sm);
}

.invite-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.invite-code {
  font-weight: 800;
  letter-spacing: 0.08em;
}

.invite-status {
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.invite-status.is-unused {
  color: #0f766e;
  background: #e8fbf6;
}

.invite-status.is-used {
  color: #9a3412;
  background: #fff1e7;
}

.invite-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-size: 0.9rem;
}

.invite-empty {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
}

.app-shell {
  padding: 2rem 0 3rem;
}

.topbar {
  justify-content: space-between;
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-md);
}

.brand {
  gap: 0.95rem;
}

.brand-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, #2a78ff 0%, #1463ff 100%);
  box-shadow: 0 16px 28px rgba(20, 99, 255, 0.28);
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
}

.brand-mark::before {
  width: 1.3rem;
  height: 0.2rem;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}

.brand-mark::after {
  width: 0.2rem;
  height: 1.3rem;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}

.brand h1 {
  font-size: 1.35rem;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  letter-spacing: -0.03em;
}

.topbar-meta {
  justify-content: space-between;
  margin-left: auto;
}

.topbar-actions {
  justify-content: flex-end;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.access-badge.is-admin {
  background: #eef6ea;
  color: #2f6f1a;
}

.access-badge.is-unlocked {
  background: #eaf8ef;
  color: var(--success);
}

.workspace {
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 5.6rem;
  gap: 1.8rem;
}

.nav-section h3 {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-button {
  width: 100%;
  text-align: left;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 0.85rem 0.95rem;
  background: transparent;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.nav-button:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 99, 255, 0.14);
  background: rgba(255, 255, 255, 0.72);
}

.nav-button.is-active {
  border-color: rgba(20, 99, 255, 0.2);
  background: rgba(236, 244, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.nav-button > span {
  display: block;
}

.nav-button.is-active .nav-kicker {
  color: var(--accent);
}

.context-header {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
}

.context-header h2 {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.02;
}

.question-card {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.question-header {
  align-items: flex-start;
  padding: 1.5rem;
}

.question-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #102b62, #1463ff);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  flex-shrink: 0;
}

.question-copy {
  flex: 1;
  display: grid;
  gap: 1rem;
}

.question-copy h4,
.part-heading h5 {
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 500;
}

.question-parts {
  display: grid;
  gap: 0.9rem;
}

.part-preview,
.steps-box {
  border-radius: var(--radius-lg);
}

.part-preview {
  border: 1px solid rgba(20, 99, 255, 0.12);
  background: rgba(248, 251, 255, 0.92);
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.part-preview-head,
.part-heading {
  align-items: flex-start;
}

.part-preview-copy {
  line-height: 1.65;
}

.part-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(20, 99, 255, 0.14);
  font-weight: 800;
  flex-shrink: 0;
}

.mcq-options {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.8rem;
}

.mcq-option {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.mcq-option:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 99, 255, 0.24);
  background: rgba(232, 241, 255, 0.7);
}

.mcq-option.correct {
  border-color: rgba(21, 128, 61, 0.24);
  background: #e9f9ef;
  color: #166534;
}

.mcq-option.incorrect {
  border-color: rgba(194, 65, 12, 0.24);
  background: #fff1e8;
  color: #9a3412;
}

.mcq-letter {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  border: 1px solid rgba(95, 114, 143, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--muted);
  flex-shrink: 0;
}

.mcq-option.correct .mcq-letter {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.mcq-option.incorrect .mcq-letter {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.answer-check-form {
  display: grid;
  gap: 0.65rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(20, 99, 255, 0.12);
  background: rgba(255, 255, 255, 0.82);
}

.answer-check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
}

.answer-input {
  min-width: 0;
}

.answer-feedback {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}

.answer-feedback.is-match {
  color: var(--success);
  font-weight: 600;
}

.answer-feedback.is-close {
  color: #b45309;
  font-weight: 600;
}

.answer-feedback.is-miss {
  color: var(--danger);
  font-weight: 600;
}

.solution-details {
  border-top: 1px solid rgba(18, 35, 63, 0.08);
  background: rgba(252, 254, 255, 0.94);
  padding: 1.35rem 1.5rem 1.5rem;
}

.solution-btn {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  background: linear-gradient(180deg, #1f6dff 0%, #1463ff 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 16px 28px rgba(15, 101, 255, 0.22);
}

.solution-btn::-webkit-details-marker {
  display: none;
}

.question-body {
  display: grid;
  gap: 1.2rem;
  padding-top: 1.35rem;
}

.part-solution {
  display: grid;
  gap: 1rem;
  padding-top: 1.35rem;
  border-top: 1px solid rgba(18, 35, 63, 0.08);
}

.part-solution:first-child {
  padding-top: 0;
  border-top: none;
}

.steps-box {
  background: rgba(243, 248, 253, 0.96);
  padding: 1.2rem;
  border: 1px solid rgba(20, 99, 255, 0.08);
}

.steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.95rem;
}

.steps-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  line-height: 1.7;
}

.step-num {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(20, 99, 255, 0.12);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
}

.answer-box {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(20, 99, 255, 0.14);
  background: rgba(236, 244, 255, 0.98);
  padding: 1rem 1.1rem;
}

.answer-box > span {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.answer-box > strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1.45;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.15rem;
}

@media (max-width: 1080px) {
  .hero-panel,
  .portal-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 820px) {
  .page-shell,
  .app-shell {
    width: min(100% - 1rem, var(--container));
  }

  .hero-copy,
  .entry-card,
  .portal-copy-card,
  .portal-form-card,
  .sidebar,
  .context-header {
    padding: 1.3rem;
  }

  .hero-copy h1 {
    max-width: 13ch;
    font-size: clamp(2.1rem, 9vw, 3.4rem);
  }

  .portal-topbar,
  .invite-row-head,
  .admin-toolbar,
  .invite-list-header,
  .topbar,
  .topbar-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .question-header,
  .part-preview-head,
  .part-heading {
    flex-direction: column;
    gap: 0.8rem;
  }

  .answer-check-row {
    grid-template-columns: 1fr;
  }

  .solution-btn,
  .primary-btn,
  .ghost-btn {
    width: 100%;
    justify-content: center;
  }

  .invite-result-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .review-warning {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .page-shell {
    padding-top: 2rem;
  }

  .question-header,
  .solution-details {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .question-card,
  .glass-card,
  .hero-copy,
  .entry-card {
    border-radius: 22px;
  }
}
