/* SAT practice tests */

.sat-format-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}
@media (max-width: 900px) {
  .sat-format-grid { grid-template-columns: 1fr; }
}

.sat-resume,
.sat-error,
.sat-empty,
.sat-section-gap { margin-top: 14px; }
.sat-error { border-color: rgba(239, 68, 68, 0.45); color: rgba(254, 226, 226, 0.95); }
.sat-start { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.sat-recent-list { display: grid; gap: 10px; margin-top: 12px; }
.sat-recent-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sat-recent-row span { margin-right: auto; }
.sat-bank-link { margin-top: 18px; }

/* Test runner */

.sat-test { display: flex; flex-direction: column; gap: 14px; padding-bottom: 170px; }

.sat-topbar {
  position: sticky;
  top: 64px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(11, 16, 32, 0.92);
  backdrop-filter: blur(10px);
}
.sat-title { font-weight: 700; }
.sat-topbar-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sat-timer { min-width: 96px; font-variant-numeric: tabular-nums; }
.sat-timer.warning { border-color: rgba(239, 68, 68, 0.6); color: rgba(254, 202, 202, 0.98); }
.sat-timer [hidden] { display: none; }

.sat-directions[hidden] { display: none !important; }
.sat-directions p { margin: 0 0 8px; line-height: 1.55; }
.sat-directions ul { margin: 0; padding-left: 20px; line-height: 1.65; }

.sat-question { display: grid; gap: 14px; }
.sat-question[hidden] { display: none !important; }
.sat-question-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.sat-question-single { max-width: 820px; }
@media (max-width: 900px) {
  .sat-question-split { grid-template-columns: 1fr; }
}

.sat-passage,
.sat-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}
.sat-passage { font-size: 16px; line-height: 1.7; color: rgba(255, 255, 255, 0.92); }
.sat-passage p,
.sat-stem p { margin: 0 0 10px; }
.sat-passage p:last-child,
.sat-stem p:last-child { margin-bottom: 0; }

.sat-item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.sat-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 700;
}
.sat-flag { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; cursor: pointer; }
.sat-flag input { accent-color: #f59e0b; }
.sat-stem { font-size: 16px; line-height: 1.65; }

.sat-table { border-collapse: collapse; margin: 8px 0 12px; font-size: 15px; font-variant-numeric: tabular-nums; }
.sat-table th,
.sat-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.sat-table th { background: rgba(255, 255, 255, 0.06); }

.sat-spr { display: flex; flex-direction: column; gap: 6px; max-width: 280px; margin-top: 12px; }
.sat-spr-input { font-size: 20px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.sat-spr-error { color: rgba(252, 165, 165, 0.98); }
.sat-spr-error[hidden] { display: none !important; }

.sat-bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px max(18px, calc((100vw - 1100px) / 2 + 18px));
  border-top: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.96);
  backdrop-filter: blur(10px);
}
.sat-bottombar-actions { display: flex; gap: 8px; }

.sat-navigator {
  position: fixed;
  left: 50%;
  bottom: 142px;
  z-index: 31;
  width: min(580px, calc(100vw - 36px));
  transform: translateX(-50%);
  background: rgba(11, 16, 32, 0.98);
}
.sat-navigator[hidden],
.sat-review[hidden] { display: none !important; }

.sat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; margin-top: 10px; }
.sat-grid-cell {
  position: relative;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(124, 58, 237, 0.55);
  background: rgba(124, 58, 237, 0.24);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.sat-grid-cell.unanswered { background: transparent; border-style: dashed; border-color: rgba(255, 255, 255, 0.28); }
.sat-grid-cell.flagged::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #f59e0b;
}
.sat-grid-cell.current { outline: 2px solid rgba(255, 255, 255, 0.85); outline-offset: 1px; }

.sat-question-strip {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 29;
  padding: 8px max(18px, calc((100vw - 1100px) / 2 + 18px));
  border-top: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.97);
}
.sat-test-strip { bottom: 68px; }
.sat-results-strip { bottom: 0; }
.sat-results-strip + .stack { padding-bottom: 110px; }
.sat-question-strip .sat-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 38px;
  grid-template-columns: none;
  gap: 6px;
  margin-top: 0;
  padding: 3px 1px;
  overflow-x: auto;
}
.sat-question-strip .sat-grid-cell { height: 38px; }
.sat-grid-cell.correct { background: rgba(34, 197, 94, 0.3); border-color: #22c55e; }
.sat-grid-cell.incorrect { background: rgba(239, 68, 68, 0.3); border-color: #ef4444; }
.sat-strip-skill { min-height: 20px; margin-bottom: 4px; }
@media (max-width: 600px) {
  .sat-test-strip { bottom: 78px; }
  .sat-navigator { bottom: 152px; }
}

.sat-break { max-width: 640px; margin: 20px auto; text-align: center; }
.sat-break-timer { margin: 12px 0 18px; font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Results */

.sat-score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 14px 0; }
.sat-score-card { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(0, 0, 0, 0.18); }
.sat-score-card.total { border-color: rgba(124, 58, 237, 0.55); }

.sat-breakdown,
.sat-bank-table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; font-size: 14px; }
.sat-breakdown th,
.sat-breakdown td,
.sat-bank-table th,
.sat-bank-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.sat-breakdown th,
.sat-bank-table th { color: var(--muted); font-weight: 600; }
.sat-domain-row td { font-weight: 700; }
.sat-skill-row td:first-child { padding-left: 24px; color: rgba(255, 255, 255, 0.82); }
.sat-bar-col { width: 40%; }
.sat-bar { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.sat-bar span { display: block; height: 100%; background: linear-gradient(90deg, rgba(124, 58, 237, 0.95), rgba(34, 197, 94, 0.8)); }

.sat-filter.active { border-color: rgba(124, 58, 237, 0.7); background: rgba(124, 58, 237, 0.24); }
.sat-result[hidden] { display: none !important; }
.sat-result { scroll-margin-top: 100px; }
.sat-result-title { margin: 0; }
.sat-passage-review { margin: 12px 0; }
.sat-result .sat-stem { margin-top: 12px; }
.sat-explanation { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.sat-explanation summary { cursor: pointer; font-weight: 600; }
.sat-explanation .script p { margin: 8px 0 0; }

/* Bluebook-style testing tools */

.sat-topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.sat-topbar-left { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sat-topbar-center { display: flex; justify-content: center; }
.sat-topbar-tools { justify-content: flex-end; }
@media (max-width: 900px) {
  .sat-topbar { grid-template-columns: 1fr; }
  .sat-topbar-center { justify-content: flex-start; }
}

.sat-clock { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sat-clock-time { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sat-clock-time[hidden] { display: none; }
.sat-clock-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.sat-clock-toggle.warning { border-color: rgba(239, 68, 68, 0.7); color: rgba(254, 202, 202, 0.98); }

.sat-tool {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.sat-tool:hover { background: rgba(255, 255, 255, 0.10); }
.sat-tool.active { border-color: rgba(124, 58, 237, 0.75); background: rgba(124, 58, 237, 0.25); }
.sat-tool-quiet { padding: 4px 10px; font-size: 13px; color: var(--muted); }

.sat-more { position: relative; }
.sat-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  width: 230px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(11, 16, 32, 0.98);
  box-shadow: var(--shadow);
}
.sat-more-menu[hidden] { display: none; }
.sat-more-menu button,
.sat-more-menu a {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}
.sat-more-menu button:hover,
.sat-more-menu a:hover { background: rgba(255, 255, 255, 0.08); }
.sat-more-menu p { margin: 6px 10px 2px; }

/* Mark for Review bookmark */

.sat-flag input { position: absolute; opacity: 0; pointer-events: none; }
.sat-flag-mark {
  width: 14px;
  height: 18px;
  border: 2px solid var(--muted);
  border-bottom: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}
.sat-flag input:checked + .sat-flag-mark { border-color: #f59e0b; background: #f59e0b; }
.sat-flag input:checked ~ .sat-flag-text { color: #fbbf24; }

/* Option eliminator */

.sat-abc {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
}
.sat-abc.active { border-color: rgba(124, 58, 237, 0.75); background: rgba(124, 58, 237, 0.25); color: var(--text); }

.sat-choice-row { display: flex; align-items: center; gap: 8px; }
.sat-choice-row .choice { flex: 1; }
.sat-cross {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}
.sat-cross[hidden] { display: none; }
.sat-cross::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 1px;
  background: currentColor;
}
.sat-choice-row.crossed .choice { opacity: 0.45; }
.sat-choice-row.crossed .sat-choice-text { text-decoration: line-through; }
.sat-choice-row.crossed .sat-cross { color: var(--text); border-color: rgba(255, 255, 255, 0.45); }
.sat-choice-row.crossed .sat-cross::after { display: none; }

/* Highlights and notes */

.sat-test.annotating .sat-passage,
.sat-test.annotating .sat-stem { cursor: text; background-image: linear-gradient(transparent, transparent); }
.sat-test.annotating .sat-passage { outline: 1px dashed rgba(251, 191, 36, 0.5); }
mark.sat-highlight { background: rgba(251, 191, 36, 0.35); color: inherit; border-radius: 3px; cursor: pointer; }
mark.sat-highlight.has-note { box-shadow: inset 0 -2px 0 rgba(251, 191, 36, 0.95); }

.sat-note {
  position: fixed;
  z-index: 60;
  width: min(340px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(11, 16, 32, 0.98);
  box-shadow: var(--shadow);
}
.sat-note[hidden] { display: none; }
.sat-note-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.sat-note-text { width: 100%; }

/* Floating panels */

.sat-panel {
  position: fixed;
  right: 24px;
  top: 96px;
  z-index: 50;
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(11, 16, 32, 0.98);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sat-panel[hidden] { display: none; }
.sat-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  cursor: move;
  touch-action: none;
}
.sat-panel-title { font-weight: 700; }
.sat-panel-link { margin-left: auto; color: var(--muted); font-size: 13px; text-decoration: underline; }
.sat-panel-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.sat-panel-body { max-height: 60vh; overflow: auto; }
.sat-panel-calculator .sat-panel-body { height: 460px; max-height: 60vh; padding: 0; }
.sat-panel-calculator iframe { width: 100%; height: 100%; border: 0; display: block; }
.sat-reference { padding: 12px 16px; }
.sat-reference ul { margin: 0; padding-left: 18px; line-height: 1.85; }

/* Line reader */

.sat-linereader {
  position: fixed;
  left: 0;
  right: 0;
  height: 76px;
  z-index: 45;
  box-shadow: 0 0 0 9999px rgba(3, 6, 18, 0.72);
  cursor: grab;
  touch-action: none;
}
.sat-linereader[hidden] { display: none; }

/* Modals */

.sat-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 6, 18, 0.6);
}
.sat-modal[hidden] { display: none; }
.sat-modal-card {
  width: min(460px, 100%);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(11, 16, 32, 0.99);
  box-shadow: var(--shadow);
}
.sat-modal-card h2 { margin-top: 0; }

.sat-panel-calculator { left: 24px; right: auto; }
.sat-panel-reference { right: 24px; top: 120px; }
