/* Test series / Open Mock page */

.ts-body {
  padding-top: var(--sticky-top);
}

body.ts-exam-active {
  overflow-x: hidden;
}

#examBottomBar[hidden] {
  display: none !important;
}

.ts-hero h1 {
  margin-bottom: 10px;
}

.ts-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.ts-stat {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ts-stat strong {
  font-size: 1.25rem;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.ts-stat span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.25;
}

.ts-steps {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--ink);
}

.ts-pattern-list li::before {
  content: "◆";
  font-size: 0.65rem;
}

.ts-benefit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ts-benefit {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ts-benefit strong {
  color: var(--navy);
}

.ts-benefit span {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}

.ts-register-card {
  max-width: 520px;
  margin: 0 auto;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-weight: 700;
  color: var(--navy);
  font-size: 0.88rem;
}

.field input {
  border: 1px solid rgba(11, 31, 58, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
}

.field input:focus {
  outline: 2px solid rgba(10, 132, 255, 0.35);
  border-color: transparent;
}

.ts-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  margin: 8px 0 16px;
}

.ts-check input {
  margin-top: 3px;
}

/* Exam chrome */
.ts-exam-view {
  padding-top: 0;
}

.ts-exam-top {
  position: sticky;
  top: var(--sticky-top);
  z-index: 40;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 24px rgba(10, 132, 255, 0.08);
}

.ts-exam-top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  min-height: 56px;
}

.ts-exam-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ts-exam-meta strong {
  color: var(--navy);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-exam-meta span {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.ts-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--navy);
  background: linear-gradient(135deg, #ffd60a, #ff9f0a);
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(255, 214, 10, 0.35);
}

.ts-timer.warn {
  background: linear-gradient(135deg, #ff9f0a, #ff375f);
  color: #fff;
}

.ts-timer.critical {
  background: linear-gradient(135deg, #ff375f, #bf5af2);
  color: #fff;
  animation: pulse 1s ease infinite;
}

@keyframes pulse {
  50% {
    transform: scale(1.04);
  }
}

.ts-submit-btn {
  padding: 10px 16px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 132px;
}

.ts-exam-layout {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  gap: 14px;
  padding-top: 14px;
  padding-bottom: 110px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.ts-palette {
  position: sticky;
  top: calc(var(--sticky-top) + 70px);
  max-height: calc(100vh - var(--sticky-top) - 160px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px;
  align-self: start;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.ts-palette-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.ts-palette-btn {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid rgba(11, 31, 58, 0.12);
  background: rgba(255, 255, 255, 0.75);
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--navy);
  box-sizing: border-box;
  padding: 0;
}

.ts-palette-btn.answered {
  background: rgba(48, 209, 88, 0.25);
  border-color: rgba(48, 209, 88, 0.55);
}

.ts-palette-btn.marked {
  background: rgba(255, 159, 10, 0.28);
  border-color: rgba(255, 159, 10, 0.6);
}

.ts-palette-btn.answered.marked {
  background: linear-gradient(135deg, rgba(48, 209, 88, 0.3), rgba(255, 159, 10, 0.35));
}

.ts-palette-btn.current {
  outline: 2px solid #0a84ff;
  outline-offset: 1px;
}

.ts-sec-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ts-sec-tab {
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  cursor: pointer;
  color: var(--navy);
}

.ts-sec-tab.active {
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  color: #fff;
  border-color: transparent;
}

.ts-q-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 10px;
}

.ts-q-num {
  font-weight: 900;
  color: var(--navy);
  font-size: 1.05rem;
}

.ts-q-topic {
  font-size: 0.78rem;
  font-weight: 700;
  color: #5e5ce6;
  background: rgba(94, 92, 230, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
}

.ts-q-text {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.45;
  color: var(--ink);
}

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

.ts-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  border: 1px solid rgba(11, 31, 58, 0.1);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 16px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}

.ts-option:hover {
  border-color: rgba(10, 132, 255, 0.4);
}

.ts-option.selected {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.16), rgba(191, 90, 242, 0.14));
  box-shadow: 0 8px 20px rgba(10, 132, 255, 0.12);
}

.ts-option .opt-key {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  background: rgba(11, 31, 58, 0.08);
  color: var(--navy);
}

.ts-option.selected .opt-key {
  background: linear-gradient(135deg, #0a84ff, #bf5af2);
  color: #fff;
}

.ts-q-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.ts-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.ts-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: rgba(11, 31, 58, 0.15);
  margin-right: 4px;
  vertical-align: middle;
}

.ts-legend .dot.answered {
  background: #30d158;
}
.ts-legend .dot.marked {
  background: #ff9f0a;
}
.ts-legend .dot.current {
  background: #0a84ff;
}

/* Results */
.ts-results-hero {
  text-align: center;
}

.ts-score-big {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 10px;
}

.ts-score-big strong {
  font-size: clamp(2.8rem, 10vw, 4rem);
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #ff375f, #bf5af2 50%, #0a84ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ts-score-big span {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--muted);
}

.ts-sec-scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
  text-align: left;
}

.ts-sec-score {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.ts-sec-score strong {
  display: block;
  color: var(--navy);
  margin-bottom: 6px;
}

.ts-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(11, 31, 58, 0.08);
  overflow: hidden;
  margin-bottom: 6px;
}

.ts-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff, #bf5af2);
}

.ts-sec-score span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.ts-weak-list {
  display: grid;
  gap: 8px;
}

.ts-weak-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 650;
}

.ts-weak-item .miss {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 800;
  color: #ff375f;
  background: rgba(255, 55, 95, 0.1);
  padding: 4px 8px;
  border-radius: 999px;
}

.ts-convert-card .price-box {
  justify-content: center;
}

.ts-review-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ts-chip {
  border: 1px solid rgba(11, 31, 58, 0.12);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 800;
  cursor: pointer;
  color: var(--navy);
}

.ts-chip.active {
  background: var(--navy);
  color: #fff;
  border-color: transparent;
}

.ts-review-list {
  display: grid;
  gap: 10px;
}

.ts-review-item {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 12px 14px;
}

.ts-review-item.ok {
  border-color: rgba(48, 209, 88, 0.4);
}
.ts-review-item.bad {
  border-color: rgba(255, 55, 95, 0.35);
}
.ts-review-item.skip {
  border-color: rgba(142, 142, 147, 0.35);
}

.ts-review-item h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: var(--navy);
}

.ts-review-item p {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.ts-review-meta {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.ts-review-explain {
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--ink);
  background: rgba(10, 132, 255, 0.08);
  border-radius: 12px;
  padding: 8px 10px;
}

/* Confirm modal */
.ts-confirm {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.ts-confirm[hidden] {
  display: none !important;
}

.ts-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 31, 58, 0.45);
  backdrop-filter: blur(4px);
}

.ts-confirm-card {
  position: relative;
  z-index: 1;
  max-width: 420px;
  width: 100%;
}

/* Sticky exam actions — Submit always reachable after starting the test */
.ts-exam-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-top: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 -10px 28px rgba(10, 132, 255, 0.12);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
}

.ts-exam-bottom-inner {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 1.3fr;
  gap: 8px;
}

.ts-exam-bottom .btn {
  padding: 12px 10px;
  font-size: 0.88rem;
}

.ts-submit-btn-bottom {
  box-shadow: 0 10px 22px rgba(255, 55, 95, 0.28);
}

@media (max-width: 860px) {
  .ts-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ts-benefit-grid,
  .ts-sec-scores,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .ts-exam-layout {
    grid-template-columns: 1fr;
    padding-top: 10px;
    padding-bottom: 120px;
  }

  /* Palette first so navigation is visible without hunting */
  .ts-palette {
    position: static;
    max-height: none;
    order: 1;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .ts-question-pane {
    order: 2;
    min-width: 0;
  }

  .ts-palette-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }

  .ts-palette-btn {
    min-height: 48px;
    font-size: 0.85rem;
  }

  /* Avoid double-sticky overlap with fixed topbar on small screens */
  .ts-exam-top {
    position: static;
  }

  .ts-exam-top-inner {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .ts-exam-meta {
    flex: 1 1 100%;
  }

  .ts-timer {
    font-size: 0.95rem;
    padding: 8px 10px;
  }

  .ts-submit-btn {
    flex: 1;
    min-width: 0;
  }

  .ts-exam-bottom-inner {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }

  .ts-exam-bottom .btn {
    padding: 12px 8px;
    font-size: 0.82rem;
  }

  .ts-submit-btn-bottom {
    grid-column: 1 / -1;
    min-height: 46px;
  }
}
