/* Digital SAT Testing Mode — Bluebook-inspired exam chrome */

.tx-shell {
  --tx-ink: #1f3040;
  --tx-muted: #49545f;
  --tx-line: rgba(31, 48, 64, 0.14);
  --tx-surface: rgba(255, 255, 255, 0.9);
  --tx-accent: #2E7D32;
  --tx-accent-deep: #1B5E20;
  --tx-warn: #b45309;
  --tx-flag: #b91c1c;
  --tx-hl-yellow: #fef08a;
  --tx-hl-green: #bbf7d0;
  --tx-hl-pink: #fbcfe8;
  --tx-shadow: 0 12px 30px rgba(58, 88, 72, 0.06);
  --tx-transition: 220ms ease;
  width: 100%;
  min-height: calc(100dvh - 5.5rem);
  padding: 1.5rem 1rem 1.5rem;
  box-sizing: border-box;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--tx-muted);
}

.dark .tx-shell,
html.dark .tx-shell {
  --tx-ink: #e8edf4;
  --tx-muted: #c5cdd8;
  --tx-line: rgba(255, 255, 255, 0.12);
  --tx-surface: rgba(36, 42, 54, 0.88);
  --tx-accent: #81c784;
  --tx-accent-deep: #1B5E20;
  --tx-warn: #fbbf24;
  --tx-flag: #f87171;
  --tx-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Lobby */
.tx-lobby,
.tx-summary {
  display: flex;
  justify-content: center;
  padding: 2rem 0 3rem;
}

.tx-lobby.hidden,
.tx-exam.hidden,
.tx-summary.hidden,
.tx-overlay.hidden,
.tx-grid-in.hidden,
.tx-workspace-wrap.hidden,
.tx-review.hidden,
.tx-hl-colors.hidden,
.tx-progress-panel.hidden {
  display: none !important;
}

.tx-lobby-card,
.tx-summary-card,
.tx-overlay-card {
  width: min(640px, 100%);
  background: var(--tx-surface);
  border: 1px solid var(--tx-line);
  border-radius: 22px;
  padding: 2rem 1.75rem;
  box-shadow: var(--tx-shadow);
}

.tx-eyebrow {
  margin: 0 0 0.35rem;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tx-accent);
}

.tx-lobby-title {
  margin: 0 0 0.65rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
  color: #388E3C;
}

html.dark .tx-lobby-title,
.dark .tx-lobby-title {
  color: #a5d6a7;
}

.tx-lobby-copy {
  margin: 0 0 1.5rem;
  color: var(--tx-muted);
  line-height: 1.55;
  font-size: 0.98rem;
}

.tx-mode-grid {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.tx-mode-btn {
  text-align: left;
  border: 1.5px solid rgba(31, 48, 64, 0.18);
  background: #fff;
  border-radius: 0.65rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: border-color var(--tx-transition), background var(--tx-transition), box-shadow var(--tx-transition);
  color: inherit;
  box-shadow: 2px 2px 0 rgba(31, 48, 64, 0.12);
}

html.dark .tx-mode-btn,
.dark .tx-mode-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.tx-mode-btn:hover {
  border-color: rgba(46, 125, 50, 0.45);
}

.tx-mode-btn.is-selected {
  border-color: #2E7D32;
  background: rgba(46, 125, 50, 0.1);
  box-shadow: 2px 2px 0 #1B5E20;
}

html.dark .tx-mode-btn.is-selected,
.dark .tx-mode-btn.is-selected {
  border-color: #81c784;
  background: rgba(129, 199, 132, 0.14);
}

.tx-mode-name {
  display: block;
  font-weight: 600;
  font-family: "Space Grotesk", sans-serif;
  margin-bottom: 0.15rem;
}

.tx-mode-meta {
  display: block;
  font-size: 0.82rem;
  color: var(--tx-muted);
}

.tx-lobby-status {
  min-height: 1.25rem;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--tx-warn);
}

.tx-lobby-note {
  margin: 0.85rem 0 0;
  font-size: 0.8rem;
  color: var(--tx-muted);
}

.tx-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  border-radius: 0.5rem;
  padding: 0.9rem 1.1rem;
  min-height: 52px;
  background: #2E7D32;
  color: #fff;
  font-weight: 600;
  font-family: 'Open Sans', sans-serif;
  cursor: pointer;
  box-shadow: 3px 3px 0 #1B5E20;
  transition: transform var(--tx-transition), box-shadow var(--tx-transition), background var(--tx-transition), opacity var(--tx-transition);
}

.tx-primary-btn:hover {
  background: #276a2b;
}

.tx-primary-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #1B5E20;
}

.tx-primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.tx-secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 1.5px solid rgba(31, 48, 64, 0.22);
  border-radius: 0.5rem;
  padding: 0.9rem 1.1rem;
  min-height: 52px;
  background: #fff;
  color: var(--tx-ink);
  font-weight: 600;
  font-family: 'Open Sans', sans-serif;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(31, 48, 64, 0.18);
  transition: transform var(--tx-transition), box-shadow var(--tx-transition), border-color var(--tx-transition), color var(--tx-transition);
}

html.dark .tx-secondary-btn,
.dark .tx-secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}

.tx-secondary-btn:hover {
  border-color: rgba(46, 125, 50, 0.45);
  color: #2E7D32;
}

.tx-secondary-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(31, 48, 64, 0.18);
}

.tx-secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  color: var(--tx-accent);
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  text-decoration: none;
}

.tx-secondary-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Toolbar */
.tx-exam {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 1320px;
  margin: 0 auto;
}

.tx-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--tx-line);
  border-radius: 0.85rem;
  background: var(--tx-surface);
}

.tx-toolbar-left,
.tx-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tx-toolbar-right {
  justify-content: flex-end;
}

.tx-section-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--tx-line);
  color: var(--tx-ink);
  white-space: nowrap;
}

.tx-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
}

.tx-tool-btn {
  border: 1px solid var(--tx-line);
  background: transparent;
  color: var(--tx-ink);
  border-radius: 0.5rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.tx-tool-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0.25rem;
}

.tx-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.tx-tool-btn[aria-pressed="true"] {
  border-color: var(--tx-accent);
  background: rgba(46, 125, 50, 0.12);
  color: var(--tx-accent);
}

html.dark .tx-tool-btn[aria-pressed="true"],
.dark .tx-tool-btn[aria-pressed="true"] {
  background: rgba(129, 199, 132, 0.16);
}

.tx-hl-colors {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem;
  border: 1px solid var(--tx-line);
  border-radius: 0.5rem;
  background: var(--tx-surface);
}

.tx-hl-swatch {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.35rem;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.tx-hl-swatch[data-hl="yellow"] {
  background: var(--tx-hl-yellow);
}

.tx-hl-swatch[data-hl="green"] {
  background: var(--tx-hl-green);
}

.tx-hl-swatch[data-hl="pink"] {
  background: var(--tx-hl-pink);
}

.tx-hl-swatch.is-active {
  border-color: var(--tx-ink);
  box-shadow: 0 0 0 1px var(--tx-surface);
}

.tx-timer {
  border: 0;
  background: transparent;
  color: var(--tx-ink);
  font-family: "Orbitron", "Space Grotesk", sans-serif;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  min-width: 5.5rem;
  text-align: center;
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
}

.tx-timer.is-low {
  color: #dc2626;
}

.tx-timer.is-hidden-face #tx-timer-display {
  visibility: hidden;
}

.tx-timer.is-hidden-face::after {
  content: "••:••";
  font-family: inherit;
}

.tx-submit-module {
  border: 0;
  background: #2E7D32;
  color: #fff;
  border-radius: 0.5rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'Open Sans', sans-serif;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1B5E20;
  transition: transform var(--tx-transition), box-shadow var(--tx-transition), background var(--tx-transition);
}

.tx-submit-module:hover {
  background: #276a2b;
}

.tx-submit-module:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #1B5E20;
}

html.dark .tx-submit-module,
.dark .tx-submit-module {
  background: #2E7D32;
  color: #fff;
}

/* Layout reuse of practice split */
.tx-workspace-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tx-layout.pn-layout {
  --pn-text-ratio: 0.52;
  width: 100%;
  height: min(calc(100dvh - 14rem), 780px);
  max-height: calc(100dvh - 12rem);
  margin: 0;
}

.tx-workspace {
  width: 100%;
  height: 100%;
  flex: 1;
  border-radius: 1rem;
  border: 1px solid var(--tx-line);
  background: var(--tx-surface);
  overflow: hidden;
}

.tx-answer-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.65rem;
}

.tx-answer-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
}

/* Selected / eliminated choices */
#tx-choices .pn-choice.is-selected {
  border-color: var(--tx-accent) !important;
  background: rgba(46, 125, 50, 0.1) !important;
}

html.dark #tx-choices .pn-choice.is-selected,
.dark #tx-choices .pn-choice.is-selected {
  border-color: var(--tx-accent) !important;
  background: rgba(129, 199, 132, 0.16) !important;
}

#tx-choices .pn-choice.is-selected .pn-choice-letter {
  border-color: var(--tx-accent) !important;
  background: var(--tx-accent) !important;
  color: #fff !important;
}

.pn-choice.is-eliminated {
  opacity: 0.45;
  text-decoration: line-through;
}

.pn-choice.is-eliminated .pn-choice-letter {
  background: #94a3b8;
  color: #fff;
}

.pn-choice.is-eliminated .pn-choice-letter-x {
  display: inline;
}

.pn-choice.is-eliminated .pn-choice-letter-char {
  display: none;
}

body.tx-crossout-on .pn-choice {
  cursor: cell;
}

body.tx-hl-on #tx-text-blocks,
body.tx-hl-on #tx-stem {
  cursor: text;
  user-select: text;
}

mark.tx-hl {
  border-radius: 0.15rem;
  padding: 0 0.05em;
  color: inherit;
}

mark.tx-hl-yellow {
  background: var(--tx-hl-yellow);
}

mark.tx-hl-green {
  background: var(--tx-hl-green);
}

mark.tx-hl-pink {
  background: var(--tx-hl-pink);
}

/* Grid-in */
.tx-grid-in {
  margin-top: 0.75rem;
}

.tx-grid-label {
  display: block;
  font-size: 0.85rem;
  color: var(--tx-muted);
  margin-bottom: 0.35rem;
}

.tx-grid-input {
  width: min(220px, 100%);
  border: 1px solid var(--tx-line);
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
  background: transparent;
  color: inherit;
  font-size: 1.05rem;
}

/* Bottom progress dropdown */
.tx-bottom-bar {
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
}

.tx-progress-menu {
  position: relative;
}

.tx-progress-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1.5px solid rgba(31, 48, 64, 0.18);
  background: #fff;
  color: var(--tx-ink);
  border-radius: 0.5rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Open Sans', sans-serif;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(31, 48, 64, 0.12);
}

html.dark .tx-progress-btn,
.dark .tx-progress-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.tx-progress-caret {
  font-size: 0.7rem;
  color: var(--tx-muted);
  transition: transform 140ms ease;
}

.tx-progress-btn[aria-expanded="true"] .tx-progress-caret {
  transform: rotate(180deg);
}

.tx-progress-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.45rem);
  width: min(22rem, calc(100vw - 2rem));
  border: 1px solid var(--tx-line);
  border-radius: 0.85rem;
  background: var(--tx-surface);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  padding: 0.65rem;
  z-index: 40;
}

.tx-question-map {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 9rem;
  overflow-y: auto;
  padding: 0.15rem;
}

.tx-map-btn {
  position: relative;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.4rem;
  border: 1.5px solid var(--tx-line);
  background: transparent;
  color: var(--tx-ink);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.tx-map-btn.is-current {
  border-color: var(--tx-accent);
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.22);
}

.tx-map-btn.is-answered {
  background: var(--tx-accent);
  border-color: var(--tx-accent);
  color: #fff;
}

.tx-map-btn.is-flagged::after {
  content: "";
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--tx-flag);
}

.tx-goto-review-btn {
  width: 100%;
  margin-top: 0.55rem;
  border: 1.5px solid rgba(31, 48, 64, 0.18);
  background: #fff;
  color: var(--tx-ink);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'Open Sans', sans-serif;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(31, 48, 64, 0.12);
}

html.dark .tx-goto-review-btn,
.dark .tx-goto-review-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.tx-goto-review-btn:hover {
  border-color: rgba(46, 125, 50, 0.45);
  color: #2E7D32;
}

/* Review page */
.tx-review {
  display: flex;
  justify-content: center;
  padding: 1rem 0 2rem;
}

.tx-review-card {
  width: min(720px, 100%);
  background: var(--tx-surface);
  border: 1px solid var(--tx-line);
  border-radius: 1rem;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.tx-review-title {
  margin: 0 0 0.4rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.55rem;
  color: var(--tx-ink);
}

.tx-review-copy {
  margin: 0 0 1.25rem;
  color: var(--tx-muted);
  font-size: 0.95rem;
}

.tx-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.75rem, 1fr));
  gap: 0.55rem;
  margin-bottom: 1.5rem;
}

.tx-review-cell {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 0.45rem;
  border: 2px solid var(--tx-accent);
  background: transparent;
  color: var(--tx-accent);
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
}

.tx-review-cell.is-answered {
  background: var(--tx-accent);
  color: #fff;
}

.tx-review-cell.is-flagged::after {
  content: "";
  position: absolute;
  bottom: 0.2rem;
  right: 0.2rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--tx-flag);
  border: 1.5px solid var(--tx-surface);
}

.tx-review-actions {
  display: grid;
  gap: 0.65rem;
}

/* Overlays */
.tx-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
}

.tx-overlay-title {
  margin: 0 0 0.5rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.45rem;
}

.tx-overlay-copy {
  margin: 0 0 1.25rem;
  color: var(--tx-muted);
  line-height: 1.5;
}

/* Summary */
.tx-predicted-scores {
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  background: rgba(46, 125, 50, 0.08);
  border: 1px solid rgba(46, 125, 50, 0.2);
}

html.dark .tx-predicted-scores {
  background: rgba(129, 199, 132, 0.1);
  border-color: rgba(129, 199, 132, 0.25);
}

.tx-predicted-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 1rem;
}

.tx-predicted-total strong {
  font-size: 2.25rem;
  font-weight: 700;
  color: #2E7D32;
  letter-spacing: -0.02em;
}

html.dark .tx-predicted-total strong {
  color: #a5d6a7;
}

.tx-predicted-label {
  font-weight: 600;
  opacity: 0.8;
}

.tx-predicted-row {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.tx-summary-body {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tx-summary-section {
  border: 1px solid var(--tx-line);
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
}

.tx-summary-section h3 {
  margin: 0 0 0.4rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
}

.tx-summary-stat {
  font-size: 0.92rem;
  color: var(--tx-muted);
  margin: 0.2rem 0;
}

.tx-domain-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  padding: 0.25rem 0;
  border-top: 1px solid color-mix(in srgb, var(--tx-line) 70%, transparent);
}

.tx-summary-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
}

@media (max-width: 860px) {
  .tx-toolbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .tx-toolbar-left,
  .tx-toolbar-right {
    justify-content: space-between;
  }

  .tx-timer {
    justify-self: center;
  }

  .tx-layout.pn-layout {
    height: auto;
    max-height: none;
    min-height: 70dvh;
  }
}
