/* Completion controls are only shown on the last step. */
[hidden] { display: none !important; }
body.certification-active > .app { visibility: hidden; }
.app-dialog.test-dialog { width: min(560px, calc(100vw - 32px)); }
.test-dialog h3 { font-size: 23px; line-height: 1.35; margin: 0 0 20px; font-weight: 600; letter-spacing: -.4px; outline: none; }
.test-dialog p { color: var(--muted); font-size: 14px; }
.test-dialog .test-phase { color: #56725c; font-size: 11px; font-weight: 650; letter-spacing: 1px; text-transform: uppercase; margin: 0 0 16px; }
#test-options { display: grid; gap: 10px; padding: 0; border: 0; margin: 0; min-width: 0; }
.test-option { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid #d1dccf; border-radius: 9px; cursor: pointer; font-size: 14px; line-height: 1.5; }
.test-option:hover { background: #f0f4eb; }
.test-option:has(input:checked) { background: #e8f0e2; border-color: #658665; }
.test-option:has(input:focus-visible) { outline: 3px solid #2c6d9e; outline-offset: 2px; }
.test-option input { accent-color: var(--accent); margin: 4px 0 0; flex-shrink: 0; }
.test-navigation, .test-result-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; }
.test-navigation .certificate-button, .test-result-actions .certificate-button { width: auto; }
.test-navigation button:disabled { opacity: .45; cursor: default; }
.test-dialog .test-score { color: var(--accent); font-size: 32px; font-weight: 650; line-height: 1.2; margin: 0 0 18px; }
#test-review { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 20px; }
#test-review h4 { margin: 0; font-size: 12px; }
#test-review-topics { margin: 10px 0 0; padding-left: 19px; color: var(--muted); font-size: 13px; line-height: 1.6; }
#test-review-topics li + li { margin-top: 9px; }
.completion-actions { margin-top: 18px; }
.certificate-button { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; padding: 14px 18px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: white; font-size: 13px; font-weight: 600; }
.certificate-button:hover { background: #173c32; }
.completion-actions p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 8px 0 0; }
.next.restart-button { background: transparent; color: var(--muted); border-color: #c6d1c7; }
.next.restart-button:hover:not(:disabled) { background: #e7ece5; color: var(--ink); }
.restart-notice { color: #876944; font-size: 11px; line-height: 1.5; margin: 12px 0 0; }
.app-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 28px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #fffefb; box-shadow: 0 24px 100px #162d3540; }
.app-dialog::backdrop { background: #17352e88; }
.app-dialog h2 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -.7px; font-weight: 650; }
.app-dialog p { line-height: 1.65; }
.dialog-eyebrow { color: #94713e; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; margin: 0 0 12px; }
#restart-description, #certificate-form > p:first-child { color: var(--muted); font-size: 14px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.dialog-secondary, .dialog-danger { border: 1px solid #c6d1c7; border-radius: 9px; padding: 12px 15px; background: transparent; color: var(--ink); font-size: 13px; }
.dialog-secondary:hover { background: #edf1e9; }
.dialog-danger { color: #855430; border-color: #d6b592; background: #fcf1e6; }
.dialog-danger:hover { background: #f3e4d0; }
.certificate-dialog.has-preview { width: min(860px, calc(100vw - 32px)); padding: 24px; }
.certificate-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.dialog-close { width: 34px; height: 34px; flex: 0 0 34px; border: 0; border-radius: 50%; background: #edf1e9; color: var(--muted); font-size: 24px; line-height: 1; }
.dialog-close:hover { background: #e0e7dc; }
#certificate-form label { display: block; font-size: 13px; font-weight: 600; margin: 22px 0 8px; }
#certificate-name-input { width: 100%; padding: 12px; border: 1px solid #b9c8b9; border-radius: 8px; background: white; color: var(--ink); font: inherit; }
#certificate-name-input:focus-visible { outline: 3px solid #2c6d9e; outline-offset: 3px; }
#certificate-form .certificate-privacy { color: var(--muted); font-size: 11px; margin: 9px 0 22px; }
.certificate-sheet { padding: 27px 35px 22px; border: 6px double #8fa68e; background: #fffefb; text-align: center; }
.certificate-brand { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; text-align: left; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 1.7px; }
.certificate-brand > span { color: var(--muted); font-size: 9px; font-weight: 400; letter-spacing: .7px; }
.certificate-emblem { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 23px 0 18px; }
.certificate-emblem > span { width: 48px; height: 51px; border: 1px solid var(--region-ink); border-radius: 6px; background: var(--region-bg); color: var(--region-ink); text-align: center; font-size: 24px; font-weight: 650; line-height: 1.25; }
.certificate-emblem small { display: block; text-align: left; padding: 3px 5px 0; font-size: 8px; font-weight: 400; }
.certificate-sheet .certificate-overline { font-size: 10px; text-transform: uppercase; letter-spacing: 2.6px; font-weight: 650; color: #6f7f66; margin: 0 0 7px; }
.certificate-sheet h3 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(26px, 4.2vw, 42px); line-height: 1.2; font-weight: 400; color: #254f45; }
.certificate-sheet .certificate-presented { color: var(--muted); font-size: 12px; margin: 24px 0 4px; }
.certificate-sheet .certificate-student { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(25px, 4vw, 36px); line-height: 1.2; color: var(--ink); margin: 0 auto 16px; padding: 0 10px 12px; border-bottom: 1px solid #cbd6c3; max-width: 590px; overflow-wrap: anywhere; }
.certificate-sheet .certificate-description { max-width: 540px; margin: 0 auto; font-size: 13px; color: #54675c; }
.certificate-regions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px 20px; margin: 17px 0 26px; font-size: 13px; font-weight: 650; }
.certificate-regions > span { border-bottom: 3px solid var(--metal-bg); padding-bottom: 5px; }
.certificate-regions > span:nth-child(2) { border-color: var(--nonmetal-bg); }
.certificate-regions > span:nth-child(3) { border-color: var(--metalloid-bg); }
.certificate-record { display: flex; justify-content: center; gap: 48px; font-size: 13px; font-weight: 600; }
.certificate-record small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 400; }
.certificate-sheet .certificate-footnote { font-size: 10px; color: #82907e; margin: 23px 0 0; }
.certificate-tools { display: flex; justify-content: space-between; gap: 16px; margin-top: 20px; }
.certificate-tools .certificate-button { width: auto; }
.certificate-print-help { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.certificate-next-step > p { color: var(--muted); font-size: 14px; }
.certificate-next-step .certificate-notebook-terms { padding: 15px; border-left: 3px solid #9eae81; border-radius: 0 8px 8px 0; background: #eef2e5; color: var(--ink); }
.certificate-next-step .certificate-teacher-reminder { color: var(--accent); font-weight: 600; }
.certificate-next-step .dialog-secondary { margin-top: 10px; width: 100%; }
@media (max-width: 600px) {
  .app-dialog, .certificate-dialog.has-preview { padding: 20px; }
  .certificate-sheet { padding: 20px 15px; }
  .certificate-brand { justify-content: center; text-align: center; }
  .certificate-record { gap: 22px; font-size: 12px; }
  .certificate-tools { gap: 8px; }
  .certificate-tools button { padding: 12px 10px; font-size: 12px; }
}
@media print {
  @page { size: letter landscape; margin: .5in; }
  body.certificate-printing { margin: 0; background: white; }
  body.certificate-printing > :not(#certificate-dialog) { display: none !important; }
  body.certificate-printing #certificate-dialog { display: block !important; position: static !important; inset: auto !important; width: 100% !important; max-width: none !important; height: auto !important; max-height: none !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; border: 0 !important; border-radius: 0; box-shadow: none; background: white; }
  body.certificate-printing #certificate-dialog::backdrop { display: none; }
  body.certificate-printing .certificate-dialog-header, body.certificate-printing #certificate-form, body.certificate-printing .certificate-next-step, body.certificate-printing .certificate-tools, body.certificate-printing .certificate-print-help { display: none !important; }
  body.certificate-printing #certificate-preview { display: block !important; }
  .certificate-sheet { min-height: 6.7in; padding: .32in .55in; break-inside: avoid; background: white; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .certificate-sheet h3 { font-size: 38px; }
  .certificate-sheet .certificate-student { font-size: 32px; }
  .certificate-emblem { margin-top: 24px; }
  .certificate-record { margin-top: 30px; }
}
