* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #666666;
  --border: #e0e0e0;
  --border-dark: #bdbdbd;
  --hover: #f5f5f5;
  --selected: #1a1a1a;
  --correct: #e8f5e9;
  --correct-border: #4caf50;
  --wrong: #ffebee;
  --wrong-border: #e53935;
  --easy: #4caf50;
  --medium: #ff9800;
  --hard: #e53935;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.mode-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f3f3f3;
}

.mode-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.mode-btn:hover {
  color: var(--text);
}

.mode-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* a thin divider between the question banks and the games */
.mode-sep {
  align-self: stretch;
  width: 1px;
  margin: 5px 3px;
  background: var(--border-dark);
}

/* every game tab hides the question bank chrome */
body.is-game .toolbar,
body.is-game .main,
body.is-game .header-right {
  display: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.site-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.header-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-links {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.resources-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-dark);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.resources-link:hover {
  background: var(--hover);
  border-color: #9e9e9e;
}

.discord-promo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.discord-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: #5865f2;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(88, 101, 242, 0.35);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.discord-link:hover {
  background: #4752c4;
  box-shadow: 0 2px 6px rgba(88, 101, 242, 0.45);
}

.discord-link-icon {
  flex-shrink: 0;
}

.discord-promo-note {
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--muted);
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-text {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.search {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.875rem;
  background: var(--bg);
}

.select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
}

/* Checkbox dropdowns (tests / domains) */
.multi-select {
  position: relative;
}

.multi-select-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 150px;
  max-width: 260px;
  cursor: pointer;
  text-align: left;
}

.multi-select-wide .multi-select-trigger {
  min-width: 190px;
}

.multi-select-trigger::after {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.multi-select.open .multi-select-trigger::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

.multi-select-trigger:hover,
.multi-select.open .multi-select-trigger {
  border-color: var(--border-dark);
}

.multi-select.has-selection .multi-select-trigger {
  border-color: var(--text);
  font-weight: 600;
}

.multi-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  min-width: 100%;
  width: max-content;
  max-width: min(340px, calc(100vw - 32px));
  max-height: min(420px, 60vh);
  overflow-y: auto;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.multi-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  user-select: none;
}

.multi-option:hover {
  background: var(--hover);
}

.multi-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.multi-check {
  flex-shrink: 0;
  position: relative;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-dark);
  border-radius: 3px;
  background: var(--bg);
}

.multi-option input:checked + .multi-check {
  background: var(--selected);
  border-color: var(--selected);
}

.multi-option input:checked + .multi-check::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.multi-option input:indeterminate + .multi-check {
  border-color: var(--selected);
}

.multi-option input:indeterminate + .multi-check::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 5.5px;
  width: 7px;
  height: 2px;
  background: var(--selected);
}

.multi-option input:focus-visible + .multi-check {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.multi-option-all {
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
  margin-bottom: 4px;
}

.multi-option-group {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.multi-option-all + .multi-option-group {
  margin-top: 0;
}

.multi-option-group ~ .multi-option:not(.multi-option-group) {
  padding-left: 20px;
}

.difficulty-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.diff-btn {
  padding: 8px 12px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
}

.diff-btn:last-child {
  border-right: none;
}

.diff-btn:hover {
  background: var(--hover);
}

.diff-btn.active {
  background: var(--selected);
  color: #fff;
}

.count-text {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: auto;
}

/* Buttons */
.btn {
  padding: 8px 14px;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  background: var(--bg);
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
}

.btn:hover {
  background: var(--hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-ghost {
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--hover);
}

/* Main layout */
.main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding-top: 20px;
  align-items: start;
}

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

/* Question grid */
.grid-section {
  min-width: 0;
}

.grid-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
}

.q-box {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  position: relative;
}

.q-box:hover {
  background: var(--hover);
  border-color: var(--border-dark);
}

.q-box.active {
  background: var(--selected);
  color: #fff;
  border-color: var(--selected);
}

.q-box.answered-correct {
  border-color: var(--correct-border);
  background: var(--correct);
  color: #1b5e20;
  font-weight: 600;
}

.q-box.answered-wrong {
  border-color: var(--wrong-border);
  background: var(--wrong);
  color: #b71c1c;
  font-weight: 600;
}

.q-box.active.answered-correct {
  background: var(--correct-border);
  border-color: var(--correct-border);
  color: #fff;
}

.q-box.active.answered-wrong {
  background: var(--wrong-border);
  border-color: var(--wrong-border);
  color: #fff;
}

.q-box.diff-E { border-left: 3px solid var(--easy); }
.q-box.diff-M { border-left: 3px solid var(--medium); }
.q-box.diff-H { border-left: 3px solid var(--hard); }

.q-box.active.diff-E,
.q-box.active.diff-M,
.q-box.active.diff-H {
  border-left: 3px solid #fff;
}

.empty-grid {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.loading-grid {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 20px;
  text-align: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-label {
  font-size: 0.875rem;
  color: var(--text);
}

.loading-note {
  max-width: 320px;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Viewer */
.viewer {
  border: 1px solid var(--border);
  border-radius: 4px;
  min-height: 400px;
  position: sticky;
  top: 20px;
}

.viewer-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--muted);
  font-size: 0.875rem;
}

.viewer-body {
  padding: 20px;
}

.viewer-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.viewer-number {
  font-weight: 600;
  font-size: 0.9rem;
}

.viewer-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.viewer-tags {
  font-size: 0.75rem;
  color: var(--muted);
}

.viewer-ids {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.blank-line {
  display: inline-block;
  min-width: 5rem;
  border-bottom: 1px solid var(--text);
  line-height: 1.2;
  vertical-align: baseline;
}

.viewer-stem math,
.viewer-stimulus math,
.choice-content math,
.viewer-rationale math {
  font-size: 1.05em;
}

.viewer-timer {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 48px;
  text-align: right;
}

.attempt-log {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fafafa;
  font-size: 0.8rem;
  color: var(--muted);
}

.attempt-log h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 6px;
  font-weight: 600;
}

.attempt-entry {
  padding: 4px 0;
  border-top: 1px solid var(--border);
}

.attempt-entry:first-of-type {
  border-top: none;
}

.attempt-entry.correct {
  color: #2e7d32;
}

.attempt-entry.wrong {
  color: #c62828;
}

.viewer-stimulus {
  padding: 12px;
  margin-bottom: 16px;
  border-left: 2px solid var(--border-dark);
  font-size: 0.9rem;
  line-height: 1.6;
}

.viewer-stem .sme-passage,
.viewer-stimulus .sme-passage {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.viewer-stimulus .sb-passage {
  margin: 0 0 10px;
}

.sb-figure {
  margin: 12px 0;
  max-width: 100%;
  overflow-x: auto;
}

.sb-figure svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.choice-content .sb-figure {
  margin: 4px 0 0;
}

.viewer-stem .sme-prompt {
  margin: 8px 0 12px;
  color: #444;
}

.viewer-stem .sme-table,
.viewer-stimulus .sme-table,
.viewer-rationale .sme-table {
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 0.9em;
}

.viewer-stem .sme-table th,
.viewer-stem .sme-table td,
.viewer-stimulus .sme-table th,
.viewer-stimulus .sme-table td,
.viewer-rationale .sme-table th,
.viewer-rationale .sme-table td {
  border: 1px solid var(--border);
  padding: 4px 8px;
}

.viewer-stem {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.desmos-panel {
  position: fixed;
  top: 96px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 16px));
  height: min(440px, calc(100vh - 120px));
  border: 1.5px solid var(--text);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.desmos-panel.hidden {
  display: none;
}

.desmos-panel.is-maximized {
  border-radius: 6px;
}

.desmos-drag-handle {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 10px;
  border-bottom: 1px solid var(--border);
  border-radius: 7px 7px 0 0;
  background: #f6f6f6;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.desmos-panel.is-dragging .desmos-drag-handle {
  cursor: grabbing;
}

.desmos-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.desmos-grip {
  color: var(--muted);
  letter-spacing: -2px;
}

.desmos-window-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.desmos-window-btn {
  width: 30px;
  height: 26px;
  border: 1px solid var(--border-dark);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.desmos-window-btn:hover {
  background: var(--hover);
}

.desmos-calculator {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 0 0 7px 7px;
}

/* resize grips: thin edges plus larger corners */
.desmos-resize {
  position: absolute;
  z-index: 2;
  touch-action: none;
}

.desmos-resize-n,
.desmos-resize-s {
  left: 14px;
  right: 14px;
  height: 8px;
  cursor: ns-resize;
}

.desmos-resize-n {
  top: -4px;
}

.desmos-resize-s {
  bottom: -4px;
}

.desmos-resize-e,
.desmos-resize-w {
  top: 14px;
  bottom: 14px;
  width: 8px;
  cursor: ew-resize;
}

.desmos-resize-e {
  right: -4px;
}

.desmos-resize-w {
  left: -4px;
}

.desmos-resize-ne,
.desmos-resize-nw,
.desmos-resize-se,
.desmos-resize-sw {
  width: 18px;
  height: 18px;
}

.desmos-resize-ne {
  top: -5px;
  right: -5px;
  cursor: nesw-resize;
}

.desmos-resize-nw {
  top: -5px;
  left: -5px;
  cursor: nwse-resize;
}

.desmos-resize-se {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}

.desmos-resize-sw {
  bottom: -5px;
  left: -5px;
  cursor: nesw-resize;
}

/* a visible grip in the bottom-right corner */
.desmos-resize-se::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, transparent 0 45%, var(--muted) 45% 52%, transparent 52% 66%, var(--muted) 66% 73%, transparent 73%);
  pointer-events: none;
}

body.desmos-is-moving {
  user-select: none;
  -webkit-user-select: none;
}

body.desmos-is-moving .desmos-calculator {
  pointer-events: none;
}

@media (pointer: coarse) {
  .desmos-resize-n,
  .desmos-resize-s {
    height: 18px;
  }

  .desmos-resize-n {
    top: -9px;
  }

  .desmos-resize-s {
    bottom: -9px;
  }

  .desmos-resize-e,
  .desmos-resize-w {
    width: 18px;
  }

  .desmos-resize-e {
    right: -9px;
  }

  .desmos-resize-w {
    left: -9px;
  }

  .desmos-resize-ne,
  .desmos-resize-nw,
  .desmos-resize-se,
  .desmos-resize-sw {
    width: 30px;
    height: 30px;
  }
}

.viewer-stem p,
.viewer-stimulus p,
.viewer-rationale p {
  margin-bottom: 0.5em;
}

/* Choices */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

.choice-btn:hover:not(:disabled) {
  background: var(--hover);
}

.choice-btn.selected {
  border-color: var(--text);
  background: var(--hover);
}

.choice-btn:disabled {
  cursor: default;
}

.choice-btn.correct {
  background: var(--correct);
  border-color: var(--correct-border);
}

.choice-btn.wrong {
  background: var(--wrong);
  border-color: var(--wrong-border);
}

.choice-letter {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.8rem;
}

.choice-btn.correct .choice-letter {
  background: var(--correct-border);
  border-color: var(--correct-border);
  color: #fff;
}

.choice-btn.wrong .choice-letter {
  background: var(--wrong-border);
  border-color: var(--wrong-border);
  color: #fff;
}

.choice-content {
  flex: 1;
}

/* SPR */
.spr-row {
  display: flex;
  gap: 8px;
}

.check-row {
  margin-top: 12px;
}

.spr-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  font-size: 0.95rem;
}

.spr-input.correct {
  border-color: var(--correct-border);
  background: var(--correct);
}

.spr-input.wrong {
  border-color: var(--wrong-border);
  background: var(--wrong);
}

.spr-input:disabled {
  opacity: 1;
}

/* Result banner */
.result-banner {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
}

.result-banner.correct {
  background: var(--correct);
  border: 1px solid var(--correct-border);
  color: #2e7d32;
}

.result-banner.wrong {
  background: var(--wrong);
  border: 1px solid var(--wrong-border);
  color: #c62828;
}

.viewer-rationale {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
}

.viewer-rationale h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 600;
}

.viewer-nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.viewer-nav .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.loading {
  opacity: 0.5;
  pointer-events: none;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 16px;
  background: var(--text);
  color: #fff;
  border-radius: 4px;
  font-size: 0.875rem;
}

/* MathML / tables in content */
.viewer-stem table,
.viewer-stimulus table,
.choice-content table {
  border-collapse: collapse;
  margin: 8px 0;
}

.viewer-stimulus .sr-only,
.viewer-stem .sr-only,
.choice-content .sr-only,
.viewer-rationale .sr-only {
  display: none !important;
}

.viewer-stimulus figure {
  max-width: 100%;
  overflow-x: auto;
}

.viewer-stimulus svg {
  max-width: 100%;
  height: auto;
}

.viewer-stem td,
.viewer-stem th,
.viewer-stimulus td,
.viewer-stimulus th,
.choice-content td,
.choice-content th {
  border: 1px solid var(--border);
  padding: 4px 8px;
}

/* Footer: a plain-language summary of the site (also what search engines read) */
.site-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.site-footer h2 {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 12px;
}

.site-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.site-footer h3 {
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.site-footer h3 a {
  color: var(--text);
  text-decoration: none;
}

.site-footer h3 a:hover {
  text-decoration: underline;
}

.site-footer-note {
  margin-top: 20px;
  font-size: 0.75rem;
}

.noscript-note {
  max-width: 1400px;
  margin: 16px auto;
  padding: 0 20px;
  color: var(--muted);
}

/* Account button in the header */
.account-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: var(--text);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}

.account-link:hover {
  background: #000;
}

.account-photo {
  width: 22px;
  height: 22px;
  margin: -4px 0 -4px -8px;
  border-radius: 50%;
  object-fit: cover;
}

/* Sign-in page */
.signin-page {
  display: flex;
  min-height: 100vh;
  background: #fafafa;
  background-image: linear-gradient(#eee 1px, transparent 1px), linear-gradient(90deg, #eee 1px, transparent 1px);
  background-size: 24px 24px;
}

.signin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 32px 16px;
}

.signin-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.signin-brand img {
  border-radius: 8px;
}

.signin-card {
  width: 100%;
  padding: 28px 24px;
  text-align: center;
  background: #fff;
  border: 2px solid var(--text);
  border-radius: 12px;
  box-shadow: 5px 5px 0 var(--text);
}

.signin-card h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.signin-lead {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 18px;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--text);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.google-btn:hover:not(:disabled) {
  background: var(--hover);
}

.google-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.google-btn-dark {
  background: var(--text);
  color: #fff;
}

.google-btn-dark:hover {
  background: #000 !important;
}

.signin-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signin-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin-bottom: 10px;
  border: 2px solid var(--text);
}

.signin-fine {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--muted);
}

.signin-link {
  margin-top: 16px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

.signin-msg:not(:empty) {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text);
}

.signin-back {
  font-size: 0.85rem;
  color: var(--muted);
}

/* SAT Quest landing page */
.quest-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.quest-nav {
  display: flex;
  gap: 18px;
  font-size: 0.9rem;
  font-weight: 600;
}

.quest-nav a {
  color: var(--text);
  text-decoration: none;
}

.quest-nav a:hover {
  text-decoration: underline;
}

.quest-hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 0 24px;
  text-align: center;
}

.quest-kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.quest-hero h1 {
  margin: 6px 0 14px;
  font-size: clamp(2.8rem, 9vw, 5.5rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.quest-lead {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #444;
}

.quest-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 24px 0 32px;
}

.quest-cta .google-btn,
.quest-end .google-btn {
  width: auto;
  min-width: 220px;
}

.quest-shot {
  width: 100%;
  height: auto;
  border: 2px solid var(--text);
  border-radius: 12px;
  box-shadow: 6px 6px 0 var(--text);
}

.quest-section {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  line-height: 1.65;
}

.quest-section h2 {
  font-size: 1.5rem;
  margin-bottom: 14px;
}

.quest-section h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.quest-section ul,
.quest-section ol {
  padding-left: 20px;
}

.quest-section li {
  margin-bottom: 8px;
}

.quest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.quest-section details {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.quest-section summary {
  font-weight: 700;
  cursor: pointer;
}

.quest-section details p {
  margin-top: 8px;
  color: #444;
}

.quest-end {
  border-top: 1px solid var(--border);
}

.quest-end h2 {
  font-size: 1.8rem;
  margin-bottom: 18px;
}

.quest-nav a,
.quest-top .signin-brand {
  white-space: nowrap;
}

@media (max-width: 480px) {
  .quest-top .signin-brand {
    font-size: 0.9rem;
  }

  .quest-nav {
    gap: 12px;
    font-size: 0.82rem;
  }
}

/* Six mode tabs don't fit on one line on phones: lay them out in a grid. */
@media (max-width: 560px) {
  .mode-switch {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
  }

  .mode-sep {
    display: none;
  }

  .mode-btn {
    white-space: nowrap;
  }

  .header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .header-left {
    gap: 14px;
    min-width: 0;
  }

  .header-links,
  .discord-promo,
  .header-right {
    flex-wrap: wrap;
  }

  .discord-promo-note {
    white-space: normal;
  }
}
