body:has(.qz-dialog[open]) { overflow: hidden; }

dialog.qz-dialog {
  --qz-ink: #143f34;
  --qz-muted: #476359;
  --qz-page: #f9f8f0;
  --qz-lime: #d9f773;
  --qz-line: #bbcabd;
  --qz-paper: #fffef9;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  box-sizing: border-box;
  overflow: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--qz-ink);
  background: var(--qz-page);
  font-family: 'PingFang HK', 'Noto Sans HK', 'Microsoft JhengHei', sans-serif;
  line-height: 1.5;
  text-align: start;
}

.qz-dialog *, .qz-dialog *::after, .qz-dialog *::before { box-sizing: border-box; }
.qz-dialog::backdrop { background: #173a32e8; }
.qz-dialog :where(h2,h3,h4,p,dl,dt,dd) { margin: 0; }
.qz-dialog button, .qz-dialog select { cursor: pointer; font: inherit; }
.qz-dialog button { letter-spacing: 0; }
.qz-dialog svg { display: block; flex: none; width: 1.25em; height: 1.25em; }
.qz-dialog :focus-visible { outline: 3px solid #277092; outline-offset: 4px; }
.qz-dialog [tabindex="-1"]:focus { outline: none; }
.qz-shell { min-height: 100%; }

.qz-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px max(4vw, calc((100vw - 1240px) / 2)) 12px;
  background: var(--qz-ink);
  color: var(--qz-page);
}

.qz-brand, .qz-controls { display: flex; align-items: center; gap: 12px; }
.qz-brand h2 { font-size: clamp(17px, 2vw, 25px); font-weight: 800; white-space: nowrap; margin: 0; line-height: 1.3; }
.qz-badge { display: grid; place-items: center; color: var(--qz-lime); width: 34px; height: 34px; border: 1px solid #f1ffbb62; border-radius: 50%; }
.qz-badge svg { width: 20px; height: 20px; }
.qz-picker { position: relative; display: flex; align-items: center; min-width: 0; }
.qz-picker select {
  appearance: none;
  width: 100%;
  max-width: min(42vw, 380px);
  text-overflow: ellipsis;
  height: 44px;
  padding: 0 36px 0 13px;
  border: 1px solid #ecf7d451;
  border-radius: 9px;
  color: var(--qz-page);
  background: var(--qz-ink);
  font-size: 15px;
}
.qz-picker svg { width: 16px; height: 16px; position: absolute; right: 12px; pointer-events: none; }
.qz-close, .qz-plain, .qz-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 99px; font-weight: 750 !important; white-space: nowrap; }
.qz-close { height: 44px; padding: 0 14px; border: 0; background: transparent; color: var(--qz-page); }
.qz-close:hover { background: #f0ffd31a; }
.qz-stage { max-width: 1192px; padding: clamp(20px, 4vh, 50px) clamp(16px, 4vw, 62px) 42px; margin: 0 auto; }
.qz-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
.qz-lesson { font-size: clamp(15px, 1.6vw, 21px); }
.qz-count { flex: none; font-variant-numeric: tabular-nums; color: var(--qz-muted); font-size: clamp(13px, 1.4vw, 17px); }
.qz-track { height: 5px; background: #dce3d9; border-radius: 5px; margin: 13px 0 clamp(22px, 3.7vh, 46px); overflow: hidden; }
.qz-track i { display: block; height: 100%; min-width: 3px; background: #528541; border-radius: 5px; transition: width .25s ease-out; }
.qz-problem { margin: 0 0 clamp(20px, 3.6vh, 40px); }
.qz-with-visual { display: flex; gap: 3vw; align-items: center; }
.qz-visual { display: block; flex: 0 1 auto; width: 30%; max-height: min(25vh, 230px); object-fit: contain; border-radius: 10px; }
.qz-question { flex: 1 1 auto; color: var(--qz-ink); font-weight: 800; font-size: clamp(26px, min(3.6vw, 5.2vh), 52px); line-height: 1.4; letter-spacing: -.028em; overflow-wrap: anywhere; margin: 0; }
.qz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qz-options[hidden] { display: none; }
.qz-dialog .qz-toggle-options {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin: 0 0 10px;
  padding: 5px 15px;
  border: 1px solid var(--qz-line);
  border-radius: 99px;
  background: transparent;
  color: var(--qz-ink);
  font-size: 15px;
  font-weight: 650;
}
.qz-dialog .qz-toggle-options:hover { border-color: var(--qz-ink); background: #e9f0df; }
.qz-choice {
  display: flex;
  align-items: center;
  text-align: start;
  min-width: 0;
  min-height: clamp(70px, 11vh, 112px);
  gap: clamp(10px, 1.3vw, 18px);
  padding: 14px clamp(12px, 1.7vw, 23px);
  border: 2px solid var(--qz-line);
  border-radius: 14px;
  background: var(--qz-paper);
  color: var(--qz-ink);
  box-shadow: none;
  transition: background .16s, border-color .16s;
}
.qz-choice:hover:enabled { border-color: #48806a; background: #f1f5e8; }
.qz-choice:disabled { opacity: 1; cursor: default; color: var(--qz-ink); }
.qz-letter { display: grid; place-items: center; flex: none; width: clamp(32px, 3.7vw, 48px); aspect-ratio: 1; border: 1px solid #cad5c9; border-radius: 50%; background: #eef1e7; color: var(--qz-ink); font-family: 'Barlow', 'Helvetica Neue', sans-serif; font-size: clamp(16px, 2vw, 24px); font-weight: 750; }
.qz-choice-text { font-size: clamp(19px, min(2vw, 3.6vh), 30px); font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.qz-choice.qz-selected { border-color: var(--qz-ink); background: #edf5db; }
.qz-choice.qz-selected .qz-letter, .qz-choice.qz-correct .qz-letter { background: var(--qz-ink); color: white; border-color: var(--qz-ink); }
.qz-choice.qz-correct { border-color: #437246; background: #e4f4bd; }
.qz-choice.qz-incorrect { border-color: #ae6e57; background: #fff2e6; }
.qz-choice-mark { display: flex; align-items: center; flex: none; gap: 2px; margin-inline-start: auto; font-size: clamp(11px, 1.18vw, 15px); color: var(--qz-ink); font-weight: 800; }
.qz-choice-mark:empty { display: none; }
.qz-choice-mark svg { width: 15px; height: 15px; }
.qz-feedback { border-inline-start: 5px solid #345d3c; margin-top: 20px; padding: 12px 20px; background: #ebf2dd; border-radius: 0 10px 10px 0; }
.qz-feedback h4 { display: flex; align-items: center; gap: 7px; font-size: clamp(16px, 1.6vw, 22px); font-weight: 800; margin: 0 0 3px; }
.qz-feedback h4 svg { width: 18px; }
.qz-feedback p { font-size: clamp(17px, 1.8vw, 25px); line-height: 1.55; }
.qz-animate { animation: qz-reveal .28s ease-out both; }
@keyframes qz-reveal { from { opacity: .15; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.qz-nav, .qz-summary-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: clamp(17px, 3vh, 32px); }
.qz-plain, .qz-primary { min-height: 50px; padding: 10px 22px; font-size: clamp(16px, 1.55vw, 21px) !important; }
.qz-plain { color: var(--qz-ink); border: 1px solid var(--qz-line); background: transparent; }
.qz-plain:hover:enabled { background: #e8ede2; }
.qz-plain:disabled { opacity: .45; cursor: default; }
.qz-primary { color: var(--qz-lime); border: 2px solid var(--qz-ink); background: var(--qz-ink); }
.qz-primary:hover { background: #225444; }
.qz-primary:active, .qz-plain:active:enabled { transform: translateY(1px); }
.qz-summary { max-width: 790px; margin: clamp(24px, 6vh, 80px) auto; }
.qz-summary h3 { font-size: clamp(34px, 5vw, 66px); letter-spacing: -.035em; line-height: 1.25; }
.qz-summary-range { margin-top: 12px; font-weight: 650; color: var(--qz-muted); font-size: clamp(16px, 2vw, 23px); }
.qz-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: clamp(24px, 5vh, 62px) 0; gap: 10px; }
.qz-stat { padding: clamp(12px, 2vw, 26px); border-radius: 12px; background: #e6ebde; }
.qz-stat-correct { background: var(--qz-lime); }
.qz-stat-incorrect { background: #f6e4d8; }
.qz-stat dt { font-size: clamp(14px, 1.8vw, 21px); font-weight: 650; }
.qz-stat dd { margin: 0; font-family: 'Barlow', 'Helvetica Neue', sans-serif; font-size: clamp(40px, 6vw, 78px); font-weight: 750; line-height: 1.25; }
.qz-empty { font-size: clamp(23px, 3vw, 36px); }

@media (max-width: 650px) {
  .qz-head { padding: 8px 14px; gap: 8px; }
  .qz-brand { gap: 7px; }
  .qz-badge { height: 29px; width: 29px; }
  .qz-controls { gap: 5px; }
  .qz-close { width: 44px; height: 44px; padding: 0; border: 1px solid #ecf7d451; }
  .qz-close span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .qz-picker select { font-size: 13px; padding-inline: 8px 27px; }
  .qz-picker svg { right: 8px; }
  .qz-options { grid-template-columns: 1fr; gap: 8px; }
  .qz-choice { min-height: 58px; padding: 10px 13px; border-radius: 10px; }
  .qz-with-visual { flex-direction: column; align-items: start; }
  .qz-visual { width: auto; max-width: 100%; max-height: 160px; align-self: center; }
  .qz-info { align-items: baseline; gap: 5px; flex-wrap: wrap; }
  .qz-choice-mark { font-size: 12px; }
  .qz-feedback { margin-top: 14px; padding: 10px 13px; }
  .qz-stage { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
@media (max-height: 700px) and (min-width: 651px) {
  .qz-head { padding-top: 6px; padding-bottom: 6px; }
  .qz-stage { padding-top: 15px; padding-bottom: 20px; }
  .qz-track { margin-bottom: 15px; }
  .qz-problem { margin-bottom: 15px; }
  .qz-choice { min-height: 58px; padding-block: 9px; }
  .qz-feedback { margin-top: 12px; }
  .qz-nav { margin-top: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .qz-dialog *, .qz-dialog *::after, .qz-dialog *::before { animation: none !important; transition: none !important; }
}
