.moeq-body { display: flex; flex-direction: column; min-height: 0; container-type: inline-size; }
.finale-toolbar { gap: 10px; flex-wrap: wrap; flex: 0 0 auto; }
.finale-toolbar strong { color: var(--ink); font-size: 14px; letter-spacing: .02em; }
.finale-toolbar > span:not(.finale-spacer) { color: var(--muted); font-size: 12px; }
.finale-spacer { flex: 1; }
.moeq-layout { display: grid; grid-template-columns: minmax(0, 1fr) 265px; flex: 1; min-height: 0; overflow: hidden; background: var(--bg); }
.quiz-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 18px 20px 0; overflow: auto; }
#quiz-status { flex: 0 0 auto; color: var(--muted); line-height: 1.6; font-size: 12px; min-height: 20px; margin: 0 0 12px; overflow-wrap: anywhere; }
.quiz-intro { max-width: 560px; margin: auto 0; padding: 10px 0 24px; }
.finale-eyebrow { font: 10px var(--mono, monospace); color: var(--muted); letter-spacing: .13em; }
.quiz-intro h1 { margin: 14px 0 18px; font-size: clamp(22px, 3.7cqi, 32px); line-height: 1.6; font-weight: 600; color: var(--ink); }
.quiz-intro p { line-height: 1.85; font-size: 13px; }
.finale-muted { color: var(--muted); }
.quiz-rules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--border); margin: 26px 0 20px; padding: 18px 0; gap: 10px; }
.quiz-rules dt { color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.quiz-rules dd { margin: 0; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
#quiz-start { margin-top: 12px; min-height: 40px; padding-inline: 25px; }
#quiz-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#quiz-form[hidden], #quiz-intro[hidden], #quiz-result[hidden] { display: none; }
.quiz-progress { display: flex; align-items: center; gap: 18px; flex: 0 0 auto; padding-bottom: 15px; border-bottom: 1px solid var(--border); font-size: 12px; }
.quiz-progress > label { flex: 1; color: var(--muted); }
.quiz-progress strong { color: var(--ink); margin-left: 7px; font-weight: 500; font-variant-numeric: tabular-nums; }
.quiz-progress progress { display: block; width: 100%; height: 5px; margin-top: 8px; accent-color: var(--accent); }
.quiz-time-label { text-align: right; color: var(--muted); font-size: 11px; white-space: nowrap; }
#quiz-time { display: block; color: var(--ink); font: 19px var(--mono, monospace); font-variant-numeric: tabular-nums; margin-top: 5px; }
.quiz-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 15px 3px 10px; }
.quiz-jump { border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.quiz-jump summary { padding: 5px 0 12px; color: var(--muted); cursor: pointer; font-size: 12px; }
#quiz-position { float: right; font-variant-numeric: tabular-nums; }
#quiz-map { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; margin-bottom: 24px; }
#quiz-map button { min-width: 0; min-height: 28px; padding: 4px 0; font-size: 11px; font-variant-numeric: tabular-nums; }
#quiz-map button.answered { border-color: color-mix(in srgb, var(--accent) 70%, var(--border)); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
#quiz-map button[aria-current=true] { color: var(--ink); border-color: var(--accent); box-shadow: inset 0 -3px var(--accent); font-weight: 600; }
#quiz-question { min-width: 0; border: 0; margin: 0; padding: 0 0 10px; }
#quiz-question legend { font-size: 17px; color: var(--ink); line-height: 1.8; width: 100%; overflow-wrap: anywhere; padding: 0; }
#quiz-question legend:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.quiz-category { color: var(--muted); font-size: 11px; margin: 8px 0 16px; }
.quiz-option { display: flex; align-items: flex-start; gap: 9px; margin: 9px 0; padding: 12px 11px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); line-height: 1.6; font-size: 13px; cursor: pointer; overflow-wrap: anywhere; }
.quiz-option input { flex: 0 0 auto; margin: 4px 0 0; width: 14px; height: 14px; accent-color: var(--accent); }
.quiz-option-letter { color: var(--muted); font: 12px/1.75 var(--mono, monospace); }
.quiz-option:has(input:checked) { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border-color: var(--accent); }
.quiz-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.quiz-option:has(input:disabled) { cursor: default; opacity: .65; }
.quiz-actions { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); flex: 0 0 auto; }
.quiz-actions button { min-height: 35px; padding-inline: 12px; white-space: nowrap; }
.quiz-actions .primary, #quiz-start.primary, #medal-claim.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.quiz-actions .primary:disabled, #quiz-start.primary:disabled, #medal-claim.primary:disabled { opacity: .5; }
.quiz-result { padding: 16px; background: var(--panel); border: 1px solid var(--border); border-left: 3px solid #f6ad34; border-radius: 4px; margin-bottom: 18px; overflow-wrap: anywhere; }
.quiz-result.passed { border-left-color: #27ae60; }
.quiz-result h2 { font-size: 19px; font-weight: 500; margin: 0 0 10px; }
.quiz-result p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.moeq-companion { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 20px 18px 10px; border-left: 1px solid var(--border); background: color-mix(in srgb, var(--panel) 86%, var(--bg)); overflow: auto; }
.moeq-companion header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: center; }
.moeq-companion header strong { font-size: 16px; font-weight: 500; }
.moeq-companion header label { font-size: 11px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.moeq-companion header input { vertical-align: middle; accent-color: var(--accent); }
#companion-speech { position: relative; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); line-height: 1.8; font-size: 13px; overflow-wrap: anywhere; margin: 20px 0 0; flex: 0 0 auto; }
#companion-speech::after { content: ''; position: absolute; bottom: -5px; left: 25px; width: 8px; height: 8px; background: var(--bg); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); transform: rotate(45deg); }
#moeq-model { flex: 1 0 290px; position: relative; min-height: 170px; width: 100%; overflow: hidden; }
#moeq-model canvas { display: block; width: 100%; height: auto; aspect-ratio: 7 / 10; position: absolute; left: 0; top: 50%; transform: translateY(-50%); pointer-events: none; }
#moeq-model [data-model-status] { position: absolute; inset: 35% 12px auto; text-align: center; font-size: 11px; line-height: 1.7; }
.companion-note { text-align: center; font-size: 10px; line-height: 1.7; color: var(--muted); margin: 0 0 8px; }
.finale-statusbar { justify-content: space-between; flex: 0 0 auto; flex-wrap: wrap; }
.medal-body { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.medal-scroll { overflow: auto; overscroll-behavior: contain; padding: 24px 32px 20px; }
.medal-hero { text-align: center; }
.medal-art { width: 82px; height: 96px; margin: 0 auto 15px; }
.medal-art svg { width: 100%; height: 100%; }
.medal-hero h1 { font-size: 28px; font-weight: 500; margin: 10px 0; color: var(--ink); }
.medal-hero p { color: var(--muted); line-height: 1.8; font-size: 13px; margin: 0 0 24px; }
.medal-progress { display: grid; gap: 10px; margin: 24px 0; }
.medal-progress label { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.medal-progress progress { display: block; width: 100%; height: 6px; appearance: none; border: 0; border-radius: 3px; overflow: hidden; accent-color: var(--accent); }
.medal-state { margin: 20px 0; overflow-wrap: anywhere; }
.medal-state h2 { font-weight: 500; font-size: 17px; margin-bottom: 12px; color: var(--ink); }
.medal-state p { font-size: 12px; line-height: 1.8; margin-block: 10px; }
.medal-address { font: 11px/1.8 var(--mono, monospace); }
.medal-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.medal-actions button { min-height: 40px; }
.medal-actions a, #medal-transaction { color: var(--accent); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.medal-signature-note { font-size: 11px; line-height: 1.8; color: var(--muted); margin-top: 18px; }
@container (max-width: 760px) {
  .moeq-layout { grid-template-columns: minmax(0, 1fr) 190px; }
  .quiz-panel { padding: 12px 12px 0; }
  .moeq-companion { padding: 14px 12px 8px; }
  .quiz-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  #quiz-map { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@container (max-width: 500px) {
  .moeq-layout { grid-template-columns: minmax(0, 1fr) 106px; }
  .finale-toolbar { gap: 6px; padding-inline: 8px; }
  .finale-toolbar > span:not(.finale-spacer) { display: none; }
  .moeq-companion { padding: 12px 7px 6px; }
  .moeq-companion header strong { font-size: 14px; }
  .moeq-companion header label { font-size: 10px; }
  #companion-speech { margin-top: 12px; font-size: 11px; padding: 9px 7px; line-height: 1.8; }
  #moeq-model { flex-basis: 190px; min-height: 140px; margin-inline: -7px; width: calc(100% + 14px); }
  .quiz-panel { padding: 10px 9px 0; }
  #quiz-status { margin-bottom: 8px; font-size: 11px; }
  .quiz-intro h1 { font-size: 20px; }
  .quiz-intro p { font-size: 12px; }
  .quiz-rules { margin-block: 16px; padding-block: 12px; }
  .quiz-rules dd { font-size: 13px; }
  .quiz-progress { gap: 8px; padding-bottom: 10px; }
  .quiz-progress > label { font-size: 10px; }
  .quiz-progress strong { display: block; margin: 3px 0 0; font-size: 12px; }
  .quiz-time-label { font-size: 10px; }
  #quiz-time { font-size: 16px; }
  #quiz-map { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin-bottom: 18px; }
  #quiz-map button { min-height: 30px; }
  #quiz-question legend { font-size: 14px; }
  .quiz-option { gap: 6px; padding: 10px 7px; font-size: 12px; }
  .quiz-option input { width: 13px; height: 13px; }
  .quiz-option-letter { display: none; }
  .quiz-actions { gap: 5px; flex-wrap: wrap; }
  .quiz-actions button { padding-inline: 7px; font-size: 11px; min-height: 36px; }
  .quiz-result { padding: 12px; }
  .quiz-result h2 { font-size: 16px; }
  .quiz-result p { font-size: 12px; }
  .finale-statusbar > span:last-child { display: none; }
}
@media (max-width: 639px) { .medal-scroll { padding: 18px; } .medal-hero h1 { font-size: 24px; } .medal-actions { align-items: stretch; flex-direction: column; } }
