.psp-player,
.psp-player * {
  box-sizing: border-box;
}

.psp-player {
  --psp-navy: #0b234a;
  --psp-blue: #174a7e;
  --psp-red: #d71946;
  --psp-red-dark: #ae1238;
  --psp-ink: #14233c;
  --psp-muted: #667085;
  --psp-line: #dce4ee;
  --psp-cloud: #f4f7fb;
  --psp-white: #fff;
  --psp-success: #087a55;
  --psp-warning: #a15c00;
  position: relative;
  width: 100%;
  min-height: 720px;
  overflow: hidden;
  color: var(--psp-ink);
  border: 1px solid var(--psp-line);
  border-radius: 24px;
  background: var(--psp-cloud);
  box-shadow: 0 24px 64px rgba(11, 35, 74, .13);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.psp-player [hidden] {
  display: none !important;
}

.psp-skip-link {
  position: absolute;
  z-index: 20;
  top: 8px;
  left: 10px;
  padding: 10px 14px;
  color: #fff;
  border-radius: 8px;
  background: #000;
  transform: translateY(-150%);
}

.psp-skip-link:focus {
  transform: translateY(0);
}

.psp-header {
  display: grid;
  min-height: 88px;
  grid-template-columns: minmax(110px, 1fr) minmax(220px, 2fr) minmax(280px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  color: #fff;
  background: linear-gradient(112deg, #071a38 0%, var(--psp-navy) 58%, #173f6d 100%);
}

.psp-exit-button,
.psp-secondary-button,
.psp-primary-button,
.psp-submit-button,
.psp-connection button,
.psp-item-button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.psp-exit-button {
  justify-self: start;
  padding: 10px 13px;
  color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .09);
}

.psp-exit-button:hover {
  background: rgba(255, 255, 255, .16);
}

.psp-title-block {
  min-width: 0;
  text-align: center;
}

.psp-title-block > span {
  color: rgba(255, 255, 255, .58);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
}

.psp-title-block h1 {
  margin: 3px 0 0;
  overflow: hidden;
  color: #fff;
  font-size: clamp(15px, 2vw, 19px);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psp-session-state {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.psp-save-state {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, .74);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.psp-state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #70d8b4;
  box-shadow: 0 0 0 4px rgba(112, 216, 180, .12);
}

.psp-save-state[data-state="saving"] .psp-state-dot,
.psp-save-state[data-state="pending"] .psp-state-dot {
  background: #f4c86b;
  box-shadow: 0 0 0 4px rgba(244, 200, 107, .12);
}

.psp-save-state[data-state="offline"] .psp-state-dot,
.psp-save-state[data-state="error"] .psp-state-dot {
  background: #ff879f;
  box-shadow: 0 0 0 4px rgba(255, 135, 159, .12);
}

.psp-timer {
  display: grid;
  gap: 2px;
  min-width: 112px;
  padding-left: 17px;
  border-left: 1px solid rgba(255, 255, 255, .18);
}

.psp-timer span {
  color: rgba(255, 255, 255, .6);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.psp-timer strong {
  color: #fff;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

.psp-timer[data-state="urgent"] strong {
  color: #ffb8c7;
}

.psp-timer[data-state="unknown"] strong {
  font-size: 12px;
}

.psp-connection {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 9px 22px;
  color: #743d00;
  border-bottom: 1px solid #f2d7a7;
  background: #fff6e5;
}

.psp-connection > span {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--psp-warning);
  font-weight: 900;
}

.psp-connection p {
  flex: 1;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.psp-connection button {
  min-height: 44px;
  padding: 7px 12px;
  color: #743d00;
  border: 1px solid #dfbd7d;
  background: #fff;
}

.psp-progress-region {
  padding: 16px 24px 13px;
  border-bottom: 1px solid var(--psp-line);
  background: #fff;
}

.psp-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
  font-size: 11px;
}

.psp-progress-copy strong {
  color: var(--psp-navy);
}

.psp-progress-copy span {
  color: var(--psp-muted);
}

.psp-progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.psp-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--psp-red), #ec5576);
  transition: width .25s ease;
}

.psp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px;
}

.psp-question-card,
.psp-navigator {
  border: 1px solid var(--psp-line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(11, 35, 74, .06);
}

.psp-question-card {
  min-width: 0;
  padding: clamp(22px, 4vw, 42px);
}

.psp-instructions {
  margin: -8px 0 20px;
  padding: 12px 14px;
  color: #40516b;
  border-radius: 9px;
  background: #eef3f8;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.psp-question-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 19px;
}

.psp-question-meta span:first-child {
  padding: 6px 10px;
  color: var(--psp-red-dark);
  border-radius: 999px;
  background: #fff0f3;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.psp-question-meta span:last-child {
  color: var(--psp-muted);
  font-size: 11px;
  font-weight: 700;
}

.psp-stimulus {
  margin: 0 0 24px;
  padding: 19px 21px;
  color: #344054;
  border: 1px solid #dce5f0;
  border-left: 4px solid var(--psp-blue);
  border-radius: 5px 12px 12px 5px;
  background: #f7f9fc;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.psp-stimulus > :first-child { margin-top: 0; }
.psp-stimulus > :last-child { margin-bottom: 0; }
.psp-stimulus-title { margin: 0 0 10px; color: var(--psp-navy); font-size: 15px; }
.psp-stimulus-text,
.psp-content-text { margin: 0 0 12px; }
.psp-content-formula {
  margin: 12px 0;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  color: var(--psp-navy);
  border: 1px solid #d5dfeb;
  border-radius: 9px;
  background: #fff;
  text-align: center;
}
.psp-content-formula code { font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 1.08em; }
.psp-content-image { display: grid; gap: 7px; margin: 14px 0; justify-items: center; }
.psp-content-image img { display: block; width: auto; max-width: 100%; max-height: 480px; border-radius: 8px; }
.psp-content-image figcaption,
.psp-content-image > span { color: var(--psp-muted); font-size: 11px; text-align: center; }
.psp-content-table { max-width: 100%; margin: 14px 0; overflow: auto; border-radius: 8px; }
.psp-content-table table { width: 100%; min-width: 360px; border-collapse: collapse; background: #fff; white-space: normal; }
.psp-content-table caption { padding: 8px; color: var(--psp-navy); font-weight: 800; text-align: left; }
.psp-content-table th,
.psp-content-table td { padding: 9px 11px; border: 1px solid #d5dfeb; text-align: left; vertical-align: top; }
.psp-content-table th { color: var(--psp-navy); background: #edf3f9; }

.psp-question {
  max-width: 900px;
  margin: 0 0 28px;
  color: var(--psp-navy);
  font-size: clamp(20px, 2.8vw, 27px);
  line-height: 1.38;
}

.psp-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.psp-options {
  display: grid;
  gap: 10px;
}

.psp-option {
  display: grid;
  min-height: 60px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 11px 15px;
  color: #26364e;
  border: 1px solid #d9e1eb;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.psp-option:hover {
  border-color: #9eafc4;
  background: #fbfcfe;
}

.psp-option:has(input:checked) {
  border-color: var(--psp-blue);
  background: #f3f8fd;
  box-shadow: 0 0 0 3px rgba(23, 74, 126, .08);
}

.psp-option input,
.psp-confidence-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.psp-option-key {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--psp-navy);
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
}

.psp-option:has(input:checked) .psp-option-key {
  color: #fff;
  border-color: var(--psp-blue);
  background: var(--psp-blue);
}

.psp-option-label {
  min-width: 0;
  overflow-wrap: anywhere;
  display: grid;
  gap: 7px;
  font-size: 14px;
  line-height: 1.5;
}

.psp-option-label .psp-content-text,
.psp-option-label .psp-content-formula,
.psp-option-label .psp-content-image { margin: 0; }
.psp-option-label .psp-content-formula { padding: 7px 9px; text-align: left; }
.psp-option-label .psp-content-image { justify-items: start; }
.psp-option-label .psp-content-image img { max-height: 180px; }

.psp-confidence {
  margin-top: 30px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #f8fafc;
}

.psp-confidence legend {
  padding: 0;
  color: var(--psp-navy);
  font-size: 13px;
  font-weight: 900;
}

.psp-confidence > p {
  margin: 5px 0 14px;
  color: var(--psp-muted);
  font-size: 11px;
  line-height: 1.45;
}

.psp-confidence-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.psp-confidence-option {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px;
  color: #526078;
  border: 1px solid #d8e0ea;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  text-align: center;
}

.psp-confidence-option strong {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--psp-navy);
  border-radius: 50%;
  background: #eaf0f7;
  font-size: 11px;
}

.psp-confidence-option span {
  font-size: 10px;
  font-weight: 800;
}

.psp-confidence-option:has(input:checked) {
  color: var(--psp-navy);
  border-color: var(--psp-blue);
  background: #edf5fc;
  box-shadow: 0 0 0 2px rgba(23, 74, 126, .08);
}

.psp-confidence-option:has(input:checked) strong {
  color: #fff;
  background: var(--psp-blue);
}

.psp-inline-message {
  margin: 18px 0 0;
  padding: 11px 13px;
  color: #8a251d;
  border-radius: 9px;
  background: #fff1f0;
  font-size: 12px;
  line-height: 1.5;
}

.psp-inline-message[data-tone="info"] {
  color: #174a7e;
  background: #eef6ff;
}

.psp-question-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e6ebf1;
}

.psp-secondary-button,
.psp-primary-button,
.psp-submit-button {
  padding: 11px 17px;
}

.psp-secondary-button {
  color: var(--psp-navy);
  border: 1px solid #ced8e4;
  background: #fff;
}

.psp-primary-button {
  color: #fff;
  background: var(--psp-navy);
}

.psp-primary-button:hover {
  background: #153e70;
}

.psp-submit-button {
  color: #fff;
  background: var(--psp-red);
}

.psp-submit-button:hover {
  background: var(--psp-red-dark);
}

.psp-navigator {
  position: sticky;
  top: 16px;
  overflow: hidden;
}

.psp-navigator-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid #e5eaf0;
}

.psp-navigator-head > div {
  display: grid;
  gap: 3px;
}

.psp-navigator-head > div span {
  color: var(--psp-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.psp-navigator-head strong {
  color: var(--psp-navy);
  font-size: 18px;
}

.psp-navigator-key {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--psp-muted);
  font-size: 9px;
}

.psp-navigator-key i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--psp-success);
}

.psp-item-grid {
  display: grid;
  max-height: 330px;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  overflow: auto;
  padding: 17px;
}

.psp-item-button {
  position: relative;
  min-width: 0;
  min-height: 44px;
  padding: 5px;
  color: #667085;
  border: 1px solid #d8e0e9;
  border-radius: 8px;
  background: #fff;
  font-size: 11px;
}

.psp-item-button.is-answered::after {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--psp-success);
  content: "";
}

.psp-item-button.is-current {
  color: #fff;
  border-color: var(--psp-navy);
  background: var(--psp-navy);
  box-shadow: 0 4px 10px rgba(11, 35, 74, .18);
}

.psp-item-button.is-current::after {
  background: #9ae4ca;
}

.psp-submit-panel {
  padding: 17px;
  border-top: 1px solid #e5eaf0;
  background: #f8fafc;
}

.psp-submit-panel p {
  margin: 0 0 12px;
  color: var(--psp-muted);
  font-size: 11px;
  line-height: 1.5;
}

.psp-submit-panel button {
  width: 100%;
}

.psp-submit-panel small {
  display: block;
  margin-top: 8px;
  color: #8a94a5;
  font-size: 9px;
  text-align: center;
}

.psp-finish {
  display: grid;
  max-width: 620px;
  justify-items: center;
  margin: 90px auto;
  padding: 44px 30px;
  text-align: center;
}

.psp-finish-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--psp-success);
  box-shadow: 0 10px 25px rgba(8, 122, 85, .18);
  font-size: 26px;
  font-weight: 900;
}

.psp-finish > p:first-of-type {
  margin: 20px 0 4px;
  color: var(--psp-red-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
}

.psp-finish h2 {
  margin: 5px 0 10px;
  color: var(--psp-navy);
  font-size: clamp(24px, 4vw, 34px);
}

.psp-finish h2 + p {
  max-width: 530px;
  margin: 0 0 24px;
  color: var(--psp-muted);
  font-size: 14px;
  line-height: 1.65;
}

.psp-dialog {
  width: min(92vw, 480px);
  padding: 30px;
  color: var(--psp-ink);
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(6, 20, 44, .28);
  text-align: center;
}

.psp-dialog::backdrop {
  background: rgba(6, 20, 44, .68);
  backdrop-filter: blur(3px);
}

.psp-dialog-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 0 auto 14px;
  color: var(--psp-red);
  border-radius: 50%;
  background: #fff0f3;
  font-weight: 900;
}

.psp-dialog h2 {
  margin: 0 0 12px;
  color: var(--psp-navy);
  font-size: 23px;
}

.psp-dialog p {
  margin: 7px 0;
  color: var(--psp-muted);
  font-size: 13px;
  line-height: 1.55;
}

.psp-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

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

.psp-player button:disabled,
.psp-player input:disabled + * {
  cursor: not-allowed;
  opacity: .52;
}

.psp-player button:focus-visible,
.psp-player a:focus-visible,
.psp-option:has(input:focus-visible),
.psp-confidence-option:has(input:focus-visible),
.psp-question:focus-visible {
  outline: 3px solid #f2b632;
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .psp-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .psp-save-state {
    display: none;
  }

  .psp-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .psp-navigator {
    position: static;
  }

  .psp-item-grid {
    grid-template-columns: repeat(10, minmax(36px, 1fr));
  }
}

@media (max-width: 640px) {
  .psp-player {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .psp-header {
    min-height: 72px;
    gap: 8px;
    padding: 10px 12px;
  }

  .psp-exit-button {
    width: 44px;
    overflow: hidden;
    padding: 9px 12px;
    white-space: nowrap;
  }

  .psp-exit-button span {
    margin-right: 20px;
  }

  .psp-title-block > span {
    display: none;
  }

  .psp-title-block h1 {
    font-size: 13px;
  }

  .psp-timer {
    min-width: 91px;
    padding-left: 9px;
  }

  .psp-timer span {
    font-size: 8px;
  }

  .psp-timer strong {
    font-size: 15px;
  }

  .psp-connection {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 11px 14px;
  }

  .psp-connection p {
    width: calc(100% - 34px);
  }

  .psp-connection button {
    width: 100%;
  }

  .psp-progress-region {
    padding: 13px 15px 11px;
  }

  .psp-layout {
    gap: 12px;
    padding: 12px;
  }

  .psp-question-card {
    padding: 22px 16px 17px;
    border-radius: 13px;
  }

  .psp-question {
    margin-bottom: 22px;
    font-size: 19px;
  }

  .psp-stimulus {
    padding: 15px;
    font-size: 13px;
  }

  .psp-option {
    min-height: 58px;
    padding: 10px 11px;
  }

  .psp-confidence {
    margin-top: 23px;
    padding: 16px 12px;
  }

  .psp-confidence-grid {
    grid-template-columns: 1fr 1fr;
  }

  .psp-question-actions {
    position: sticky;
    z-index: 3;
    bottom: 0;
    margin: 24px -16px -17px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -8px 18px rgba(11, 35, 74, .06);
  }

  .psp-question-actions button {
    flex: 1;
    padding-inline: 9px;
  }

  .psp-item-grid {
    grid-template-columns: repeat(6, minmax(36px, 1fr));
  }

  .psp-dialog {
    padding: 25px 18px 20px;
  }

  .psp-dialog-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .psp-player *,
  .psp-player *::before,
  .psp-player *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  .psp-option:has(input:checked),
  .psp-confidence-option:has(input:checked),
  .psp-item-button.is-current {
    outline: 3px solid Highlight;
  }
}
