.eq-dialog {
  --eq-bg: #141a2a;
  --eq-panel: #1c2438;
  --eq-deep: #111625;
  --eq-line: #39425b;
  --eq-text: #f4f5fa;
  --eq-muted: #b5bdd1;
  --eq-lime: #c9fa6d;
  --eq-ink: #202c13;
  --eq-wash: #243729;
  --eq-pink: #ff9bb3;
  --eq-wrong: #3a2735;
  --eq-backdrop: #090d19da;
  --eq-mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --eq-max-height: min(92dvh, 850px);
  color-scheme: dark;
  color: var(--eq-text);
  background: var(--eq-bg);
  border: 1px solid var(--eq-line);
  border-radius: 16px;
  box-shadow: 0 24px 80px var(--eq-backdrop);
  box-sizing: border-box;
  margin: auto;
  padding: 0;
  inset: 0;
  width: min(580px, calc(100% - 32px));
  max-width: none;
  max-height: var(--eq-max-height);
  overflow: auto;
  overscroll-behavior: contain;
  font-family: inherit;
  text-align: left;
}
.eq-dialog:not([open]) { display: none; }
.eq-dialog::backdrop { background: var(--eq-backdrop, #090d19da); }
html.eq-modal-open { overflow-y: hidden; }
.eq-dialog *, .eq-dialog *::before, .eq-dialog *::after { box-sizing: border-box; }
.eq-dialog button { font: inherit; cursor: pointer; }
.eq-dialog button:disabled { cursor: default; }
.eq-dialog button:focus-visible, .eq-review-item > summary:focus-visible { outline: 2px solid var(--eq-lime); outline-offset: 3px; }
.eq-dialog h2:focus { outline: none; }
.eq-svg { width: 20px; height: 20px; flex: none; }
.eq-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 6px 16px 6px 25px;
  background: var(--eq-deep);
  border-bottom: 1px solid var(--eq-line);
}
.eq-bar > span { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 750; }
.eq-bar > span .eq-svg { width: 19px; color: var(--eq-lime); }
.eq-close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--eq-muted);
}
.eq-close:hover { color: var(--eq-text); background: var(--eq-panel); }
.eq-content { padding: clamp(20px, 4vw, 32px); }
.eq-progress-head { display: flex; justify-content: space-between; gap: 12px; color: var(--eq-muted); font-weight: 700; font-size: 12px; }
.eq-progress-head > span:last-child { font-family: var(--eq-mono); font-weight: 500; }
.eq-progress-head b { color: var(--eq-lime); }
.eq-progress { display: flex; gap: 5px; margin: 8px 0 26px; }
.eq-progress i { flex: 1; height: 4px; background: var(--eq-line); border-radius: 1px; }
.eq-progress i.eq-current { background: var(--eq-muted); }
.eq-progress i.eq-done { background: var(--eq-lime); }
.eq-content h2 { color: var(--eq-text); font-size: clamp(21px, 4vw, 29px); font-weight: 800; line-height: 1.5; letter-spacing: .025em; margin: 0; overflow-wrap: anywhere; min-width: 0; }
.eq-subject {
  background: var(--eq-panel);
  border: 1px solid var(--eq-line);
  border-left: 4px solid var(--eq-lime);
  border-radius: 5px;
  margin: 18px 0;
  padding: 16px 18px 18px;
}
.eq-context { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--eq-muted); letter-spacing: .04em; }
.eq-context .eq-svg { width: 15px; height: 15px; }
.eq-subject-name { font-size: clamp(25px, 5vw, 37px); line-height: 1.45; font-weight: 800; letter-spacing: .035em; overflow-wrap: anywhere; margin-top: 4px; }
.eq-subject-name small { font-size: .52em; font-weight: 650; margin-left: .25em; }
.eq-sequence .eq-subject-name { font-size: clamp(18px, 4vw, 25px); }
.eq-sequence .eq-subject-name span:not(.eq-sequence-arrow) { display: inline-block; }
.eq-sequence-arrow { color: var(--eq-lime); }
.eq-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.eq-dialog .eq-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 9px 12px;
  color: var(--eq-text);
  border: 1px solid var(--eq-line);
  border-radius: 7px;
  background: var(--eq-panel);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  overflow-wrap: anywhere;
}
.eq-option:not(:disabled):hover { border-color: var(--eq-lime); }
.eq-letter {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--eq-line);
  border-radius: 4px;
  background: var(--eq-deep);
  color: var(--eq-muted);
  font-family: var(--eq-mono);
  font-size: 11px;
}
.eq-show-location { overflow: hidden; }
.eq-show-location .eq-shell { max-height: calc(var(--eq-max-height) - 2px); display: flex; flex-direction: column; }
.eq-show-location .eq-bar, .eq-continue { flex: none; }
.eq-show-location .eq-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-block: 18px 6px; }
.eq-show-location .eq-progress { margin-bottom: 14px; }
.eq-feedback-heading { display: flex; align-items: baseline; gap: 7px 12px; flex-wrap: wrap; }
.eq-feedback-heading > span:last-child { min-width: 0; }
.eq-feedback-heading small { color: var(--eq-muted); font-size: .55em; font-weight: 600; }
.eq-verdict {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  background: var(--eq-wash);
  color: var(--eq-lime);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
  white-space: nowrap;
}
.eq-verdict .eq-svg { width: 16px; height: 16px; }
.eq-verdict.eq-missed { background: var(--eq-wrong); color: var(--eq-pink); }
.eq-your-answer, .eq-explanation { margin: 6px 0; color: var(--eq-muted); font-size: 13px; line-height: 1.6; }
.eq-your-answer { color: var(--eq-pink); }
.eq-explanation { margin-bottom: 14px; }
.eq-continue { display: flex; justify-content: flex-end; padding: 12px clamp(20px, 4vw, 32px) 16px; }
.eq-copy { color: var(--eq-muted); font-size: 14px; line-height: 1.8; }
.eq-copy { margin: 12px 0 24px; }
.eq-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eq-dialog .eq-primary, .eq-dialog .eq-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 19px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
  line-height: 1.4;
}
.eq-primary { border: 1px solid var(--eq-lime); background: var(--eq-lime); color: var(--eq-ink); }
.eq-primary:hover { filter: brightness(1.07); }
.eq-primary .eq-svg { width: 17px; height: 17px; }
.eq-secondary { border: 1px solid var(--eq-line); background: var(--eq-panel); color: var(--eq-text); }
.eq-secondary:hover { border-color: var(--eq-muted); }
.eq-result-heading { display: flex; align-items: center; gap: 10px; }
.eq-result-heading > .eq-svg { width: 26px; height: 26px; color: var(--eq-lime); }
.eq-score { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 24px; line-height: 1.22; color: var(--eq-muted); }
.eq-score b { font-family: var(--eq-mono); font-size: 64px; font-weight: 750; color: var(--eq-lime); }
.eq-result-label { font-size: 13px; margin: 0; color: var(--eq-muted); }
.eq-summary-list { list-style: none; margin: 5px 0 24px; padding: 0; }
.eq-summary-list > li { border-bottom: 1px solid var(--eq-line); font-size: 14px; }
.eq-review-item > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 8px 0;
  list-style: none;
  cursor: pointer;
}
.eq-review-item > summary::-webkit-details-marker { display: none; }
.eq-map-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--eq-muted); font-size: 11px; white-space: nowrap; }
.eq-map-toggle::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translateY(-2px); }
.eq-review-item[open] > summary .eq-map-toggle::after { transform: rotate(225deg) translate(-2px,-1px); }
.eq-review-item > summary:hover .eq-map-toggle, .eq-review-item[open] .eq-map-toggle { color: var(--eq-lime); }
.eq-revisit { padding: 0 0 12px; }
.eq-recap { display: grid; gap: 2px; font-size: 13px; line-height: 1.6; margin: 0 0 8px; }
.eq-recap span { color: var(--eq-pink); }
.eq-result-icon { color: var(--eq-lime); display: inline-flex; flex: none; }
.eq-result-icon .eq-svg { width: 16px; height: 16px; }
.eq-result-icon.eq-missed { color: var(--eq-pink); }
.eq-storage { margin: 15px 0 0; font-size: 12px; line-height: 1.65; color: var(--eq-pink); }
@media (max-width: 540px) {
  .eq-dialog { --eq-max-height: 94dvh; width: calc(100% - 20px); border-radius: 12px; }
  .eq-content { padding: 18px; }
  .eq-bar { min-height: 48px; padding: 2px 8px 2px 18px; }
  .eq-choices { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .eq-dialog .eq-option { min-height: 46px; }
  .eq-progress { margin-bottom: 17px; }
  .eq-subject { margin: 12px 0; padding: 12px 14px; }
  .eq-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .eq-show-location .eq-content { padding: 12px 15px 4px; }
  .eq-show-location .eq-progress { margin: 5px 0 10px; }
  .eq-feedback-heading { gap: 4px 8px; }
  .eq-continue { padding: 7px 15px 12px; }
  .eq-continue .eq-primary { width: 100%; }
}

/* Keep the map above its range controls when vertical space is limited. */
@media (orientation: landscape) and (max-height: 540px),
       (orientation: portrait) and (max-height: 700px) {
  .eq-show-location .gl-card { display: flex; flex-direction: column; align-self: start; }
  .eq-show-location .gl-head { order: -2; align-items: center; padding: 5px 10px; gap: 2px 6px; }
  .eq-show-location .gl-head > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; }
  .eq-show-location .gl-head h3 { font-size: 17px; margin: 0; }
  .eq-show-location .gl-district { padding: 2px 5px; font-size: 11px; }
  .eq-show-location .gl-picture { order: -1; }
  .eq-show-location .gl-card p.gl-distance { margin: 5px 10px; }
  .eq-show-location .gl-switch { margin: 0 10px 2px; }
}

@media (orientation: landscape) and (max-height: 540px) {
  .eq-dialog.eq-show-location { --eq-max-height: calc(100dvh - 12px); width: min(880px, calc(100% - 20px)); }
  .eq-show-location .eq-bar { min-height: 40px; padding: 0 8px 0 16px; }
  .eq-show-location .eq-content {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    grid-template-rows: auto auto auto auto minmax(min-content, 1fr);
    align-items: start;
    align-content: start;
    column-gap: clamp(12px, 3vw, 24px);
    padding: 9px 16px 5px;
  }
  .eq-show-location .eq-progress-head { grid-area: 1 / 1; }
  .eq-show-location .eq-progress { grid-area: 2 / 1; margin: 5px 0 12px; }
  .eq-show-location .eq-feedback-heading { grid-area: 3 / 1; font-size: 21px; gap: 3px 7px; }
  .eq-show-location .eq-your-answer { grid-area: 4 / 1; }
  .eq-show-location .eq-explanation { grid-area: 5 / 1; }
  .eq-show-location .gl-card { grid-area: 1 / 2 / 6 / 3; }
  .eq-show-location .gl-map { max-height: min(215px, calc(100dvh - 175px)); }
  .eq-show-location .eq-storage { grid-column: 1 / -1; }
  .eq-show-location .eq-continue { padding: 4px 16px 7px; }
  .eq-show-location .eq-continue .eq-primary { min-height: 42px; }
}
