/* Shared quiz navigation: labels-only dimension tabs, not a second progress panel. */
.quiz-section-navigation {
  --quiz-nav-ink: var(--text, var(--ink, #2b211b));
  --quiz-nav-muted: var(--text3, var(--muted, #766a63));
  --quiz-nav-line: var(--border, var(--line, rgba(43, 33, 27, .16)));
  --quiz-nav-accent: var(--gold, var(--accent, #c9954a));
  --quiz-nav-surface: var(--bg, transparent);
  --quiz-nav-active-ink: #1a1200;
  box-sizing: border-box;
  width: 100%;
  margin: 6px 0 10px;
  color: var(--quiz-nav-ink);
  font: inherit;
}
.quiz-section-navigation[hidden] { display: none !important; }
.quiz-section-navigation__grid {
  display: grid;
  grid-template-columns: repeat(var(--quiz-nav-columns, 3), minmax(0, 1fr));
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
}
.quiz-section-navigation__section,
.quiz-section-navigation .dtab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  height: 36px;
  padding: 5px 9px;
  border: 1px solid var(--quiz-nav-line);
  border-radius: 999px;
  background: var(--quiz-nav-surface);
  color: var(--quiz-nav-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.quiz-section-navigation__section:hover,
.quiz-section-navigation .dtab:hover {
  border-color: var(--quiz-nav-accent);
  color: var(--quiz-nav-ink);
}
.quiz-section-navigation__section.is-current,
.quiz-section-navigation .dtab.is-current {
  border-color: var(--quiz-nav-accent);
  background: var(--quiz-nav-accent);
  color: var(--quiz-nav-active-ink);
  font-weight: 700;
}
.quiz-section-navigation__progress {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--quiz-nav-line) 70%, transparent);
}
.quiz-section-navigation__progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--quiz-nav-accent);
  transition: width .18s ease;
}
/* Current question + estimated time left, directly under the progress bar. */
.quiz-section-navigation__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--text2, var(--ink2, #5f5549));
  font-size: 12px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.quiz-section-navigation__counter b {
  color: var(--quiz-nav-ink);
  font-size: 13px;
  font-weight: 800;
}
.quiz-section-navigation__eta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--quiz-nav-muted);
}
.quiz-section-navigation__eta svg {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
/* Long full names wrap onto two lines rather than being cut off. */
.quiz-section-navigation.is-wrapping .quiz-section-navigation__section,
.quiz-section-navigation.is-wrapping .dtab {
  height: auto !important;
  white-space: normal !important;
  text-overflow: clip !important;
}
.quiz-section-navigation__notice {
  margin-top: 6px;
  color: var(--quiz-nav-muted);
  font-size: 11px;
  line-height: 1.4;
}
.quiz-section-navigation__notice[hidden] { display: none !important; }
.quiz-section-navigation__live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.quiz-section-navigation :focus-visible {
  outline: 3px solid color-mix(in srgb, var(--quiz-nav-accent) 70%, white);
  outline-offset: 2px;
}

/* The previous index/visited bars disappear once answer-driven navigation mounts. */
.has-quiz-section-navigation [data-navigation-legacy] { display: none !important; }

/* All process screens use a viewport-bounded shell with a scrollable question area. */
body.has-quiz-section-navigation:has(#sq.sc.on),
body.has-quiz-section-navigation:has(.screen--quiz:not([hidden])),
body.has-quiz-section-navigation:has(.quiz-screen.is-active),
body.has-quiz-section-navigation:has(#s1.sc.on),
body.has-quiz-section-navigation:has(#screen-quiz.screen.active) {
  overflow: hidden;
}
body.has-quiz-section-navigation:has(#sq.sc.on) [data-site-footer],
body.has-quiz-section-navigation:has(.screen--quiz:not([hidden])) [data-site-footer],
body.has-quiz-section-navigation:has(.quiz-screen.is-active) [data-site-footer],
body.has-quiz-section-navigation:has(#s1.sc.on) [data-site-footer],
body.has-quiz-section-navigation:has(#screen-quiz.screen.active) [data-site-footer] {
  display: none !important;
}

/* MBTI and Soccer already provide qwrap/quiz-scroll/qnav; this keeps that shell
   on the dynamic viewport unit and removes the old heavy nav treatment. */
body.has-quiz-section-navigation:has(#sq.sc.on) #sq.sc.on {
  height: 100dvh !important;
  min-height: 100dvh !important;
}
body.has-quiz-section-navigation:has(#sq.sc.on) #sq.sc.on .quiz-topbar {
  padding: 10px 16px 8px;
}
body.has-quiz-section-navigation:has(#sq.sc.on) #sq.sc.on .quiz-topbar > .screen-back,
body.has-quiz-section-navigation:has(#sq.sc.on) #sq.sc.on .quiz-topbar .screen-back {
  margin-bottom: 7px;
}
body.has-quiz-section-navigation:has(#sq.sc.on) #sq.sc.on .quiz-scroll {
  padding: 14px 16px 20px;
}
body.has-quiz-section-navigation:has(#sq.sc.on) #sq.sc.on .qnav {
  padding: 8px 16px max(8px, env(safe-area-inset-bottom));
}

/* Dog Parent: fixed header/tabs/footer with the question body as the only scrollport. */
body.has-quiz-section-navigation:has(.screen--quiz:not([hidden])) .screen--quiz:not([hidden]) {
  position: fixed !important;
  inset: 0;
  top: var(--site-header-offset, 0px);
  z-index: 30;
  display: flex !important;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: auto !important;
  min-height: 0 !important;
  bottom: 0;
  margin: 0;
  padding: max(10px, env(safe-area-inset-top)) 16px 0;
  overflow: hidden;
}
body.has-quiz-section-navigation:has(.screen--quiz:not([hidden])) .screen--quiz:not([hidden]) .quiz__header {
  flex: 0 0 auto;
}
body.has-quiz-section-navigation:has(.screen--quiz:not([hidden])) .screen--quiz:not([hidden]) .quiz-section-navigation {
  flex: 0 0 auto;
}
body.has-quiz-section-navigation:has(.screen--quiz:not([hidden])) .screen--quiz:not([hidden]) .quiz-question-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 18px;
  overscroll-behavior: contain;
}
body.has-quiz-section-navigation:has(.screen--quiz:not([hidden])) .screen--quiz:not([hidden]) .quiz__nav {
  flex: 0 0 auto;
  margin: 0 -16px;
  padding: 8px 16px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg, #fdf6f3) 94%, white);
}

/* Owner and Love Language have an existing question panel/card we can turn
   into the middle scrollport without changing their app state machine. */
body.has-quiz-section-navigation:has(.quiz-screen.is-active) .quiz-screen.is-active,
body.has-quiz-section-navigation:has([data-screen="quiz"]:not([hidden])) .quiz-screen[data-screen="quiz"]:not([hidden]) {
  position: fixed !important;
  inset: 0;
  top: var(--site-header-offset, 0px);
  z-index: 30;
  display: flex !important;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: auto !important;
  min-height: 0 !important;
  bottom: 0;
  margin: 0;
  padding: max(10px, env(safe-area-inset-top)) 16px 0;
  overflow: hidden;
}
body.has-quiz-section-navigation:has(.quiz-screen.is-active) .quiz-screen.is-active .quiz-top,
body.has-quiz-section-navigation:has([data-screen="quiz"]:not([hidden])) .quiz-screen[data-screen="quiz"]:not([hidden]) .quiz-top {
  flex: 0 0 auto;
}
body.has-quiz-section-navigation:has(.quiz-screen.is-active) .quiz-screen.is-active .question-panel,
body.has-quiz-section-navigation:has([data-screen="quiz"]:not([hidden])) .quiz-screen[data-screen="quiz"]:not([hidden]) .question-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 0;
  overscroll-behavior: contain;
}
body.has-quiz-section-navigation:has(.quiz-screen.is-active) .quiz-screen.is-active .quiz-nav,
body.has-quiz-section-navigation:has([data-screen="quiz"]:not([hidden])) .quiz-screen[data-screen="quiz"]:not([hidden]) .quiz-actions {
  flex: 0 0 auto;
  margin: 0 -16px;
  padding: 8px 16px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper, #fffaf5) 94%, white);
}

/* Lightweight mini quizzes have no existing internal shell, so their active
   question screen becomes the viewport shell and the wrapped question body scrolls. */
body.has-quiz-section-navigation:has(#s1.sc.on) #s1.sc.on,
body.has-quiz-section-navigation:has(#screen-quiz.screen.active) #screen-quiz.screen.active {
  position: fixed !important;
  inset: 0;
  top: var(--site-header-offset, 0px);
  z-index: 30;
  display: flex !important;
  flex-direction: column;
  width: min(520px, 100%);
  height: auto !important;
  min-height: 0 !important;
  bottom: 0;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px 0;
  overflow: hidden;
  background: var(--color-background-primary, #fff);
}
body.has-quiz-section-navigation:has(#s1.sc.on) #s1.sc.on .quiz-section-navigation,
body.has-quiz-section-navigation:has(#screen-quiz.screen.active) #screen-quiz.screen.active .quiz-section-navigation {
  flex: 0 0 auto;
}
body.has-quiz-section-navigation:has(#s1.sc.on) #s1.sc.on .quiz-question-scroll,
body.has-quiz-section-navigation:has(#screen-quiz.screen.active) #screen-quiz.screen.active .quiz-question-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 18px;
  overscroll-behavior: contain;
}
body.has-quiz-section-navigation:has(#s1.sc.on) #s1.sc.on .nav,
body.has-quiz-section-navigation:has(#screen-quiz.screen.active) #screen-quiz.screen.active .q-nav {
  flex: 0 0 auto;
  margin: 0 -16px;
  padding: 8px 16px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border-secondary, rgba(0,0,0,.12));
  background: var(--color-background-primary, #fff);
}
body.has-quiz-section-navigation:has(#s1.sc.on) #s1.sc.on .bk,
body.has-quiz-section-navigation:has(#screen-quiz.screen.active) #screen-quiz.screen.active .btn-back {
  flex: 0 0 auto;
  min-width: 80px;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .quiz-section-navigation__section,
  .quiz-section-navigation .dtab { padding-inline: 7px; }
}
@media (max-width: 359px) {
  .quiz-section-navigation__grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .quiz-section-navigation__grid::-webkit-scrollbar { display: none; }
  .quiz-section-navigation__section,
  .quiz-section-navigation .dtab {
    flex: 0 0 auto;
    width: auto;
    min-width: 84px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .quiz-section-navigation__progress-fill { transition: none; }
}
