:root {
  --ink: #1b1b1f;
  --muted: #556;
  --panel: rgba(255, 255, 255, 0.9);
  --border: #e2e8f0;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --accent: #10b981;
  --warm: #f59e0b;
  --rose: #ec4899;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
  background: linear-gradient(120deg, #eef7ff 0%, #f7f0ff 45%, #fff8ea 100%);
  color: var(--ink);
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 32px 10vw;
  background: linear-gradient(120deg, rgba(14, 165, 233, 0.18), rgba(16, 185, 129, 0.2), rgba(251, 191, 36, 0.15));
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 900;
}

.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #456;
  margin-bottom: 8px;
}

.subtitle {
  color: #445;
  margin-top: 8px;
}

.hero-card {
  display: flex;
  gap: 16px;
}

.hero-profile-card {
  min-width: 320px;
  max-width: 420px;
  flex-direction: column;
  align-items: stretch;
}

.hero-profile-copy {
  padding: 10px 2px 0;
}

.hero-profile-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #64748b;
}

.hero-profile-copy strong {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
  color: #0f172a;
}

.hero-profile-copy p {
  margin-top: 8px;
  color: #475569;
  line-height: 1.5;
}

.stat {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat span {
  font-size: 0.75rem;
  color: #667;
  display: block;
}

.stat strong {
  font-size: 1.3rem;
  color: #0f172a;
}

.panel {
  background: var(--panel);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.panel h2 {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.muted {
  color: #667;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.profile-box {
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: #fff;
}

.profile-title {
  font-weight: 900;
  color: #0f172a;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.profile-error {
  color: #b91c1c;
  font-weight: 700;
}

.profile-dock {
  display: block;
}

.profile-dock-inline {
  width: 100%;
}

.profile-dock-inline .profile-dock-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(191, 219, 254, 0.95);
  border-radius: 22px;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
  padding: 14px;
  backdrop-filter: blur(10px);
}

.profile-dock-floating {
  position: fixed;
  left: 14px;
  top: 14px;
  z-index: 1400;
}

.profile-dock-floating .profile-dock-card {
  min-width: 220px;
  max-width: 260px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #dbeafe;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  padding: 10px;
  backdrop-filter: blur(6px);
}

.profile-dock-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-dock-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
}

.profile-dock-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 1px solid #bfdbfe;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-dock-name {
  margin-top: 2px;
  font-size: 1rem;
  font-weight: 900;
  color: #0f172a;
}

.profile-dock-email {
  margin-top: 4px;
  font-size: 0.78rem;
  color: #475569;
  word-break: break-all;
}

.profile-dock-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-row {
  align-items: center;
}

.user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.user-avatar-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 2px solid #e2e8f0;
  background: #fff;
  padding: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.user-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar-fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #0f172a;
  background: linear-gradient(140deg, #e2e8f0, #cbd5f5);
  letter-spacing: 0.02em;
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.18);
  z-index: 25;
}

.user-menu-name {
  font-weight: 900;
  color: #0f172a;
}

.user-menu-email {
  margin-top: 2px;
  font-size: 0.78rem;
  color: #64748b;
  word-break: break-all;
}

.user-menu-panel .btn {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
}

.legacy-auth-row {
  display: none !important;
}

.btn,
.download-btn,
.start-btn,
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover,
.download-btn:hover,
.start-btn:hover,
.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.15);
}

.btn.primary,
.start-btn {
  background: linear-gradient(90deg, var(--accent), var(--primary));
  color: white;
}

.btn.accent {
  background: linear-gradient(90deg, var(--warm), var(--rose));
  color: white;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: #334;
}

.download-btn,
.submit-btn {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  color: white;
}

.filters {
  display: flex;
  gap: 15px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.hierarchy-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.hierarchy-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.hierarchy-card h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: #334;
}

.tree-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.tree-item {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  color: #1f2937;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.tree-item strong {
  font-size: 0.8rem;
  color: #0ea5e9;
}

.tree-item.active {
  border-color: #0ea5e9;
  background: #e0f2fe;
}

select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: white;
  min-width: 200px;
}

input[type="text"],
input[type="number"] {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: white;
  min-width: 200px;
}

textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.98rem;
  background: white;
  resize: vertical;
}

.list {
  display: grid;
  gap: 10px;
}

.feedback-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.feedback-item .meta {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 4px;
}

.papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.table-wrap {
  overflow-x: auto;
}

.papers-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.papers-table th,
.papers-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.95rem;
}

.papers-table th {
  background: #f8fafc;
  font-weight: 900;
}

.papers-table tbody tr:hover {
  background: #f8fafc;
}

.btn.sm {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.card,
.project-card {
  background: white;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease;
}

.card:hover,
.project-card:hover {
  transform: translateY(-4px);
}

.card h3,
.project-card h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: #0f172a;
}

footer {
  text-align: center;
  padding: 40px 0;
  color: #667;
  font-size: 0.9rem;
}

.quiz-container {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  max-width: 760px;
  margin: 30px auto;
}

.quiz-container.pattern-quiz {
  max-width: 980px;
}

.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.quiz-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.progress-pill {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e1b4b;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.9rem;
}

.quiz-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.quiz-tab {
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 900;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.quiz-tab.active {
  background: #0ea5e9;
  color: #fff;
  border-color: #0ea5e9;
}

.timer-pill {
  background: #ecfeff;
  border-color: #99f6e4;
  color: #134e4a;
}

.quiz-shell {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.quiz-main {
  min-width: 0;
}

.nav-row {
  justify-content: flex-start;
}

.question-palette {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 14px;
  padding: 10px;
  max-height: 78vh;
  overflow: auto;
}

.palette-legend {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.palette-legend h3 {
  margin: 0 0 8px;
  font-size: 0.96rem;
  color: #0f172a;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #334155;
  margin-bottom: 6px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.25);
}

.legend-swatch.answered {
  background: #22c55e;
}

.legend-swatch.not-answered {
  background: #f59e0b;
}

.legend-swatch.not-visited {
  background: #cbd5e1;
}

.legend-swatch.current {
  background: #0ea5e9;
}

.question-palette-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px;
}

.palette-btn {
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-weight: 900;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.palette-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
}

.palette-btn.answered {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

.palette-btn.not-answered {
  background: #ffedd5;
  border-color: #f59e0b;
  color: #9a3412;
}

.palette-btn.not-visited {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.palette-btn.active {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.review-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.review-summary-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.review-metric {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.review-metric span {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 700;
}

.review-metric strong {
  font-size: 1.1rem;
  color: #0f172a;
}

.review-list {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.review-card {
  border: 1px solid var(--border);
  border-left: 6px solid #f97316;
  border-radius: 14px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.07);
}

.review-card.review-unanswered {
  border-left-color: #f59e0b;
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

.review-card.review-wrong {
  border-left-color: #ef4444;
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 100%);
}

.review-card h4 {
  margin: 8px 0;
  font-size: 1rem;
  color: #0f172a;
}

.review-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.review-index {
  font-weight: 900;
  color: #0f172a;
}

.review-badge {
  font-size: 0.75rem;
  font-weight: 900;
  padding: 5px 10px;
  border-radius: 999px;
}

.review-badge-wrong {
  background: #fecaca;
  color: #7f1d1d;
}

.review-badge-skip {
  background: #fde68a;
  color: #78350f;
}

.review-image {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-top: 8px;
}

.review-answer-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.review-answer-card {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.review-answer-card span {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 800;
}

.review-answer-card strong {
  color: #0f172a;
}

.review-block {
  margin-top: 10px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 10px;
  background: #eff6ff;
}

.review-block h4 {
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: #1e40af;
}

.review-block p {
  margin: 0;
  color: #1f2937;
  line-height: 1.5;
}

.review-empty {
  border: 1px solid #86efac;
  border-radius: 14px;
  padding: 14px;
  background: #f0fdf4;
}

.review-empty h3 {
  margin-bottom: 8px;
  color: #14532d;
}

.question-number {
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 8px;
}

.math-frac {
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  line-height: 1.2;
}

.math-frac > .math-frac-num {
  display: block;
  border-bottom: 1.2px solid currentColor;
  padding: 1px 4px;
}

.math-frac > .math-frac-den {
  display: block;
  padding: 1px 4px;
}

.math-int {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
}

.math-int .math-int-upper,
.math-int .math-int-lower {
  font-size: 0.65em;
}

.math-int .math-int-symbol {
  font-size: 2em;
  line-height: 0.9;
}

.math-sum .math-int-symbol {
  font-size: 1.6em;
}

.math-matrix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

.math-matrix::before,
.math-matrix::after {
  content: "[";
  font-weight: 700;
  font-size: 1.2em;
  line-height: 1;
}

.math-matrix::after {
  content: "]";
}

.math-matrix-table {
  border-collapse: collapse;
}

.math-matrix-table td {
  padding: 0 6px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.2;
  white-space: nowrap;
}

body.quiz-active {
  overflow: hidden;
}

body.quiz-active .hero {
  display: none;
}

body.quiz-active .container {
  max-width: 100%;
  padding: 0;
}

body.quiz-active .container > .panel {
  display: none;
}

body.quiz-active #quizBox {
  padding: 20px;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.options label {
  display: block;
  background: #f8fafc;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.2s ease;
}

.options label:hover {
  background: #eef2ff;
}

.tabs-row {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
}

body.prestart-open {
  overflow: hidden;
}

.prestart-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1200;
  background:
    radial-gradient(circle at 12% 10%, rgba(14, 165, 233, 0.18), transparent 40%),
    radial-gradient(circle at 88% 84%, rgba(16, 185, 129, 0.2), transparent 36%),
    rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
}

.prestart-modal.hidden {
  display: none;
}

.prestart-card {
  width: min(900px, 96vw);
  border-radius: 22px;
  padding: 24px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: linear-gradient(145deg, #ffffff 0%, #f8fbff 55%, #f9fffb 100%);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.26);
  position: relative;
  overflow: hidden;
}

.prestart-card::before,
.prestart-card::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.prestart-card::before {
  width: 180px;
  height: 180px;
  right: -60px;
  top: -70px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.22), rgba(14, 165, 233, 0));
}

.prestart-card::after {
  width: 170px;
  height: 170px;
  left: -50px;
  bottom: -70px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0));
}

.prestart-card h2 {
  margin-top: 4px;
  font-size: 1.8rem;
  color: #0f172a;
}

.prestart-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #bae6fd;
  background: rgba(14, 165, 233, 0.12);
  color: #075985;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 900;
}

.prestart-subtitle {
  margin-top: 8px;
  color: #475569;
  font-weight: 600;
}

.prestart-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.prestart-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  color: #1e3a8a;
  font-size: 0.82rem;
  font-weight: 800;
}

.prestart-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.prestart-columns > div {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  padding: 14px;
}

.prestart-columns h3 {
  font-size: 1rem;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 8px;
}

.prestart-list {
  margin-left: 18px;
  color: #334155;
  display: grid;
  gap: 6px;
}

.prestart-list li {
  line-height: 1.45;
}

.prestart-list li::marker {
  color: #0284c7;
  font-weight: 900;
}

.prestart-loading-text {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #bae6fd;
  color: #075985;
  background: linear-gradient(90deg, #f0f9ff, #ecfeff, #f0f9ff);
  background-size: 220% 100%;
  font-weight: 800;
  animation: prestartShimmer 1.35s linear infinite;
}

.prestart-loading-text.hidden {
  display: none;
}

@keyframes prestartShimmer {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 220% 0;
  }
}

.pdf-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 999;
}

.pdf-modal.hidden {
  display: none;
}

.pdf-modal-card {
  width: min(1100px, 96vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.pdf-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.pdf-frame {
  width: 100%;
  height: 78vh;
  border: none;
}

@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .container {
    padding: 18px;
  }
  .quiz-container {
    margin: 18px auto;
    padding: 18px;
  }
  .quiz-shell {
    grid-template-columns: 1fr;
  }
  .question-palette {
    max-height: none;
  }
  .prestart-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .profile-dock-inline .profile-dock-card {
    width: 100%;
  }
  .profile-dock-floating {
    left: 8px;
    top: 8px;
    right: 8px;
  }
  .profile-dock-floating .profile-dock-card {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
  .page {
    min-height: 100dvh;
  }
  .container {
    padding: 12px;
  }
  .panel {
    padding: 16px;
    border-radius: 16px;
  }
  .hero {
    padding: 20px 14px;
    gap: 14px;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
  .subtitle {
    font-size: 0.95rem;
  }
  .hero-card {
    width: 100%;
    gap: 10px;
  }
  .hero-profile-card {
    min-width: 0;
    max-width: none;
  }
  .stat {
    width: 100%;
  }
  .selector-grid {
    grid-template-columns: 1fr !important;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  select {
    width: 100%;
  }
  input[type="text"],
  input[type="number"] {
    width: 100%;
  }
  .hierarchy-grid {
    grid-template-columns: 1fr;
  }
  .cta-row {
    flex-direction: column;
  }
  .quiz-top {
    flex-direction: column;
    align-items: stretch;
  }
  .quiz-top-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .progress-pill {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .btn,
  .download-btn,
  .start-btn,
  .submit-btn {
    width: 100%;
  }
  .prestart-card {
    padding: 16px;
    border-radius: 16px;
  }
  .prestart-card h2 {
    font-size: 1.4rem;
  }
  .question-palette-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .review-answer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .question-palette-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
