.m7-main { max-width: 54rem; width: 100%; margin: auto; padding: 1rem; box-sizing: border-box; }
.m7-main [hidden] { display: none !important; }
.m7-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.m7-bar h1, .m7-bar p { margin: 0; }
.m7-bar > div:last-child { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.m7-topics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.m7-topics button.topic { color: #16342e; background: #f3efff; min-width: 0; }
.m7-topics button.topic:nth-child(5n + 2) { background: #e8f1ff; }
.m7-topics button.topic:nth-child(5n + 3) { background: #ffeef0; }
.m7-topics button.topic:nth-child(5n + 4) { background: #e8f6ed; }
.m7-topics button.topic:nth-child(5n + 5) { background: #fff3e0; }
.m7-topics .topic-title { overflow-wrap: anywhere; }
.m7-topics img[hidden] + .topic-title { grid-column: 1 / -1; }
@media (max-width: 830px) {
  .m7-topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 630px) {
  .m7-topics { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
}
.m7-practice { text-align: start; min-width: 0; }
.m7-practice blockquote { margin: 1rem 0; padding: 1rem; border-inline-start: .3rem solid #257c70; background: #e7f5f1; white-space: pre-line; overflow-wrap: anywhere; }
.m7-choices { display: grid; gap: .5rem; margin: 1rem 0; }
.m7-choices button { text-align: start; overflow-wrap: anywhere; white-space: normal; width: 100%; }
.m7-choices button[data-result="correct"] { background: #d8f3df; color: #154c25; border-color: #287340; }
.m7-choices button[data-result="wrong"] { background: #ffe2e2; color: #791a1a; border-color: #9a2727; }
.m7-feedback { padding: .75rem; background: #fff0cf; border-radius: .5rem; }

.m7-practice { font-size: 1.1rem; }
.m7-choices button { min-height: 3rem; }
.m7-topics button.topic { grid-template: 1fr / minmax(0, 1fr); min-height: 5rem; }

.m7-choices button { white-space: pre-line; }

.m7-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.m7-table :is(td, th) { padding: .3rem; border: 1px solid #91aaa2; overflow-wrap: anywhere; }
.m7-table caption { margin-bottom: .5rem; text-align: left; font-weight: 700; }

.m7-chart { margin: 0; }
.m7-chart figcaption { margin-bottom: .5rem; font-weight: 700; }
.m7-chart-row { display: grid; grid-template-columns: minmax(5rem, 1fr) minmax(2rem, 2fr) auto; gap: .5rem; align-items: center; margin: .35rem 0; }
.m7-chart-track { height: .8rem; background: #e2ebe7; border-radius: .2rem; }
.m7-chart-bar { display: block; height: 100%; border-radius: .2rem; background: #276456; }

.m7-diagram { margin: 0; }
.m7-diagram figcaption { font-weight: 700; }
.m7-diagram li { margin-block: .5rem; padding: .35rem .5rem; background: #fff; border-inline-start: .25rem solid #276456; }

#m7Topics { display: block; }
#m7Topics[hidden] { display: none; }
.m7-topics button { min-height: 4rem; min-width: 0; }
.m7-topics .topic-title { text-align: left; display: block; }
.pm-fraction { display: inline-grid; grid-template-rows: auto auto; vertical-align: middle; margin: 0 .2em; text-align: center; line-height: 1.15; }
.pm-fraction span:first-child { border-bottom: 1px solid currentColor; padding: 0 .2em .08em; }
.pm-fraction span:last-child { padding: .08em .2em 0; }
.pm-repeating { text-decoration: overline; }
#m7Quote { padding: .35rem; background: #fff; }
.m7-choices button img { margin-top: .35rem; }

/* Focused practice layout; shared pages keep their existing styles. */
body[data-math-grade="7"] { background: #f3f7f6; color: #213b35; font-family: "Segoe UI", system-ui, sans-serif; }
.pm-nav { max-width: 66rem; padding: 1.2rem 1.5rem .2rem; font-size: .85rem; }
.pm-nav a, .m7-main a { color: #176b59; text-underline-offset: .2em; }
.m7-main { max-width: 66rem; padding: 1rem 1.5rem; margin: 0 auto 3rem; }
.m7-bar { gap: 1rem; margin-bottom: 1.2rem; }
.m7-bar h1 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); line-height: 1.2; letter-spacing: -.035em; }
.m7-eyebrow { font-size: .68rem; font-weight: 750; letter-spacing: .12em; color: #537469; margin: 0 0 .5rem; }
.m7-bar .m7-subtitle { font-size: .9rem; color: #5d706a; margin-top: .45rem; }
.m7-bar button, #m7Back { font-size: .83rem; border-width: 1px; border-radius: .6rem; }
.m7-practice { font-size: 1rem; }
.m7-topic-head { display: flex; align-items: center; gap: 1.5rem; padding: 0 0 1rem; }
.m7-topic-heading { border-left: 1px solid #cddcd5; padding-left: 1.5rem; min-width: 0; }
.m7-topic-heading .m7-eyebrow { margin-bottom: .35rem; }
#m7Title { font-size: clamp(1.15rem, 2.6vw, 1.5rem); line-height: 1.35; overflow-wrap: anywhere; }
.m7-points { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 1.25rem; padding: .9rem 0; background: #eaf1ee; border: 1px solid #d7e3dd; border-radius: .8rem; }
.m7-stat { padding: .1rem 1.35rem; flex: 1 1 9rem; border-right: 1px solid #cddcd5; }
.m7-stat:last-child { border-right: 0; }
.m7-stat span { display: block; font-size: .75rem; color: #52695f; margin-bottom: .25rem; }
.m7-stat strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.m7-stat-right strong { color: #17643c; }
.m7-stat-wrong strong { color: #974732; }
.m7-guest { margin: 0 0 1.15rem; font-size: .82rem; color: #61716a; }
.m7-intro, .m7-question-card { background: white; border: 1px solid #d9e5df; border-radius: 1.1rem; box-shadow: 0 8px 30px #244e3e08; overflow: hidden; }
.m7-intro { padding: clamp(1.3rem, 4vw, 2.5rem); }
.m7-intro h3 { font-size: 1.45rem; margin: .5rem 0 1rem; }
#m7Seen { color: #176b59; font-weight: 650; }
.m7-intro-note { max-width: 36rem; color: #61716a; margin: .65rem 0 1.5rem; line-height: 1.7; }
.m7-question-meta { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: 1.1rem 1.8rem; background: #fcfdfc; font-size: .82rem; border-bottom: 1px solid #e6eeea; }
#m7Number { color: #16634f; font-weight: 750; font-variant-numeric: tabular-nums; }
.m7-question-meta > span { color: #687971; font-size: .74rem; }
#m7Progress { margin: 0; height: 4px; border: 0; border-radius: 0; background: #e6eeea; }
#m7Progress::-webkit-progress-bar { background: #e6eeea; }
#m7Progress::-webkit-progress-value { background: #287d64; }
#m7Progress::-moz-progress-bar { background: #287d64; }
.m7-question-body { padding: 1.3rem 1.8rem 1.1rem; }
#m7Prompt { font-size: clamp(1.2rem, 2.5vw, 1.5rem); font-weight: 650; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
#m7Quote { margin: .8rem 0 1.2rem; padding: .75rem; border: 1px solid #e1e9e5; border-radius: .75rem; background: #fafcfb; }
#m7Quote img { margin: auto; object-fit: contain; }
.m7-answer-area { padding: 0 1.8rem 1.3rem; }
.m7-answer-label { font-size: .78rem; color: #61716a; margin-bottom: .75rem; }
.m7-choices { gap: .7rem; margin: 0; }
.m7-choices button { display: flex; align-items: center; gap: .9rem; min-height: 3.1rem; padding: .55rem .9rem; border: 1px solid #cdded6; border-radius: .75rem; color: #28463b; font-weight: 600; font-size: 1.02rem; line-height: 1.5; background: #fff; }
.m7-choices button:hover:not(:disabled) { background: #f0f8f4; border-color: #348166; filter: none; }
.m7-choice-letter { display: grid; place-items: center; width: 2rem; height: 2rem; flex: 0 0 2rem; border-radius: .5rem; background: #f0f5f2; border: 1px solid #dce7e1; color: #4f6c5d; font-size: .83rem; }
.m7-choice-content { flex: 1; min-width: 0; white-space: pre-line; }
.m7-choice-result { font-size: .7rem; font-weight: 700; margin-left: auto; flex: 0 0 auto; }
.m7-choices button:disabled { opacity: 1; color: #61716a; background: #f8faf9; }
.m7-choices button[data-result="correct"] { background: #edf8f0; border-color: #328354; color: #1c5a32; }
.m7-choices button[data-result="wrong"] { background: #fff1ed; border-color: #b7523b; color: #8a3324; }
.m7-question-footer:has(> :not([hidden])) { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; padding: 1.3rem 1.8rem; border-top: 1px solid #e1e9e5; background: #fafcfb; }
.m7-feedback { margin: 0; padding: 1rem; width: 100%; background: #fff5e6; color: #714b1c; line-height: 1.7; border: 1px solid #ead8b7; border-radius: .7rem; white-space: pre-line; }
.m7-feedback[data-result="correct"] { color: #205d37; background: #edf8f0; border-color: #cce3d3; }
#m7Next { align-self: flex-end; }
.m7-main button:focus-visible, .m7-main a:focus-visible { outline: 3px solid #b4611f; outline-offset: 3px; }
#m7Prompt:focus, #m7Title:focus { outline: none; }
#m7Status:empty { display: none; }
#m7Topics > section + section { margin-top: 1.8rem; }
#m7Topics > section > h2 { font-size: 1rem; margin-bottom: .8rem; color: #4c6559; }
.m7-topics button.topic { background: #fff; border: 1px solid #d6e2db; border-radius: .8rem; padding: 1.1rem; }
.m7-topics .topic-title { font-size: .95rem; line-height: 1.5; }
@media (max-width: 630px) {
  .pm-nav { padding: .9rem 1rem .2rem; }
  .m7-main { padding: 1rem; }
  .m7-bar { margin-bottom: 1.3rem; align-items: flex-start; }
  .m7-bar > div:last-child { gap: .5rem; }
  .m7-topic-head { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .m7-topic-heading { border: 0; padding: 0; }
  .m7-points { flex-wrap: wrap; padding: .8rem .25rem; }
  .m7-stat { padding: .15rem .6rem; flex: 1 1 0; }
  .m7-stat span { font-size: .64rem; }
  .m7-stat strong { font-size: .95rem; }
  .m7-question-meta { padding: .9rem 1rem; }
  .m7-question-body { padding: 1.2rem 1rem; }
  .m7-answer-area { padding: 0 1rem 1.2rem; }
  .m7-choices button { gap: .65rem; padding: .65rem; flex-wrap: wrap; }
  .m7-choice-content { flex-basis: calc(100% - 3rem); }
  .m7-choice-result { padding-left: 2.65rem; flex-basis: 100%; }
  .m7-question-footer:has(> :not([hidden])) { padding: 1rem; }
  #m7Next { width: 100%; }
}
