 :root{
    /* Shared Maths Fluency palette: matches Classroom + Student sites */
    --green:#398257;
    --green-2:#235b3a;
    --green-3:#dce9df;
    --cream:#f5f4ec;
    --paper:#fffefa;
    --ink:#202b24;
    --muted:#566259;
    --line:#86a58f;
    --white:#ffffff;
    --danger:#b43f38;
    --sidebar:#263f31;
    --sidebar-button:#345543;
    --sidebar-hover:#47765a;
    --sidebar-soft:#b8d5c0;
    --brand-soft:#dce9df;
    --year-active:#f1ca62;
  }

  /* Year-level colour themes shared with Classroom + Student sites */
  body[data-year="3"]{--green:#367daa;--green-2:#205577;--green-3:#dceaf2;--line:#86a8bc;--sidebar:#203e53;--sidebar-button:#315b76;--sidebar-hover:#477c9e;--sidebar-soft:#b8d3e3;--brand-soft:#dceaf2}
  body[data-year="4"]{--green:#398257;--green-2:#235b3a;--green-3:#dce9df;--line:#86a58f;--sidebar:#263f31;--sidebar-button:#345543;--sidebar-hover:#47765a;--sidebar-soft:#b8d5c0;--brand-soft:#dce9df}
  body[data-year="5"]{--green:#b6544e;--green-2:#79332f;--green-3:#f1dfdd;--line:#b68d89;--sidebar:#542e2c;--sidebar-button:#74413d;--sidebar-hover:#96534e;--sidebar-soft:#e4c2be;--brand-soft:#f1dfdd}
  body[data-year="6"]{--green:#8158ad;--green-2:#563477;--green-3:#e9e0f1;--line:#a58eb9;--sidebar:#422d55;--sidebar-button:#5c4074;--sidebar-hover:#77539a;--sidebar-soft:#d1bfdf;--brand-soft:#e9e0f1}
  *{box-sizing:border-box}
  html,body{margin:0;min-height:100%;font-family:Trebuchet MS,Arial,sans-serif;color:var(--ink);background:var(--cream)}
  button,select,input{font:inherit}
  button{cursor:pointer}
  .app{min-height:100vh;display:grid;grid-template-columns:290px 1fr}
  .sidebar{background:var(--sidebar);color:#fff;padding:22px 18px;display:flex;flex-direction:column;gap:20px;min-height:100vh}
  .brand{padding:2px 6px 8px}
  .brand h1{font-size:25px;line-height:1.02;margin:0 0 7px;letter-spacing:-.5px}
  .brand p{margin:0;color:var(--brand-soft);font-size:13px}
  .side-label{font-size:11px;letter-spacing:1.2px;font-weight:700;color:var(--sidebar-soft);margin:0 6px 7px}
  .years{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .year-btn,.activity-btn{border:1px solid rgba(255,255,255,.18);background:var(--sidebar-button);color:white;border-radius:7px;padding:10px 11px;text-align:left;font-weight:700}
  .year-btn{text-align:center}
  .year-btn:hover,.activity-btn:hover{background:var(--sidebar-hover)}
  .year-btn.active{background:var(--year-active);color:var(--sidebar);border-color:var(--year-active)}
  .activity-btn.active{background:var(--sidebar-hover);color:white;border-color:var(--sidebar-hover)}
  .activity-list{display:grid;gap:7px}
  .activity-btn{font-size:14px;font-weight:600}
  .coming{border-top:1px solid rgba(255,255,255,.18);padding-top:16px;color:var(--sidebar-soft);font-size:12px;line-height:1.45;margin-top:auto}
  .main{padding:30px clamp(22px,4vw,58px) 60px;overflow:auto}
  .topline{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:18px}
  .eyebrow{font-size:12px;letter-spacing:1.3px;font-weight:800;color:var(--green-2);margin-bottom:6px}
  h2{margin:0;font-size:34px;letter-spacing:-1px;color:var(--green)}
  .sub{margin:7px 0 0;color:var(--muted);font-size:15px;max-width:760px}
  .panel{background:rgba(255,255,255,.72);border:1px solid #ded8cb;border-radius:12px;padding:20px;margin-bottom:22px}
  .controls{display:grid;grid-template-columns:repeat(4,minmax(150px,1fr));gap:16px}
  .control label{display:block;font-size:12px;font-weight:800;color:var(--green);margin-bottom:6px;letter-spacing:.3px}
  select,.text-input{width:100%;border:1px solid var(--line);background:white;border-radius:6px;padding:10px 11px;color:var(--ink)}
  .toggles{display:flex;flex-wrap:wrap;gap:12px 22px;margin-top:17px;padding-top:16px;border-top:1px solid #ddd8cc}
  .check{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:700;color:#39453f}
  .check input{width:17px;height:17px;accent-color:var(--green)}
  .actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px}
  .btn{border:0;border-radius:7px;padding:11px 15px;font-weight:800;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;font:inherit}
  .btn.primary{background:var(--green);color:white}
  .btn.secondary{background:white;color:var(--green);border:1px solid var(--line)}
  .btn.ghost{background:transparent;color:var(--green);border:1px solid var(--line)}
  .btn:hover{filter:brightness(.97)}
  .preview-head{display:flex;justify-content:space-between;align-items:center;gap:15px;margin:2px 0 10px}
  .preview-head h3{margin:0;color:var(--green);font-size:17px}
  .hint{font-size:12px;color:var(--muted)}
  .pages{display:flex;gap:22px;align-items:flex-start;flex-wrap:wrap}
  .sheet{width:595px;min-height:842px;background:var(--paper);border:1px solid #d4d0c7;box-shadow:0 8px 24px rgba(42,48,45,.11);padding:32px 34px 32px;position:relative}
  .sheet.small-preview{transform-origin:top left}
  .sheet-brand{font-size:12px;font-weight:800;letter-spacing:.8px;color:#4b5a52}
  .sheet-title{font-size:20px;font-weight:800;color:#1f342b;margin-top:8px}
  .sheet-meta{margin-top:17px;display:grid;grid-template-columns:1fr 170px;gap:18px;font-size:13px}
  .blank{border-bottom:1px solid #48524d;height:19px;display:inline-block;vertical-align:bottom}
  .instructions{font-size:12px;margin:17px 0 15px;color:#465049}
  .questions{display:grid;grid-template-columns:1fr 1fr;column-gap:54px;row-gap:21px;margin-top:17px}
  .question{min-height:78px;position:relative;font-size:18px}
  .qnum{position:absolute;left:0;font-size:11px;color:#5f6c65;font-weight:800}
  .vertical-sheet .qnum{top:6px}
  /* Basic facts use baseline alignment so the slightly larger question number sits neatly at the bottom of the equation row. */
  .basic-sheet .question{display:flex;align-items:baseline}
  .basic-sheet .qnum{position:static;flex:0 0 25px;font-size:13px;line-height:1}
  /* Basic-fact rows use the full worksheet question area rather than bunching at the top. */
  .basic-sheet .questions{height:610px;align-content:space-between}
  .answer-sheet.basic-sheet .questions{height:646px}
  .horizontal-q{padding:11px 0 0 0;font-size:22px;letter-spacing:.2px}
  .answer-line{display:inline-block;min-width:72px;border-bottom:1px solid #3b433f;transform:translateY(-3px)}
  .vertical-q{width:205px;margin-left:auto;margin-right:12px;padding-top:2px;font-family:Trebuchet MS,Arial,sans-serif;font-variant-numeric:tabular-nums}
  /* Keep the two written-algorithm question columns comfortably separated without wasting page width. */
  .vertical-sheet .question:nth-child(odd) .vertical-q{transform:translateX(-6px)}
  .vertical-sheet .question:nth-child(even) .vertical-q{transform:translateX(6px)}
  /* Each digit occupies one fixed place-value column. No commas are shown in written algorithms. */
  .vertical-q .row{font-size:21px;line-height:1.15;min-height:25px;padding-right:0}
  .vertical-q .digit-row{display:grid;grid-template-columns:repeat(var(--digit-count),var(--digit-width,1.45em));justify-content:end;align-items:end}
  .vertical-q .digit{display:block;text-align:center;letter-spacing:0}
  .vertical-q .blank-digit{visibility:hidden}
  .vertical-q .bottom{border-bottom:1.6px solid #222;padding-bottom:3px;position:relative}
  .vertical-q .op{position:absolute;left:2px;font-weight:700}
  .vertical-q .answer-row .digit-grid-strong{display:contents;font-weight:700}
  .work-lines{height:29px;border-bottom:1px solid #c9cecb}
  .sheet-footer{position:absolute;left:34px;right:34px;bottom:22px;border-top:1px solid #d8ddd9;padding-top:8px;display:flex;justify-content:space-between;font-size:9px;color:#7a847f}
  .answer-sheet .questions{row-gap:11px}
  .answer-sheet .question{min-height:43px}
  .answer-sheet .vertical-q{margin-right:25px}
  .sheet.spacious .questions{row-gap:26px}
  .sheet.spacious .question{min-height:90px;font-size:20px}
  .sheet.spacious .vertical-q{width:232px}
  .sheet.spacious .vertical-q .row{font-size:25px;min-height:29px}
  .sheet.spacious .work-lines{height:38px}
  .sheet.basic-dense .questions{row-gap:7px;column-gap:38px}
  .sheet.basic-dense .question{min-height:28px}
  .sheet.basic-dense .horizontal-q{font-size:18px;padding-top:4px}

  /* 45-question basic-fact sheets: three columns of 15, numbered down each column. */
  .sheet.basic-sheet.basic-three-column .questions{grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(15,auto);grid-auto-flow:column;column-gap:22px;row-gap:4px}
  .sheet.basic-sheet.basic-three-column .question{min-height:31px}
  .sheet.basic-sheet.basic-three-column .qnum{flex-basis:22px;font-size:12px}
  .sheet.basic-sheet.basic-three-column .horizontal-q{font-size:16px;padding-top:2px;white-space:nowrap}
  .sheet.basic-sheet.basic-three-column .answer-line{min-width:47px}
  .answer-sheet.basic-sheet.basic-three-column .questions{row-gap:2px}
  .answer-sheet.basic-sheet.basic-three-column .question{min-height:29px}

  /* Count-aware layouts keep every selected question on one A4 worksheet. */
  .sheet.basic-sheet.count-16 .questions{row-gap:10px}
  .sheet.basic-sheet.count-16 .question{min-height:46px}
  .sheet.basic-sheet.count-16 .horizontal-q{font-size:20px;padding-top:7px}

  /* Three-column written addition for Years 3-4 at 18 or 24 questions. */
  .sheet.vertical-sheet.three-column .questions{grid-template-columns:repeat(3,1fr);column-gap:18px}
  .sheet.vertical-sheet.three-column .question{min-height:58px}
  .sheet.vertical-sheet.three-column .vertical-q{width:148px;margin-right:0}
  .sheet.vertical-sheet.three-column .vertical-q .row{font-size:18px;line-height:1.08;min-height:20px}
  .sheet.vertical-sheet.three-column .vertical-q .digit-row{grid-template-columns:repeat(var(--digit-count),var(--digit-width,1.35em))}
  .sheet.vertical-sheet.three-column .work-lines{height:18px}
  .sheet.vertical-sheet.three-column .question:nth-child(odd) .vertical-q,
  .sheet.vertical-sheet.three-column .question:nth-child(even) .vertical-q{transform:none}
  .sheet.vertical-sheet.three-column.count-18 .questions{grid-template-rows:repeat(6,auto);grid-auto-flow:column;row-gap:18px}
  .sheet.vertical-sheet.three-column.count-24 .questions{grid-template-rows:repeat(8,auto);grid-auto-flow:column;row-gap:6px}
  .answer-sheet.vertical-sheet.three-column .questions{row-gap:6px}
  .answer-sheet.vertical-sheet.three-column .question{min-height:46px}
  .answer-sheet.vertical-sheet.three-column.count-18 .questions{row-gap:10px}
  .answer-sheet.vertical-sheet.three-column.count-24 .questions{row-gap:4px}
  .sheet.vertical-sheet.count-16 .questions{row-gap:6px}
  .sheet.vertical-sheet.count-16 .question{min-height:58px}
  .sheet.vertical-sheet.count-16 .vertical-q .row{font-size:18px;line-height:1.08;min-height:20px}
  .sheet.vertical-sheet.count-16 .work-lines{height:18px}
  .answer-sheet.vertical-sheet.count-16 .questions{row-gap:6px}
  .answer-sheet.vertical-sheet.count-16 .question{min-height:54px}
  .answer-sheet.vertical-sheet.count-16 .vertical-q .row{font-size:18px;line-height:1.08;min-height:20px}
  .status{min-height:20px;margin-top:8px;font-size:12px;color:var(--green-2);font-weight:700}
  .mixed-ordering-warning{margin-top:4px;font-size:12px;line-height:1.35;font-weight:800;color:#b00020}
  .screen-note{font-size:12px;color:var(--muted);margin-top:6px}
  @media screen and (max-width:1050px){
    .app{grid-template-columns:235px 1fr}.controls{grid-template-columns:repeat(2,1fr)}
    .sheet{width:100%;max-width:595px;min-height:760px}
  }
  @media screen and (max-width:760px){
    .app{display:block}.sidebar{min-height:auto}.years{grid-template-columns:repeat(4,1fr)}
    .activity-list{grid-template-columns:1fr 1fr}.coming{display:none}.main{padding:22px 14px 45px}.controls{grid-template-columns:1fr}.topline{display:block}
    h2{font-size:29px}.sheet{padding:30px 25px;min-height:760px}.questions{column-gap:24px}.sheet-footer{left:25px;right:25px}
  }

/* v38: powers-of-10 preview only. Keep long equations and answer lines on one row. */
@media screen{
  .powers-preview-sheet .questions{column-gap:30px}
  .powers-preview-sheet .qnum{flex-basis:22px}
  .powers-preview-sheet .horizontal-q{white-space:nowrap;font-size:18.5px}
  .powers-preview-sheet .answer-line{min-width:52px}
  .powers-preview-sheet.count-16 .horizontal-q{font-size:18px}
  .powers-preview-sheet.count-20 .horizontal-q{font-size:17px}
  .powers-preview-sheet.count-30 .horizontal-q{font-size:16px}
  .powers-preview-sheet.count-30 .answer-line{min-width:46px}
}
  @media print{
    html,body{margin:0!important;padding:0!important;background:white!important;width:210mm!important}
    .sidebar,.topline,.panel,.preview-head,.screen-note,.status{display:none!important}
    .app,.main,.pages{display:block!important;width:210mm!important;max-width:none!important;margin:0!important;padding:0!important;overflow:visible!important}
    .sheet{width:210mm!important;max-width:none!important;height:297mm!important;min-height:297mm!important;max-height:297mm!important;border:0!important;box-shadow:none!important;margin:0!important;padding:10mm 11mm 10mm!important;break-after:page;page-break-after:always;overflow:hidden!important}
    /* 220 mm mirrors the 610 px preview question zone at true A4 scale. */
    .basic-sheet .questions{height:220mm!important;align-content:space-between!important}
    .answer-sheet.basic-sheet .questions{height:233mm!important}
    .sheet:last-child{break-after:auto;page-break-after:auto}
    .sheet-footer{left:11mm;right:11mm;bottom:7mm}
    @page{size:A4 portrait;margin:0}
  }

[hidden]{display:none!important;}

/* v27 expanded activity set */
.sidebar{overflow-y:auto}
.activity-section{display:grid;gap:0}
.activity-section + .activity-section{margin-top:0}
.long-sheet .questions{display:grid;grid-template-columns:1fr;row-gap:12px;margin-top:14px}
.long-sheet .question{min-height:48px;position:relative;padding-left:28px;border-bottom:1px solid #edf0ee;padding-bottom:8px}
.long-sheet .qnum{left:0;top:2px;font-size:11px}
.long-prompt{font-size:14.5px;line-height:1.35;padding-right:160px;min-width:0;white-space:normal;overflow-wrap:break-word;word-break:normal}
.long-answer{position:absolute;right:0;top:0;min-width:145px;text-align:right;font-size:14px}
.long-answer-line{display:inline-block;width:138px;border-bottom:1px solid #3b433f;height:19px}
.long-sheet.count-16 .questions{row-gap:7px}.long-sheet.count-16 .question{min-height:39px}
.long-sheet.count-20 .questions{row-gap:4px}.long-sheet.count-20 .question{min-height:31px;padding-bottom:4px}.long-sheet.count-20 .long-prompt{font-size:12.9px}.long-sheet.count-20 .long-answer{font-size:12.5px}
.family-sheet .questions{display:grid;grid-template-columns:1fr 1fr;gap:14px 18px;margin-top:14px}
.family-card{min-height:155px;border:1px solid #d5ddd8;border-radius:7px;padding:8px 10px 8px 31px;position:relative}
.family-card .qnum{left:9px;top:9px}
.family-roof{width:112px;margin:0 auto 6px;text-align:center}
.family-product{font-size:21px;font-weight:800;min-height:27px}
.family-factors{display:flex;justify-content:space-between;font-size:18px;font-weight:700;border-top:1px solid #aeb8b2;padding-top:3px}
.family-blank{display:inline-block;width:34px;border-bottom:1px solid #333;height:20px}
.family-equations{display:grid;grid-template-columns:1fr 1fr;gap:4px 10px;font-size:12px;line-height:1.4;margin-top:7px}
.family-sheet.count-10 .family-card,.family-sheet.count-12 .family-card{min-height:119px}
.family-sheet.count-10 .family-equations,.family-sheet.count-12 .family-equations{font-size:11px;gap:2px 8px}
.family-sheet.count-10 .family-product,.family-sheet.count-12 .family-product{font-size:18px}.family-sheet.count-10 .family-factors,.family-sheet.count-12 .family-factors{font-size:16px}
.basic-sheet.count-30 .questions{row-gap:7px}.basic-sheet.count-30 .question{min-height:34px}.basic-sheet.count-30 .horizontal-q{font-size:17px;padding-top:4px}
@media screen and (max-width:760px){.long-prompt{padding-right:0}.long-answer{position:static;text-align:left;margin-top:4px}.family-sheet .questions{grid-template-columns:1fr}}
@media print{
  .long-sheet .question{border-bottom:0}
  .family-card{break-inside:avoid}
}

/* v28: redesigned place value, fact families and Year 6 factor finder */
.place-value-sheet .questions{display:grid;grid-template-columns:1fr 1fr;column-gap:28px;row-gap:15px;margin-top:14px}
.place-value-card{min-height:104px;border:1px solid #dbe1dd;border-radius:7px;padding:11px 12px 10px 34px;position:relative}
.place-value-card .qnum{left:10px;top:12px;font-size:11px}
.pv-number{font-family:Trebuchet MS,Arial,sans-serif;font-variant-numeric:tabular-nums;font-size:26px;font-weight:700;line-height:1;white-space:nowrap;margin-bottom:11px;display:inline-flex;align-items:center;justify-content:flex-start;gap:0}
/* Fixed-width digit cells keep the highlighted digit centred and prevent the border touching its neighbours. */
.pv-token{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;height:1.2em;line-height:1;box-sizing:border-box}
.pv-digit{width:.82em;position:relative}
/* Every digit uses exactly the same text box, font weight and baseline. */
.pv-digit > span{display:flex;align-items:center;justify-content:center;width:100%;height:100%;box-sizing:border-box;position:relative;z-index:1;font:inherit}
.pv-separator{width:.34em;font-weight:600}
/* The highlight is a separate layer behind the digit, so it cannot change the digit's font metrics or vertical position. */
.highlight-digit::before{content:"";position:absolute;inset:.05em .07em;border:1.6px solid #263f34;border-radius:3px;background:#f0f5f2;box-sizing:border-box;z-index:0;pointer-events:none}
.pv-prompts{display:grid;grid-template-columns:1fr;gap:7px;font-size:12.5px}
.pv-answer-line{display:inline-block;width:135px;border-bottom:1px solid #444;height:15px;vertical-align:bottom}
.place-value-sheet.count-16 .questions{row-gap:13px}
.place-value-sheet.count-20 .questions{row-gap:12px}
.place-value-sheet.count-16 .place-value-card{min-height:80px;padding-top:8px;padding-bottom:7px}
.place-value-sheet.count-16 .pv-number{font-size:21px;margin-bottom:6px}
.place-value-sheet.count-16 .pv-prompts{gap:4px;font-size:11.5px}
.place-value-sheet.count-20 .place-value-card{min-height:68px;padding-top:6px;padding-bottom:5px}
.place-value-sheet.count-20 .pv-number{font-size:18px;margin-bottom:4px}
.place-value-sheet.count-20 .pv-prompts{grid-template-columns:1fr;gap:2px;font-size:10.8px}
.place-value-sheet.count-20 .pv-answer-line{width:105px;height:12px}

/* Screen preview is narrower than the true A4 print canvas. Only long numbers are reduced in preview. */
@media screen{
  .place-value-sheet .pv-number{max-width:100%}
  .place-value-sheet .pv-number.pv-number-wide{font-size:20px}
  .place-value-sheet.count-16 .pv-number.pv-number-wide{font-size:20px}
  .place-value-sheet.count-20 .pv-number.pv-number-wide{font-size:18px}
}

/* Year 3: conventional fact-family triangles. */
.family-sheet .family-card{border:0;border-radius:0;background:transparent;padding:0 4px 0 28px;min-height:145px;position:relative}
.family-sheet .family-card .qnum{left:5px;top:6px}
.family-triangle-card{display:flex;align-items:center;justify-content:center}
.family-triangle{width:210px;height:132px;color:#34463d;overflow:visible}
.family-svg-number{font:700 19px Arial,sans-serif;fill:#1f2824}
.family-svg-symbol{font:700 11px Arial,sans-serif;fill:#66736d;letter-spacing:3px}

/* Years 4-5: true fact-family houses with the same missing value in roof and equations. */
.family-house-card{min-height:178px!important}
.family-house{width:215px;margin:0 auto;color:#31443a}
.house-roof{height:73px;position:relative;clip-path:polygon(50% 0,100% 100%,0 100%);background:#f1f5f2;border-bottom:2px solid #64756c}
.house-roof::after{content:"";position:absolute;inset:3px 4px 0;clip-path:polygon(50% 0,100% 100%,0 100%);background:var(--paper);z-index:0}
.house-roof span{position:absolute;z-index:1;font-family:Trebuchet MS,Arial,sans-serif;font-weight:800}
.roof-product{top:20px;left:50%;transform:translateX(-50%);font-size:19px}
.roof-factor{bottom:7px;font-size:16px}
.roof-left{left:40px}.roof-right{right:40px}.roof-symbol{left:50%;bottom:7px;transform:translateX(-50%);font-size:9px;color:#748078;letter-spacing:2px}
.house-body{border:2px solid #64756c;border-top:0;padding:8px 13px 8px;background:#fffefa;min-height:92px;display:grid;grid-template-columns:1fr 1fr;gap:5px 9px;align-content:center}
.house-equation{font-size:11px;white-space:nowrap;line-height:1.35}
.family-eq-blank{display:inline-block;width:27px;height:12px;border-bottom:1px solid #333;vertical-align:baseline}
.family-sheet.count-10 .family-house-card,.family-sheet.count-12 .family-house-card{min-height:128px!important}
.family-sheet.count-10 .family-house,.family-sheet.count-12 .family-house{width:205px;transform:scale(.88);transform-origin:top center;margin-bottom:-17px}
.family-sheet.count-12 .questions{gap:7px 14px}

/* Year 6 Factor Finder. */
.factor-sheet .questions{display:grid;grid-template-columns:1fr;row-gap:18px;margin-top:17px}
.factor-card{min-height:58px;position:relative;padding:0 4px 9px 29px;border-bottom:1px solid #e4e8e5}
.factor-card .qnum{left:0;top:1px;font-size:11px}
.factor-prompt{font-size:15px;margin-bottom:10px}
.factor-answer{font-size:12px;line-height:1.35}
.factor-answer-line{display:block;width:100%;border-bottom:1px solid #3b433f;height:17px}
.factor-sheet.count-10 .questions,.factor-sheet.count-12 .questions{row-gap:10px}
.factor-sheet.count-10 .factor-card,.factor-sheet.count-12 .factor-card{min-height:45px}
.factor-sheet.count-10 .factor-prompt,.factor-sheet.count-12 .factor-prompt{font-size:14px;margin-bottom:6px}

@media screen and (max-width:760px){
  .place-value-sheet .questions{grid-template-columns:1fr}
  .family-house{width:210px}
}
@media print{
  .place-value-card,.family-card,.factor-card{break-inside:avoid}
}

/* v28 compatibility: SVG roof keeps fact-family houses consistent in preview and print. */
.house-roof{display:none!important}
.house-roof-svg{display:block;width:215px;height:74px;color:#64756c;margin:0 auto -1px;overflow:visible}
.house-svg-product{font:700 19px Arial,sans-serif;fill:#1f2824}
.house-svg-factor{font:700 16px Arial,sans-serif;fill:#1f2824}
.house-svg-symbol{font:700 9px Arial,sans-serif;fill:#748078;letter-spacing:2px}
.family-sheet.count-10 .house-roof-svg,.family-sheet.count-12 .house-roof-svg{width:205px;height:70px}
/* Keep 12 place-value cards comfortably above the footer. */
.place-value-sheet.count-12 .questions{row-gap:9px}
.place-value-sheet.count-12 .place-value-card{min-height:88px;padding-top:8px;padding-bottom:7px}
.place-value-sheet.count-12 .pv-number{font-size:23px;margin-bottom:7px}
.place-value-sheet.count-12 .pv-prompts{gap:4px;font-size:11.8px}

/* Print/preview safety for the densest Year 3 fact-family sheet. */
.family-sheet.count-12 .family-triangle-card{min-height:132px}
.family-sheet.count-12 .family-triangle{height:119px;width:196px}


/* v35: use the top of all Place Value worksheets more efficiently. */
.place-section-sheet .instructions{margin-bottom:5px}
.place-section-sheet .questions{margin-top:3px}
/* Reinvest the recovered top space between rows on word-to-number sheets. */
.place-section-sheet.long-sheet .questions{row-gap:14px}
.place-section-sheet.long-sheet.count-16 .questions{row-gap:8.2px}
.place-section-sheet.long-sheet.count-20 .questions{row-gap:5px}
/* Place-value cards get the same treatment, especially at dense counts. */
.place-section-sheet.place-value-sheet .questions{row-gap:17px}
.place-section-sheet.place-value-sheet.count-12 .questions{row-gap:12px}
.place-section-sheet.place-value-sheet.count-16 .questions{row-gap:15.5px}
.place-section-sheet.place-value-sheet.count-20 .questions{row-gap:14px}


/* v39: fact-family and factor-finder rebuild. */
/* Year 3 triangle: actual write-in lines for missing values; larger operation symbols. */
.family-svg-blank{stroke:#263f34;stroke-width:1.5;stroke-linecap:round}
.family-svg-symbol{font:700 15px Arial,sans-serif;fill:#4f5f57;letter-spacing:4px}

/* Years 4-5: one connected SVG house, including the four equation rows. */
.family-house-card{min-height:112px!important;display:flex;align-items:flex-start;justify-content:center;padding:0 3px 0 27px!important}
.family-house-svg{display:block;width:218px;height:108px;color:#64756c;overflow:visible}
.family-house-outline{fill:#fffefa;stroke:#64756c;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.house-svg-product{font:700 17px Arial,sans-serif;fill:#1f2824}
.house-svg-factor{font:700 14px Arial,sans-serif;fill:#1f2824}
.house-svg-symbol{font:700 10px Arial,sans-serif;fill:#65746c;letter-spacing:2px}
.house-eq-value{font:700 12px Arial,sans-serif;fill:#1f2824}
.house-eq-symbol{font:700 12px Arial,sans-serif;fill:#34463d}
/* Hide the legacy split roof/body implementation completely. */
.house-roof,.house-roof-svg,.house-body,.family-house{display:none!important}
.family-sheet.count-10 .family-house-card,.family-sheet.count-12 .family-house-card{min-height:108px!important}
.family-sheet.count-10 .family-house-svg,.family-sheet.count-12 .family-house-svg{width:210px;height:103px}
.family-sheet.count-10 .questions{gap:6px 16px}
.family-sheet.count-12 .questions{gap:3px 14px;margin-top:6px}

/* Year 6 factor finder: one visible response box for every factor. */
.factor-answer-line{display:none!important}
.factor-boxes{display:grid;grid-template-columns:repeat(var(--factor-count),minmax(28px,36px));gap:5px;align-items:center;justify-content:start}
.factor-box{height:27px;border:1px solid #8f9d96;border-radius:3px;background:#fff;display:flex;align-items:center;justify-content:center;font:700 11px Arial,sans-serif;box-sizing:border-box}
.factor-sheet.count-10 .factor-box,.factor-sheet.count-12 .factor-box{height:24px}
.factor-sheet.count-10 .factor-card,.factor-sheet.count-12 .factor-card{min-height:48px}

@media print{
  .family-house-svg{width:218px;height:108px}
  .family-sheet.count-10 .family-house-svg,.family-sheet.count-12 .family-house-svg{width:210px;height:103px}
  .factor-boxes{grid-template-columns:repeat(var(--factor-count),minmax(28px,36px))}
}


/* Keep browser Print/Save at the same visual proportions as the 595px preview. */
@media print{
  .family-house-card{min-height:145px!important}
  .family-house-svg{width:290px;height:142px}
  .family-sheet.count-10 .family-house-card,.family-sheet.count-12 .family-house-card{min-height:139px!important}
  .family-sheet.count-10 .family-house-svg,.family-sheet.count-12 .family-house-svg{width:280px;height:137px}
  .family-sheet.count-12 .questions{gap:4px 18px}
  .factor-boxes{grid-template-columns:repeat(var(--factor-count),minmax(37px,48px));gap:7px}
  .factor-box{height:34px;font-size:14px}
  .factor-sheet.count-10 .factor-box,.factor-sheet.count-12 .factor-box{height:31px}
  .factor-sheet.count-10 .factor-card,.factor-sheet.count-12 .factor-card{min-height:61px}
}


/* v40: Year 4-5 fact-family houses are taller and narrower; maximum 10 per page. */
.family-sheet .family-house-card{min-height:142px!important}
.family-sheet .family-house-svg{width:182px;height:138px}
.family-sheet.count-10 .family-house-card{min-height:136px!important}
.family-sheet.count-10 .family-house-svg{width:178px;height:134px}
.family-sheet.count-10 .questions{gap:7px 22px}
.family-sheet .house-svg-product{font-size:18px}
.family-sheet .house-svg-factor{font-size:14px}
.family-sheet .house-svg-symbol{font-size:10px}
.family-sheet .house-eq-value,.family-sheet .house-eq-symbol{font-size:12.5px}
@media print{
  .family-sheet .family-house-card{min-height:181px!important}
  .family-sheet .family-house-svg{width:240px;height:181px}
  .family-sheet.count-10 .family-house-card{min-height:174px!important}
  .family-sheet.count-10 .family-house-svg{width:232px;height:175px}
  .family-sheet.count-10 .questions{gap:6px 24px}
}


/* v41: reclaim top space and make Year 4-5 fact-family houses narrower/taller. */
.family-house-sheet .instructions{margin-bottom:3px}
.family-house-sheet .questions{margin-top:2px}
.family-house-sheet .family-house-card{min-height:148px!important}
.family-house-sheet .family-house-svg{width:170px;height:148px}
.family-house-sheet.count-10 .family-house-card{min-height:144px!important}
.family-house-sheet.count-10 .family-house-svg{width:166px;height:145px}
.family-house-sheet.count-10 .questions{gap:5px 28px}
@media print{
  .family-house-sheet .instructions{margin-bottom:4px}
  .family-house-sheet .questions{margin-top:2px}
  .family-house-sheet .family-house-card{min-height:176px!important}
  .family-house-sheet .family-house-svg{width:202px;height:176px}
  .family-house-sheet.count-10 .family-house-card{min-height:172px!important}
  .family-house-sheet.count-10 .family-house-svg{width:198px;height:172px}
  .family-house-sheet.count-10 .questions{gap:4px 30px}
}


/* v47: larger written-number prompts. Wrapping is intentional. */
.long-sheet .long-prompt{font-size:16.5px;line-height:1.28}
.long-sheet.count-20 .long-prompt{font-size:14.5px;line-height:1.24}


/* v51: optional prime/composite classification on Year 6 Factor finder. */
.factor-topline{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:10px}
.factor-topline .factor-prompt{margin-bottom:0}
.prime-composite-choice{display:flex;align-items:center;gap:6px;white-space:nowrap;font-size:12.5px;font-weight:700;color:#39453f}
.pc-box{width:15px;height:15px;border:1px solid #6f7c75;border-radius:2px;background:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:800;line-height:1;box-sizing:border-box}
.factor-sheet.count-10 .factor-topline,.factor-sheet.count-12 .factor-topline{margin-bottom:6px}
.factor-sheet.count-10 .prime-composite-choice,.factor-sheet.count-12 .prime-composite-choice{font-size:11.5px}
.factor-sheet.count-10 .pc-box,.factor-sheet.count-12 .pc-box{width:14px;height:14px;font-size:10px}
@media screen and (max-width:760px){
  .factor-topline{align-items:flex-start;flex-wrap:wrap;gap:5px 12px}
}
@media print{
  .prime-composite-choice{font-size:13px;gap:7px}
  .pc-box{width:16px;height:16px;font-size:12px}
}


/* v52: keep Year 6 Factor finder 12-question browser Print/Save sheet clear of footer. */
@media print{
  .factor-sheet.count-12 .questions{row-gap:5px;margin-top:8px}
  .factor-sheet.count-12 .factor-card{min-height:54px;padding-bottom:4px}
  .factor-sheet.count-12 .factor-topline{margin-bottom:4px}
  .factor-sheet.count-12 .factor-box{height:27px}
}


/* v54: make Larger addition/subtraction Print/Save use the page vertically like the preview.
   Question/calculation sizes stay unchanged; the extra A4 height is distributed between rows. */
@media print{
  .vertical-sheet .questions{align-content:space-between!important}
  .vertical-sheet.count-8 .questions{height:160mm!important}
  .vertical-sheet.count-10 .questions{height:196mm!important}
  .vertical-sheet.count-12 .questions{height:202mm!important}
  .vertical-sheet.count-16 .questions{height:185mm!important}
  .vertical-sheet.three-column.count-18 .questions{height:160mm!important}
  .vertical-sheet.three-column.count-24 .questions{height:185mm!important}
}


/* v57: Year 6 decimal addition/subtraction written algorithms. */
.decimal-vertical-q .decimal-point{font-weight:700}
.decimal-vertical-q .digit-row{font-variant-numeric:tabular-nums}


/* v61 Mixed Practice */
.mixed-practice-btn{display:block;width:100%;border:1px solid rgba(255,255,255,.26);background:var(--sidebar-button);color:#fff;border-radius:7px;padding:11px;font-weight:800;text-align:center;font-size:14px}
.mixed-practice-btn:hover,.mixed-practice-btn.active{background:var(--sidebar-hover);border-color:var(--sidebar-hover)}
.mixed-nav-wrap{display:grid;gap:0}
.mixed-controls-top{display:grid;grid-template-columns:minmax(180px,260px) 1fr;align-items:end;gap:18px}
.mixed-check-group{display:flex;align-items:center;gap:22px;flex-wrap:wrap;padding-bottom:10px}
.mixed-answer-check{padding-bottom:0}
.mixed-picker-heading{font-size:12px;font-weight:800;color:var(--green);letter-spacing:.4px;margin-top:18px;padding-top:16px;border-top:1px solid #ddd8cc}
.mixed-activity-picker{display:grid;grid-template-columns:repeat(3,minmax(170px,1fr));gap:9px 12px;margin-top:10px}
.mixed-choice{display:flex;align-items:flex-start;gap:8px;padding:10px 11px;border:1px solid var(--line);border-radius:7px;background:#fff;font-size:13px;font-weight:700;line-height:1.2;cursor:pointer}
.mixed-choice input{width:17px;height:17px;accent-color:var(--green);margin:0;flex:0 0 auto}
.mixed-choice:has(input:checked){background:var(--green-3);border-color:var(--green)}
.mixed-choice.disabled{opacity:.45;cursor:not-allowed}
.mixed-picker-note{font-size:12px;color:var(--muted);margin-top:8px}
.mixed-sheet .instructions{margin-bottom:9px}
.mixed-sections{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:10px;margin-top:8px;height:590px}
.mixed-sections.mixed-layout-1{grid-template-columns:1fr;grid-template-rows:1fr}
.mixed-sections.mixed-layout-2{grid-template-columns:1fr;grid-template-rows:1fr 1fr}
.mixed-sections.mixed-layout-3 .mixed-section:nth-child(3){grid-column:1 / -1}
.mixed-section{border:1px solid #c7d0ca;border-radius:7px;padding:8px 9px;break-inside:avoid;overflow:hidden;min-width:0}
.mixed-section-title{font-size:13px;font-weight:800;color:#2b4939;margin-bottom:7px;padding-bottom:5px;border-bottom:1px solid #d9dfdb}
.mixed-question-grid{display:grid;grid-template-columns:1fr 1fr;gap:5px 18px;align-content:start}
.mixed-question-grid.one-col,.mixed-slot-quarter .mixed-question-grid{grid-template-columns:1fr}
.mixed-q{position:relative;padding-left:22px;min-height:28px;font-size:14px;line-height:1.25}
.mixed-qnum{position:absolute;left:0;top:2px;font-size:10px;font-weight:800;color:#6b766f}
.mixed-q.basic{min-height:24px;font-size:15px}
.mixed-q .answer-line{min-width:58px}
.mixed-q.vertical{min-height:67px}
.mixed-slot-quarter .mixed-q.vertical{min-height:62px}
.mixed-q.vertical .vertical-q{width:150px;margin:0 auto 0 18px}
.mixed-slot-quarter .mixed-q.vertical .vertical-q{width:135px;margin-left:10px}
.mixed-q.vertical .vertical-q .row{font-size:16px;min-height:18px;line-height:1.05}
.mixed-slot-quarter .mixed-q.vertical .vertical-q .row{font-size:15px}
.mixed-q.vertical .work-lines{height:17px}
.mixed-q.long{min-height:32px;border-bottom:1px solid #edf0ee;padding-bottom:5px}
.mixed-q.long .mixed-long-answer{float:right;min-width:125px;text-align:right}
.mixed-q.pv{min-height:59px;border:1px solid #e0e5e1;border-radius:6px;padding:7px 8px 7px 28px}
.mixed-q.pv .pv-number{font-size:18px;margin-bottom:5px}
.mixed-q.pv .pv-prompts{font-size:10.5px;gap:2px}
.mixed-q.family{min-height:53px}
.mixed-family-lines{display:grid;grid-template-columns:1fr 1fr;gap:2px 10px;font-size:11px;margin-top:3px}
.mixed-slot-quarter .mixed-family-lines{grid-template-columns:1fr}
.mixed-q.factor{min-height:31px}
.mixed-sheet .sheet-title{margin-top:6px}
.mixed-sheet .sheet-meta{margin-top:11px}
.mixed-sheet .instructions{margin-top:11px}
@media screen and (max-width:1050px){.mixed-activity-picker{grid-template-columns:repeat(2,minmax(150px,1fr))}}
@media screen and (max-width:760px){.mixed-controls-top{grid-template-columns:1fr}.mixed-activity-picker{grid-template-columns:1fr}.mixed-question-grid{grid-template-columns:1fr}}
@media print{.mixed-sections{height:208mm!important}.mixed-section{break-inside:avoid}.mixed-q.long{border-bottom:0}}

/* v64 Mixed Practice: make every format scale to its allocated grid area. */
.mixed-section{display:flex;flex-direction:column}
.mixed-section-title{flex:0 0 auto}
.mixed-question-grid{
  flex:1 1 auto;
  min-height:0;
  display:grid;
  grid-template-columns:repeat(var(--mixed-cols,2),minmax(0,1fr));
  grid-template-rows:repeat(var(--mixed-rows,1),minmax(0,1fr));
  gap:4px 16px;
  align-items:stretch;
}
.mixed-question-grid.one-col,.mixed-slot-quarter .mixed-question-grid{grid-template-columns:repeat(var(--mixed-cols,1),minmax(0,1fr))}
.mixed-q{min-height:0;height:100%;display:flex;align-items:center;box-sizing:border-box}
.mixed-qnum{top:50%;transform:translateY(-50%)}
.mixed-q.vertical{min-height:0;align-items:center}
.mixed-q.vertical .vertical-q{margin-top:0;margin-bottom:0}
.mixed-q.long{min-height:0;align-items:center}
.mixed-q.pv{min-height:0;align-content:center;display:block}
.mixed-q.family{min-height:0;display:block;padding-top:5px}
.mixed-q.factor{min-height:0}

/* Quarter allocation: compact but still readable. */
.mixed-slot-quarter .mixed-section-title{font-size:13px}
.mixed-slot-quarter .mixed-q{font-size:13px}
.mixed-slot-quarter .mixed-q.basic{font-size:16px}
.mixed-slot-quarter .mixed-q.vertical .vertical-q{width:138px;margin-left:10px}
.mixed-slot-quarter .mixed-q.vertical .vertical-q .row{font-size:15px;min-height:17px}
.mixed-slot-quarter .mixed-q.long{font-size:12px}
.mixed-slot-quarter .mixed-q.pv .pv-number{font-size:18px}
.mixed-slot-quarter .mixed-q.pv .pv-prompts{font-size:10.5px}
.mixed-slot-quarter .mixed-family-lines{font-size:11px}
.mixed-slot-quarter .mixed-q.factor{font-size:12px}

/* Half-page allocation: noticeably larger than a quarter. */
.mixed-slot-half{padding:10px 12px}
.mixed-slot-half .mixed-section-title{font-size:15px;margin-bottom:8px;padding-bottom:6px}
.mixed-slot-half .mixed-q{font-size:15px;padding-left:25px}
.mixed-slot-half .mixed-qnum{font-size:11px}
.mixed-slot-half .mixed-q.basic{font-size:19px}
.mixed-slot-half .mixed-q .answer-line{min-width:72px}
.mixed-slot-half .mixed-q.vertical .vertical-q{width:178px;margin-left:20px}
.mixed-slot-half .mixed-q.vertical .vertical-q .row{font-size:19px;min-height:21px}
.mixed-slot-half .mixed-q.vertical .work-lines{height:21px}
.mixed-slot-half .mixed-q.long{font-size:14px}
.mixed-slot-half .mixed-q.long .mixed-long-answer{min-width:150px}
.mixed-slot-half .mixed-q.pv{padding:9px 10px 9px 31px}
.mixed-slot-half .mixed-q.pv .pv-number{font-size:23px;margin-bottom:7px}
.mixed-slot-half .mixed-q.pv .pv-prompts{font-size:12px}
.mixed-slot-half .mixed-q.family{font-size:14px}
.mixed-slot-half .mixed-family-lines{font-size:13px;gap:4px 14px}
.mixed-slot-half .mixed-q.factor{font-size:14px}

/* Full-page allocation: use the extra room for classroom-friendly scale. */
.mixed-slot-full{padding:12px 14px}
.mixed-slot-full .mixed-section-title{font-size:17px;margin-bottom:10px;padding-bottom:7px}
.mixed-slot-full .mixed-q{font-size:16px;padding-left:29px}
.mixed-slot-full .mixed-qnum{font-size:12px}
.mixed-slot-full .mixed-q.basic{font-size:21px}
.mixed-slot-full .mixed-q .answer-line{min-width:86px}
.mixed-slot-full .mixed-q.vertical .vertical-q{width:205px;margin-left:26px}
.mixed-slot-full .mixed-q.vertical .vertical-q .row{font-size:21px;min-height:23px}
.mixed-slot-full .mixed-q.vertical .work-lines{height:24px}
.mixed-slot-full .mixed-q.long{font-size:15px}
.mixed-slot-full .mixed-q.long .mixed-long-answer{min-width:175px}
.mixed-slot-full .mixed-q.pv{padding:11px 12px 11px 35px}
.mixed-slot-full .mixed-q.pv .pv-number{font-size:26px;margin-bottom:8px}
.mixed-slot-full .mixed-q.pv .pv-prompts{font-size:13px}
.mixed-slot-full .mixed-q.family{font-size:15px}
.mixed-slot-full .mixed-family-lines{font-size:14px;gap:5px 16px}
.mixed-slot-full .mixed-q.factor{font-size:15px}

@media print{
  .mixed-question-grid{grid-template-columns:repeat(var(--mixed-cols,2),minmax(0,1fr))!important;grid-template-rows:repeat(var(--mixed-rows,1),minmax(0,1fr))!important}
}


/* v65 Mixed Practice consistency: preview is the master layout for print/save. */
.mixed-q .answer-line{
  transform:none;
  vertical-align:baseline;
  height:.9em;
  position:relative;
  top:0;
}
.mixed-q.long{
  gap:10px;
}
.mixed-q.long .mixed-long-answer{
  float:none;
  margin-left:auto;
  display:inline-flex;
  align-items:flex-end;
  align-self:center;
  min-height:1.15em;
}
.mixed-q.long .long-answer-line,
.mixed-q.factor .long-answer-line{
  height:1em;
  vertical-align:baseline;
  position:relative;
  top:0;
}
.mixed-q.pv .pv-answer-line{
  vertical-align:baseline;
  height:.95em;
}
@media print{
  /* Render the mixed sheet from the exact same 595 × 842 design canvas as preview,
     then scale that canvas to physical A4. This preserves all proportions. */
  .mixed-sheet{
    width:595px!important;
    max-width:595px!important;
    height:842px!important;
    min-height:842px!important;
    max-height:842px!important;
    padding:32px 34px 32px!important;
    margin:0!important;
    zoom:1.3333333333;
    overflow:hidden!important;
  }
  .mixed-sheet .mixed-sections{height:590px!important}
  .mixed-sheet .sheet-footer{left:34px!important;right:34px!important;bottom:22px!important}
  .mixed-sheet .mixed-q.long{border-bottom:1px solid #edf0ee!important}
}

/* v66 Mixed Practice fidelity: reuse standalone fact-family visuals and preserve place-value breathing room. */
.mixed-q.family{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:3px 4px 3px 24px;
  overflow:visible;
}
.mixed-family-visual{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:visible}
.mixed-family-svg{display:block;color:#64756c;overflow:visible;max-width:100%;max-height:100%}
.mixed-family-triangle{width:150px;height:92px}
.mixed-family-house{width:128px;height:108px}
.mixed-slot-half .mixed-family-triangle{width:175px;height:108px}
.mixed-slot-half .mixed-family-house{width:150px;height:126px}
.mixed-slot-full .mixed-family-triangle{width:195px;height:120px}
.mixed-slot-full .mixed-family-house{width:170px;height:143px}
.mixed-q.family .mixed-qnum{left:4px}
.mixed-q.pv .pv-number{padding-left:3px;padding-right:3px}


/* v68 Mixed renderer corrections */
/* Keep vertical algorithms comfortably inside their section border. */
.mixed-q.vertical{align-items:flex-start;padding-top:7px;padding-bottom:4px}
.mixed-q.vertical .mixed-qnum{top:8px;transform:none}
.mixed-q.vertical .vertical-q{padding-top:2px}

/* Fact families: quarter = 1×2; half = 2×2; full = 2×4. */
.mixed-kind-family .mixed-question-grid{grid-template-columns:repeat(var(--mixed-cols,1),minmax(0,1fr))}
.mixed-q.family{padding-left:0;padding-right:0;display:flex;align-items:center;justify-content:center}
.mixed-q.family .mixed-qnum{left:4px;top:50%;transform:translateY(-50%)}
.mixed-family-visual{width:100%;display:flex;align-items:center;justify-content:center}
.mixed-family-triangle{margin-left:auto;margin-right:auto}

/* Factor Finder: same one-box-per-factor scaffold as standalone. */
.mixed-q.factor{display:block;padding:5px 5px 5px 28px;position:relative}
.mixed-q.factor .mixed-qnum{left:3px;top:7px;transform:none}
.mixed-factor-content{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;gap:6px}
.mixed-q.factor .factor-prompt{font-size:inherit}
.mixed-q.factor .factor-boxes{display:grid;grid-template-columns:repeat(var(--factor-count),minmax(0,1fr));gap:4px;width:100%;max-width:100%;justify-content:start}
.mixed-q.factor .factor-box{width:auto;min-width:0;height:24px}
.mixed-slot-half .mixed-q.factor .factor-box{height:28px;font-size:12px}
.mixed-slot-full .mixed-q.factor .factor-box{height:31px;font-size:13px}

/* v70 Mixed two-page alignment fixes */
/* Place-value cards vertically centre their content inside each allocated row. */
.mixed-q.pv{
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:stretch;
}
.mixed-q.pv .mixed-qnum{top:50%;transform:translateY(-50%)}

/* Centre Year 3 fact-family triangles on the full question cell, independent of the question number. */
.mixed-q.family{position:relative}
.mixed-q.family .mixed-family-visual{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  width:auto;
  height:auto;
}
.mixed-q.family .mixed-qnum{z-index:2}
.mixed-family-triangle{margin:0!important}


/* v72 Mixed Practice refinements. */
/* Quarter-page number-word prompts may need two lines; keep the answer rule compact. */
.mixed-slot-quarter .mixed-q.long{
  gap:6px;
  line-height:1.15;
  align-items:center;
}
.mixed-slot-quarter .mixed-q.long > span:nth-child(2){
  flex:1 1 auto;
  min-width:0;
  white-space:normal;
  overflow-wrap:break-word;
}
.mixed-slot-quarter .mixed-q.long .mixed-long-answer{
  flex:0 0 62px;
  min-width:62px!important;
  max-width:62px;
  margin-left:4px;
}
.mixed-slot-quarter .mixed-q.long .long-answer-line{
  width:62px;
  min-width:62px;
}

/* v73 Factor Finder browser scaffold: keep boxes below the prompt and cap their width. */
.mixed-q.factor .mixed-factor-content{justify-content:center;align-items:flex-start;overflow:visible}
.mixed-q.factor .factor-prompt{flex:0 0 auto;width:100%;margin:0 0 6px 0;line-height:1.2}
.mixed-q.factor .factor-boxes{
  display:grid;
  grid-template-columns:repeat(var(--factor-cols),minmax(28px,36px));
  gap:5px;
  width:auto;
  max-width:100%;
  justify-content:start;
  align-items:center;
}
.mixed-q.factor .factor-box{width:auto;min-width:28px;max-width:36px;height:27px}
.mixed-slot-half .mixed-q.factor .factor-boxes{grid-template-columns:repeat(var(--factor-cols),minmax(32px,40px));gap:6px}
.mixed-slot-half .mixed-q.factor .factor-box{min-width:32px;max-width:40px;height:29px;font-size:12px}
.mixed-slot-full .mixed-q.factor .factor-boxes{grid-template-columns:repeat(var(--factor-cols),minmax(37px,48px));gap:7px}
.mixed-slot-full .mixed-q.factor .factor-box{min-width:37px;max-width:48px;height:34px;font-size:14px}


/* v74 Mixed Practice spacing + wrapping refinements. */
/* Give half/full-page written algorithms more breathing room between grid rows. */
.mixed-slot-half .mixed-q.vertical{
  padding-top:11px;
  padding-bottom:11px;
}
.mixed-slot-full .mixed-q.vertical{
  padding-top:13px;
  padding-bottom:13px;
}

/* Number-word prompts wrap at every mixed size. Keep the answer rule compact so
   the wording gets the majority of horizontal space. */
.mixed-q.long{
  display:flex;
  align-items:center;
  gap:8px;
  line-height:1.16;
}
.mixed-q.long > span:nth-child(2){
  flex:1 1 auto;
  min-width:0;
  white-space:normal;
  overflow-wrap:break-word;
}
.mixed-q.long .mixed-long-answer{
  flex:0 0 auto;
  margin-left:4px;
}
.mixed-slot-quarter .mixed-q.long .mixed-long-answer,
.mixed-slot-quarter .mixed-q.long .long-answer-line{
  width:62px;
  min-width:62px!important;
  max-width:62px;
}
.mixed-slot-half .mixed-q.long .mixed-long-answer,
.mixed-slot-half .mixed-q.long .long-answer-line{
  width:88px;
  min-width:88px!important;
  max-width:88px;
}
.mixed-slot-full .mixed-q.long .mixed-long-answer,
.mixed-slot-full .mixed-q.long .long-answer-line{
  width:105px;
  min-width:105px!important;
  max-width:105px;
}
/* v79 Mixed Place Value alignment and overflow fixes */
.mixed-q.pv{
  padding-left:24px;
  padding-right:8px;
  min-width:0;
}
.mixed-q.pv .mixed-qnum{
  left:8px;
}
.mixed-q.pv .pv-number{
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  padding-left:0;
  padding-right:0;
  overflow:visible;
}
.mixed-slot-quarter .mixed-q.pv{padding-left:25px;padding-right:7px}
.mixed-slot-half .mixed-q.pv{padding-left:27px;padding-right:9px}
.mixed-slot-full .mixed-q.pv{padding-left:29px;padding-right:10px}

/* Long whole/decimal place-value strings scale down before they can escape the card. */
.mixed-slot-quarter .mixed-q.pv .pv-number.pv-number-wide{font-size:15.5px}
.mixed-slot-quarter .mixed-q.pv .pv-number.pv-number-very-wide{font-size:13.5px}
.mixed-slot-half .mixed-q.pv .pv-number.pv-number-wide{font-size:19px}
.mixed-slot-half .mixed-q.pv .pv-number.pv-number-very-wide{font-size:16.5px}
.mixed-slot-full .mixed-q.pv .pv-number.pv-number-wide{font-size:21px}
.mixed-slot-full .mixed-q.pv .pv-number.pv-number-very-wide{font-size:18px}

/* v80 Mixed answer-writing space refinements */
/* Give students a little more room below vertical algorithms without changing digit sizing. */
.mixed-slot-quarter .mixed-q.vertical .work-lines{height:19px}
.mixed-slot-half .mixed-q.vertical .work-lines{height:25px}
.mixed-slot-full .mixed-q.vertical .work-lines{height:28px}

/* Drop only the Place Value answer rules slightly; keep labels and surrounding spacing unchanged. */
.mixed-q.pv .pv-answer-line{
  position:relative;
  top:2px;
}

/* v81: More writing room for mixed written algorithms. */
/* These are the larger whole-number and decimal addition/subtraction layouts. */
.mixed-slot-quarter .mixed-q.vertical .work-lines{height:25px}
.mixed-slot-half .mixed-q.vertical .work-lines{height:35px}
.mixed-slot-full .mixed-q.vertical .work-lines{height:39px}

/* v82: Half-page mixed written algorithms — keep generous answer space, but separate questions more clearly. */
.mixed-slot-half.mixed-kind-vertical .mixed-question-grid{
  row-gap:10px;
}
.mixed-slot-half.mixed-kind-vertical .mixed-q.vertical .vertical-q .row{
  font-size:18px;
  min-height:20px;
}
.mixed-slot-half.mixed-kind-vertical .mixed-q.vertical .vertical-q{
  width:174px;
}


/* v83: Half-page Mixed Place Value — stronger scaling for long values. */
.mixed-slot-half .mixed-q.pv .pv-number.pv-number-wide{font-size:17.5px}
.mixed-slot-half .mixed-q.pv .pv-number.pv-number-very-wide{font-size:15px}
.mixed-slot-half .mixed-q.pv .pv-number.pv-number-ultra-wide{font-size:13px}
/* Keep especially long values clipped to their own card as a final safety net. */
.mixed-slot-half .mixed-q.pv .pv-number{max-width:100%;overflow:hidden}

/* v84: Half-page Mixed Place Value vertical fit. */
/* Give full-size values enough glyph height so ascenders/descenders are not clipped. */
.mixed-slot-half .mixed-q.pv .pv-number{
  line-height:1.16;
  min-height:1.38em;
  align-items:center;
  overflow:visible;
  padding-top:1px;
  padding-bottom:1px;
}
/* Long-value classes still scale to fit horizontally; keep their vertical box generous too. */
.mixed-slot-half .mixed-q.pv .pv-number.pv-number-wide,
.mixed-slot-half .mixed-q.pv .pv-number.pv-number-very-wide,
.mixed-slot-half .mixed-q.pv .pv-number.pv-number-ultra-wide{
  line-height:1.16;
  min-height:1.38em;
}


/* v85: Mixed Factor Finder browser layout + rendered-PDF aspect-ratio fidelity. */
.mixed-q.factor .mixed-factor-content{
  justify-content:flex-start;
  align-items:stretch;
  min-height:0;
  padding-top:4px;
  overflow:hidden;
}
.mixed-q.factor .factor-prompt{
  flex:0 0 auto;
  width:100%;
  margin:0 0 7px 0;
  line-height:1.2;
}
.mixed-q.factor .factor-boxes{
  flex:0 0 auto;
  grid-template-columns:repeat(var(--factor-cols),minmax(0,1fr));
  width:100%;
  max-width:100%;
  gap:5px;
}
.mixed-slot-half .mixed-q.factor .factor-boxes{gap:6px}
.mixed-slot-full .mixed-q.factor .factor-boxes{gap:7px}
.mixed-slot-half .mixed-q.factor .factor-box,
.mixed-slot-full .mixed-q.factor .factor-box{
  width:100%;
  min-width:0;
  max-width:none;
}


/* v86: Mixed Factor Finder uses real bounded answer boxes, not stretched rows. */
.mixed-q.factor .factor-boxes{
  display:grid;
  grid-template-columns:repeat(var(--factor-cols),minmax(28px,36px));
  gap:5px;
  width:auto;
  max-width:100%;
  justify-content:start;
  align-items:center;
}
.mixed-q.factor .factor-box{
  width:auto;
  min-width:28px;
  max-width:36px;
  height:27px;
  border:1px solid #8f9d96;
  border-radius:3px;
  background:#fff;
  box-sizing:border-box;
}
.mixed-slot-half .mixed-q.factor .factor-boxes{
  grid-template-columns:repeat(var(--factor-cols),minmax(32px,40px));
  gap:6px;
}
.mixed-slot-half .mixed-q.factor .factor-box{min-width:32px;max-width:40px;height:29px}
.mixed-slot-full .mixed-q.factor .factor-boxes{
  grid-template-columns:repeat(var(--factor-cols),minmax(37px,48px));
  gap:7px;
}
.mixed-slot-full .mixed-q.factor .factor-box{min-width:37px;max-width:48px;height:34px}

/* v87: Mixed Factor Finder stays contained inside each question row. */
.mixed-q.factor{
  overflow:hidden;
}
.mixed-q.factor .mixed-factor-content{
  width:100%;
  height:100%;
  min-height:0;
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:flex-start;
  gap:7px;
  padding:0;
  overflow:hidden;
}
.mixed-q.factor .factor-prompt{
  flex:0 0 auto;
  width:auto;
  margin:0;
  line-height:1.15;
  white-space:nowrap;
}
.mixed-q.factor .factor-boxes{
  flex:1 1 auto;
  min-width:0;
  width:auto;
  max-width:none;
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  justify-content:flex-start;
  gap:4px;
  overflow:hidden;
}
.mixed-q.factor .factor-box{
  flex:1 1 0;
  width:auto;
  min-width:14px;
  max-width:36px;
  height:25px;
  border:1px solid #8f9d96;
  border-radius:3px;
  background:#fff;
  box-sizing:border-box;
}
.mixed-slot-half .mixed-q.factor .factor-box{
  min-width:18px;
  max-width:40px;
  height:28px;
}
.mixed-slot-full .mixed-q.factor .factor-box{
  min-width:20px;
  max-width:44px;
  height:31px;
}
/* Quarter-page cards can use two contained rows of boxes when there are many factors. */
.mixed-slot-quarter .mixed-q.factor .mixed-factor-content{gap:5px}
.mixed-slot-quarter .mixed-q.factor .factor-prompt{font-size:11px}
.mixed-slot-quarter .mixed-q.factor .factor-boxes{
  display:grid;
  grid-template-columns:repeat(min(var(--factor-count), 6), minmax(14px,1fr));
  grid-auto-rows:20px;
  gap:3px;
  max-height:43px;
  overflow:hidden;
}
.mixed-slot-quarter .mixed-q.factor .factor-box{
  width:100%;
  min-width:0;
  max-width:none;
  height:20px;
}

/* v88: Mixed Factor Finder may wrap, but each question row owns its full wrapped height. */
.mixed-kind-factor .mixed-question-grid{
  grid-template-rows:repeat(var(--mixed-rows,1),auto)!important;
  align-content:space-between;
  row-gap:6px;
}
.mixed-q.factor{
  height:auto;
  min-height:0;
  overflow:visible;
  padding-top:4px;
  padding-bottom:4px;
}
.mixed-q.factor .mixed-factor-content{
  width:100%;
  height:auto;
  min-height:0;
  display:flex;
  flex-direction:row;
  align-items:flex-start;
  justify-content:flex-start;
  gap:6px;
  padding:0;
  overflow:visible;
}
.mixed-q.factor .factor-prompt{
  flex:0 0 auto;
  width:auto;
  margin:3px 0 0 0;
  line-height:1.15;
  white-space:nowrap;
}
.mixed-q.factor .factor-boxes{
  flex:1 1 auto;
  min-width:0;
  width:auto;
  max-width:none;
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  justify-content:flex-start;
  gap:4px;
  overflow:visible;
}
.mixed-q.factor .factor-box{
  flex:0 0 28px;
  width:28px;
  min-width:28px;
  max-width:28px;
  height:25px;
}
.mixed-slot-quarter .mixed-q.factor .factor-box{
  flex-basis:21px;
  width:21px;
  min-width:21px;
  max-width:21px;
  height:21px;
}
.mixed-slot-half .mixed-q.factor .factor-box{
  flex-basis:31px;
  width:31px;
  min-width:31px;
  max-width:31px;
  height:28px;
}
.mixed-slot-full .mixed-q.factor .factor-box{
  flex-basis:38px;
  width:38px;
  min-width:38px;
  max-width:38px;
  height:31px;
}

/* v88: emulate the browser Print/Save geometry for standalone Family/Factor PDF capture. */
.pdf-print-emulation{
  /* v107: capture the exact same design canvas as Preview.
     The finished 595 × 842 page is scaled uniformly to physical A4 by the PDF writer. */
  width:595px!important;
  min-width:595px!important;
  max-width:595px!important;
  height:842px!important;
  min-height:842px!important;
  max-height:842px!important;
  margin:0!important;
  padding:32px 34px 32px!important;
  border:0!important;
  box-shadow:none!important;
  background:#fff!important;
  overflow:hidden!important;
}
.pdf-print-emulation .sheet-footer{left:34px!important;right:34px!important;bottom:22px!important}

/* v89: Worksheets are strictly monochrome in every view/capture. */
.sheet{
  background:#fff!important;
  color:#000!important;
  border-color:#000!important;
}
.sheet .sheet-brand,
.sheet .sheet-title,
.sheet .instructions,
.sheet .qnum,
.sheet .mixed-qnum,
.sheet .mixed-section-title,
.sheet .sheet-footer,
.sheet .family-triangle,
.sheet .family-house,
.sheet .family-triangle-svg,
.sheet .family-house-svg,
.sheet .mixed-family-svg,
.sheet .roof-symbol,
.sheet .house-svg-symbol,
.sheet .family-svg-symbol,
.sheet .prime-composite-choice{
  color:#000!important;
}
.sheet .question,
.sheet .mixed-section,
.sheet .mixed-q,
.sheet .mixed-q.pv,
.sheet .factor-box,
.sheet .pc-box,
.sheet .answer-line,
.sheet .long-answer-line,
.sheet .pv-answer-line,
.sheet .blank,
.sheet .work-lines,
.sheet .house-body,
.sheet .family-house-card,
.sheet .factor-card{
  border-color:#000!important;
}
.sheet .factor-box,
.sheet .pc-box,
.sheet .house-body,
.sheet .highlight-digit::before{
  background:#fff!important;
}
.sheet .highlight-digit::before{
  border-color:#000!important;
}
.sheet .mixed-section-title,
.sheet .sheet-footer{
  border-color:#000!important;
}
.sheet svg,
.sheet svg *{
  color:#000!important;
  stroke:#000!important;
}
.sheet svg text,
.sheet svg tspan{
  fill:#000!important;
  stroke:none!important;
}
/* Keep intentionally unfilled SVG shapes white/transparent rather than grey/coloured. */
.sheet svg path[fill="none"],
.sheet svg polygon[fill="none"],
.sheet svg line[fill="none"]{
  fill:none!important;
}

/* v89: Quarter-page Mixed Factor Finder gets three owned rows.
   Prompt and boxes share a row; boxes may wrap inside that row only. */
.mixed-slot-quarter.mixed-kind-factor .mixed-question-grid{
  grid-template-rows:repeat(var(--mixed-rows,3),minmax(0,1fr))!important;
  align-content:stretch!important;
  row-gap:4px!important;
}
.mixed-slot-quarter .mixed-q.factor{
  min-height:0!important;
  height:100%!important;
  overflow:hidden!important;
  padding:3px 4px 3px 22px!important;
  display:flex!important;
  align-items:center!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-qnum{
  left:3px!important;
  top:50%!important;
  transform:translateY(-50%)!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-content{
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  display:grid!important;
  grid-template-columns:auto minmax(0,1fr)!important;
  align-items:center!important;
  column-gap:5px!important;
  overflow:hidden!important;
}
.mixed-slot-quarter .mixed-q.factor .factor-prompt{
  margin:0!important;
  width:auto!important;
  max-width:86px!important;
  font-size:10.5px!important;
  line-height:1.1!important;
  white-space:nowrap!important;
}
.mixed-slot-quarter .mixed-q.factor .factor-boxes{
  min-width:0!important;
  width:100%!important;
  max-width:100%!important;
  display:flex!important;
  flex-wrap:wrap!important;
  align-content:center!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:2px!important;
  overflow:hidden!important;
}
.mixed-slot-quarter .mixed-q.factor .factor-box{
  flex:0 0 18px!important;
  width:18px!important;
  min-width:18px!important;
  max-width:18px!important;
  height:18px!important;
  border:1px solid #000!important;
  border-radius:2px!important;
  background:#fff!important;
  font-size:9px!important;
  line-height:1!important;
}
.sheet .house-roof{background:#000!important;border-bottom-color:#000!important}
.sheet .house-roof::after{background:#fff!important}
.sheet .house-body{background:#fff!important}


/* v90 refinements --------------------------------------------------------- */
/* True black-and-white fact-family houses: no off-white SVG fill. */
.sheet .family-house-outline{fill:#fff!important;stroke:#000!important}

/* Standalone Whole Numbers in Words: smaller prompt text and shorter writing line. */
.whole-words-sheet .long-prompt{
  font-size:14px!important;
  line-height:1.24!important;
  padding-right:112px!important;
}
.whole-words-sheet .long-answer{
  min-width:100px!important;
  width:100px!important;
}
.whole-words-sheet .long-answer-line{
  width:94px!important;
}
.whole-words-sheet.count-16 .long-prompt{font-size:13.2px!important}
.whole-words-sheet.count-20 .long-prompt{font-size:12.4px!important}

/* Quarter-page Mixed Factor Finder: prompt owns the first line; response boxes
   then get the entire width underneath, so wrapping uses the otherwise-empty space. */
.mixed-slot-quarter.mixed-kind-factor .mixed-question-grid{
  grid-template-rows:repeat(var(--mixed-rows,3),minmax(0,1fr))!important;
  row-gap:4px!important;
}
.mixed-slot-quarter .mixed-q.factor{
  min-height:0!important;
  height:100%!important;
  overflow:hidden!important;
  padding:3px 4px 3px 22px!important;
  display:block!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-qnum{
  left:3px!important;
  top:4px!important;
  transform:none!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-content{
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
  gap:3px!important;
  overflow:hidden!important;
}
.mixed-slot-quarter .mixed-q.factor .factor-prompt{
  margin:0!important;
  width:100%!important;
  max-width:none!important;
  font-size:10.5px!important;
  line-height:1.12!important;
  white-space:nowrap!important;
  flex:0 0 auto!important;
}
.mixed-slot-quarter .mixed-q.factor .factor-boxes{
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  display:flex!important;
  flex-wrap:wrap!important;
  align-content:flex-start!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  gap:3px!important;
  overflow:hidden!important;
  flex:1 1 auto!important;
}
.mixed-slot-quarter .mixed-q.factor .factor-box{
  flex:0 0 22px!important;
  width:22px!important;
  min-width:22px!important;
  max-width:22px!important;
  height:22px!important;
  border:1px solid #000!important;
  border-radius:2px!important;
  background:#fff!important;
  font-size:9px!important;
  line-height:1!important;
}

/* v91 --------------------------------------------------------------------- */
/* Standalone word/factor sheets: remove question separator rules. */
.long-sheet .question,
.factor-sheet .factor-card{
  border-bottom:0!important;
}

/* Smaller base wording on standalone number-word worksheets, but restore a
   useful writing line now that the unwanted separators are gone. */
.whole-words-sheet .long-prompt,
.decimal-words-sheet .long-prompt{
  font-size:13.2px!important;
  line-height:1.26!important;
  padding-right:150px!important;
}
.whole-words-sheet .long-answer,
.decimal-words-sheet .long-answer{
  min-width:138px!important;
  width:138px!important;
}
.whole-words-sheet .long-answer-line,
.decimal-words-sheet .long-answer-line{
  width:132px!important;
}
.whole-words-sheet.count-16 .long-prompt,
.decimal-words-sheet.count-16 .long-prompt{font-size:12.5px!important}
.whole-words-sheet.count-20 .long-prompt{font-size:11.9px!important}

/* Mixed Factor Finder: prompt and every answer box are siblings in one
   wrapping flex row. Boxes begin after the prompt, then wrap back to the full
   left edge beneath it instead of wrapping only under the previous boxes. */
.mixed-q.factor .mixed-factor-content.mixed-factor-flow{
  display:flex!important;
  flex-flow:row wrap!important;
  align-content:center!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:5px 5px!important;
  width:100%!important;
  height:auto!important;
  min-height:100%!important;
  overflow:visible!important;
}
.mixed-q.factor .mixed-factor-flow > .factor-prompt{
  flex:0 0 auto!important;
  width:auto!important;
  max-width:none!important;
  margin:0!important;
  white-space:nowrap!important;
  line-height:1.15!important;
}
.mixed-q.factor .mixed-factor-flow > .factor-box{
  flex:0 0 30px!important;
  width:30px!important;
  min-width:30px!important;
  max-width:30px!important;
  height:26px!important;
  border:1px solid #000!important;
  border-radius:3px!important;
  background:#fff!important;
  box-sizing:border-box!important;
}
.mixed-slot-half .mixed-q.factor .mixed-factor-flow > .factor-box{
  flex-basis:34px!important;
  width:34px!important;
  min-width:34px!important;
  max-width:34px!important;
  height:29px!important;
}
.mixed-slot-full .mixed-q.factor .mixed-factor-flow > .factor-box{
  flex-basis:40px!important;
  width:40px!important;
  min-width:40px!important;
  max-width:40px!important;
  height:32px!important;
}

/* Quarter-page Factor Finder gets dynamic-height rows. The question itself
   contains however many wrapped lines it needs, and the grid distributes the
   remaining vertical space between questions instead of clipping/wasting it. */
.mixed-slot-quarter.mixed-kind-factor .mixed-question-grid{
  display:flex!important;
  flex-direction:column!important;
  justify-content:space-between!important;
  gap:4px!important;
  height:100%!important;
}
.mixed-slot-quarter .mixed-q.factor{
  flex:0 0 auto!important;
  height:auto!important;
  min-height:0!important;
  overflow:visible!important;
  padding:4px 4px 4px 22px!important;
  display:block!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-qnum{
  left:3px!important;
  top:7px!important;
  transform:none!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-content.mixed-factor-flow{
  min-height:0!important;
  height:auto!important;
  gap:4px 4px!important;
  align-content:flex-start!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-flow > .factor-prompt{
  font-size:10.5px!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-flow > .factor-box{
  flex-basis:24px!important;
  width:24px!important;
  min-width:24px!important;
  max-width:24px!important;
  height:22px!important;
  font-size:9px!important;
}


/* v92: Quarter-page Mixed Factor Finder no longer reserves a large blank block.
   Let each question use only the height its wrapped prompt/boxes need, then
   distribute the remaining section height as breathing room BETWEEN questions. */
.mixed-slot-quarter.mixed-kind-factor .mixed-question-grid{
  display:flex!important;
  flex-direction:column!important;
  justify-content:space-evenly!important;
  align-items:stretch!important;
  gap:3px!important;
  height:100%!important;
}
.mixed-slot-quarter .mixed-q.factor{
  flex:0 0 auto!important;
  min-height:0!important;
  height:auto!important;
  padding-top:3px!important;
  padding-bottom:3px!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-content.mixed-factor-flow{
  min-height:0!important;
  height:auto!important;
  align-content:flex-start!important;
}

/* v93: Standalone Addition/Subtraction within 20.
   Keep the answer rule inline with the bottom edge of the equation text. */
.within20-sheet .question{
  align-items:baseline!important;
}
.within20-sheet .horizontal-q{
  display:block!important;
  min-width:0!important;
}
.within20-sheet .horizontal-q .answer-line{
  display:inline-block!important;
  height:.82em!important;
  vertical-align:bottom!important;
  transform:none!important;
  margin-left:5px!important;
  margin-bottom:0!important;
}

/* v93: Quarter-page Factor Finder. With wrapping fixed, use the available
   quarter-page height for an extra question instead of reserving dead space. */
.mixed-slot-quarter.mixed-kind-factor .mixed-question-grid{
  display:flex!important;
  flex-direction:column!important;
  justify-content:space-between!important;
  align-items:stretch!important;
  gap:2px!important;
  height:100%!important;
}
.mixed-slot-quarter .mixed-q.factor{
  flex:0 0 auto!important;
  min-height:0!important;
  height:auto!important;
  padding-top:2px!important;
  padding-bottom:2px!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-content.mixed-factor-flow{
  min-height:0!important;
  height:auto!important;
  gap:3px 4px!important;
  align-content:flex-start!important;
}


/* v94: Quarter-page Mixed Factor Finder stays at three questions. With the
   wrapping flow fixed, let those three questions use the available space more
   generously instead of squeezing in a fourth. */
.mixed-slot-quarter.mixed-kind-factor .mixed-question-grid{
  display:flex!important;
  flex-direction:column!important;
  justify-content:space-evenly!important;
  align-items:stretch!important;
  gap:5px!important;
  height:100%!important;
}
.mixed-slot-quarter .mixed-q.factor{
  flex:0 0 auto!important;
  padding-top:4px!important;
  padding-bottom:4px!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-content.mixed-factor-flow{
  gap:5px 5px!important;
  align-items:center!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-flow > .factor-prompt{
  font-size:11.5px!important;
  line-height:1.18!important;
}
.mixed-slot-quarter .mixed-q.factor .mixed-factor-flow > .factor-box{
  flex-basis:28px!important;
  width:28px!important;
  min-width:28px!important;
  max-width:28px!important;
  height:25px!important;
  font-size:10px!important;
}

/* v94: Use the same answer-line baseline treatment across every standalone
   basic-fact worksheet: within-20 addition/subtraction, multiplication,
   division, and both multiply/divide powers-of-10 activities. */
.basic-sheet .horizontal-q .answer-line{
  display:inline-block!important;
  height:.82em!important;
  vertical-align:bottom!important;
  transform:none!important;
  margin-left:5px!important;
  margin-bottom:0!important;
}

/* v95 Mixed number-word cleanup ----------------------------------------- */
/* No question separator rules on Mixed Whole Numbers/Decimals in Words. */
.mixed-sheet .mixed-q.long{border-bottom:0!important}
@media print{.mixed-sheet .mixed-q.long{border-bottom:0!important}}

/* Slightly longer student response lines without stealing too much prompt width. */
.mixed-slot-quarter .mixed-q.long .mixed-long-answer,
.mixed-slot-quarter .mixed-q.long .long-answer-line{width:72px;min-width:72px!important;max-width:72px}
.mixed-slot-half .mixed-q.long .mixed-long-answer,
.mixed-slot-half .mixed-q.long .long-answer-line{width:100px;min-width:100px!important;max-width:100px}
.mixed-slot-full .mixed-q.long .mixed-long-answer,
.mixed-slot-full .mixed-q.long .long-answer-line{width:120px;min-width:120px!important;max-width:120px}


/* v99: standalone Place Value — reclaim horizontal space and scale only genuinely long values. */
.place-value-sheet .questions{column-gap:14px}
.place-value-sheet .pv-number{max-width:100%;overflow:hidden}
.place-value-sheet .pv-number.pv-number-wide{font-size:24px}
.place-value-sheet .pv-number.pv-number-very-wide{font-size:22px}
.place-value-sheet .pv-number.pv-number-ultra-wide{font-size:19.5px}
.place-value-sheet.count-12 .pv-number.pv-number-wide{font-size:22px}
.place-value-sheet.count-12 .pv-number.pv-number-very-wide{font-size:20.5px}
.place-value-sheet.count-12 .pv-number.pv-number-ultra-wide{font-size:18.5px}
.place-value-sheet.count-16 .pv-number.pv-number-wide{font-size:20px}
.place-value-sheet.count-16 .pv-number.pv-number-very-wide{font-size:18.5px}
.place-value-sheet.count-16 .pv-number.pv-number-ultra-wide{font-size:17px}
.place-value-sheet.count-20 .pv-number.pv-number-wide{font-size:17.5px}
.place-value-sheet.count-20 .pv-number.pv-number-very-wide{font-size:16.5px}
.place-value-sheet.count-20 .pv-number.pv-number-ultra-wide{font-size:15.5px}
@media screen{
  .place-value-sheet .questions{column-gap:14px}
}
@media print{
  .place-value-sheet .questions{column-gap:14px}
}

/* v101: reclaim more space on standalone Place Value without changing v100 scaling. */
.place-value-sheet .questions{
  column-gap:8px!important;
  row-gap:10px!important;
}
.place-value-sheet.count-12 .questions{row-gap:7px!important}
.place-value-sheet.count-16 .questions{row-gap:9px!important}
.place-value-sheet.count-20 .questions{row-gap:8px!important}
.place-section-sheet.place-value-sheet .questions{row-gap:10px!important}
.place-section-sheet.place-value-sheet.count-12 .questions{row-gap:7px!important}
.place-section-sheet.place-value-sheet.count-16 .questions{row-gap:9px!important}
.place-section-sheet.place-value-sheet.count-20 .questions{row-gap:8px!important}
@media screen{
  .place-value-sheet .questions{column-gap:8px!important}
}
@media print{
  .place-value-sheet .questions{column-gap:8px!important}
}

/* v102: use recovered vertical room on standalone Place Value for larger cards and more writing space. */
.place-value-sheet .place-value-card{
  min-height:110px;
  padding-top:12px;
  padding-bottom:12px;
}
.place-value-sheet .pv-prompts{gap:8px}
.place-value-sheet .pv-answer-line{height:19px}

.place-value-sheet.count-12 .place-value-card{
  min-height:96px;
  padding-top:9px;
  padding-bottom:9px;
}
.place-value-sheet.count-12 .pv-prompts{gap:6px}
.place-value-sheet.count-12 .pv-answer-line{height:18px}

.place-value-sheet.count-16 .place-value-card{
  min-height:86px;
  padding-top:9px;
  padding-bottom:9px;
}
.place-value-sheet.count-16 .pv-prompts{gap:5px}
.place-value-sheet.count-16 .pv-answer-line{height:17px}

.place-value-sheet.count-20 .place-value-card{
  min-height:73px;
  padding-top:7px;
  padding-bottom:7px;
}
.place-value-sheet.count-20 .pv-prompts{gap:3px}
.place-value-sheet.count-20 .pv-answer-line{height:15px}

/* v103: Give high-count standalone written algorithms more student answer space.
   Keep digit sizing and question counts unchanged; use the available vertical room instead. */
.sheet.vertical-sheet.count-16:not(.answer-sheet) .work-lines{height:28px}
.sheet.vertical-sheet.count-16:not(.answer-sheet) .question{min-height:68px}

.sheet.vertical-sheet.three-column.count-18:not(.answer-sheet) .work-lines{height:30px}
.sheet.vertical-sheet.three-column.count-18:not(.answer-sheet) .question{min-height:70px}

.sheet.vertical-sheet.three-column.count-24:not(.answer-sheet) .work-lines{height:24px}
.sheet.vertical-sheet.three-column.count-24:not(.answer-sheet) .question{min-height:64px}

@media print{
  .vertical-sheet.count-16:not(.answer-sheet) .work-lines{height:28px!important}
  .vertical-sheet.three-column.count-18:not(.answer-sheet) .work-lines{height:30px!important}
  .vertical-sheet.three-column.count-24:not(.answer-sheet) .work-lines{height:24px!important}
}


/* v104: Decimal addition/subtraction have a two-line instruction.
   Reclaim one blank row between the instructions and first question without
   changing the larger high-count answer areas from v103. */
.decimal-algorithm-sheet:not(.answer-sheet) .questions{margin-top:5px}
@media print{
  .decimal-algorithm-sheet:not(.answer-sheet) .questions{margin-top:5px!important}
}

/* v105: use remaining bottom slack on high-count standalone Place Value sheets
   to give Column and Value more writing room. Keep v100/v101 number scaling untouched. */
.place-value-sheet.count-16 .place-value-card{
  min-height:90px;
  padding-top:9px;
  padding-bottom:10px;
}
.place-value-sheet.count-16 .pv-prompts{gap:6px}
.place-value-sheet.count-16 .pv-answer-line{height:19px}

.place-value-sheet.count-20 .place-value-card{
  min-height:76px;
  padding-top:7px;
  padding-bottom:8px;
}
.place-value-sheet.count-20 .pv-prompts{gap:4px}
.place-value-sheet.count-20 .pv-answer-line{height:17px}

@media print{
  .place-value-sheet.count-16 .place-value-card{min-height:90px!important;padding-bottom:10px!important}
  .place-value-sheet.count-16 .pv-prompts{gap:6px!important}
  .place-value-sheet.count-16 .pv-answer-line{height:19px!important}
  .place-value-sheet.count-20 .place-value-card{min-height:76px!important;padding-bottom:8px!important}
  .place-value-sheet.count-20 .pv-prompts{gap:4px!important}
  .place-value-sheet.count-20 .pv-answer-line{height:17px!important}
}


/* v110: One true standalone design canvas in every view. */
.sheet:not(.mixed-sheet){
  width:595px!important;
  min-width:595px!important;
  max-width:595px!important;
  height:842px!important;
  min-height:842px!important;
  max-height:842px!important;
  overflow:hidden!important;
}

/* Current reduced high-count options need explicit compact layouts so the
   preview itself is a genuine one-page A4 design rather than silently growing. */
.long-sheet.count-14 .questions{row-gap:6px!important}
.long-sheet.count-14 .question{min-height:39px!important;padding-bottom:5px!important}
.long-sheet.count-14 .long-prompt{font-size:13.7px!important;line-height:1.25!important}
.long-sheet.count-14 .long-answer{font-size:13px!important}
.long-sheet.count-18 .questions{row-gap:4px!important}
.long-sheet.count-18 .question{min-height:31px!important;padding-bottom:4px!important}
.long-sheet.count-18 .long-prompt{font-size:12.9px!important;line-height:1.22!important}
.long-sheet.count-18 .long-answer{font-size:12.5px!important}

.place-value-sheet.count-18 .questions{row-gap:6px!important}
.place-value-sheet.count-18 .place-value-card{min-height:68px!important;padding-top:6px!important;padding-bottom:6px!important}
.place-value-sheet.count-18 .pv-number{font-size:18.5px!important;margin-bottom:4px!important}
.place-value-sheet.count-18 .pv-number.pv-number-wide{font-size:17.5px!important}
.place-value-sheet.count-18 .pv-number.pv-number-very-wide{font-size:16.5px!important}
.place-value-sheet.count-18 .pv-number.pv-number-ultra-wide{font-size:15.5px!important}
.place-value-sheet.count-18 .pv-prompts{gap:2px!important;font-size:10.8px!important}
.place-value-sheet.count-18 .pv-answer-line{height:13px!important;width:112px!important}

/* Raster print pages are generated from the already-fitted preview DOM. */
#printRasterPages{display:none}
@media print{
  html,body{margin:0!important;padding:0!important;background:#fff!important;width:auto!important}
  body.raster-printing .app{display:none!important}
  body.raster-printing #printRasterPages{display:block!important;margin:0!important;padding:0!important}
  body.raster-printing #printRasterPages .raster-print-page{
    display:block!important;width:210mm!important;height:297mm!important;margin:0!important;padding:0!important;
    break-after:page!important;page-break-after:always!important;object-fit:fill!important;
  }
  body.raster-printing #printRasterPages .raster-print-page:last-child{break-after:auto!important;page-break-after:auto!important}
  @page{size:A4 portrait;margin:0}
}


/* v112: Year 4 expanded 2-digit × 1-digit multiplication. */
.expanded-mult-sheet .questions{
  display:grid;
  grid-template-columns:1fr 1fr;
  column-gap:28px;
  row-gap:14px;
  margin-top:10px;
}
.expanded-mult-card{
  min-height:140px;
  border:1px solid #222;
  border-radius:5px;
  padding:10px 12px 10px 34px;
  position:relative;
  break-inside:avoid;
  background:#fff;
}
.expanded-mult-card .qnum{left:10px;top:12px;font-size:11px;color:#111}
.expanded-pv-head{
  width:calc(28px + var(--expanded-cols,3) * 45px);
  max-width:196px;
  margin:0 auto 3px;
  display:grid;
  grid-template-columns:28px repeat(var(--expanded-cols,3),1fr);
  text-align:center;
  font-size:10px;
  font-weight:800;
  color:#111;
}
.expanded-algorithm{width:calc(28px + var(--expanded-cols,3) * 45px);max-width:196px;margin:0 auto}
.expanded-grid-row{
  display:grid;
  grid-template-columns:28px repeat(var(--expanded-cols,3),1fr);
  min-height:20px;
  align-items:stretch;
}
.expanded-op{
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:17px;
  font-weight:800;
}
.expanded-cell{
  border:1px solid #222;
  border-bottom:0;
  min-height:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
  font-weight:700;
  font-variant-numeric:tabular-nums;
  background:#fff;
}
.expanded-grid-row .expanded-cell + .expanded-cell{border-left:0}
.expanded-divider{
  margin-left:28px;
  width:calc(100% - 28px);
  border-top:1.6px solid #111;
}
.expanded-divider + .expanded-grid-row .expanded-cell{border-top:0}
.expanded-grid-row:last-child .expanded-cell{border-bottom:1px solid #222}
.expanded-mult-sheet.count-10 .questions{row-gap:8px;column-gap:24px}
.expanded-mult-sheet.count-10 .expanded-mult-card{min-height:112px;padding-top:5px;padding-bottom:5px}
.expanded-mult-sheet.count-10 .expanded-grid-row{min-height:16px}
.expanded-mult-sheet.count-10 .expanded-cell{min-height:16px;font-size:15px}
.expanded-mult-sheet.count-10 .expanded-op{font-size:15px}
.expanded-mult-sheet.count-10 .expanded-pv-head{font-size:9px;margin-bottom:2px}
.answer-sheet.expanded-mult-sheet .questions{row-gap:10px}
.answer-sheet.expanded-mult-sheet .expanded-mult-card{min-height:132px}
@media print{
  .expanded-mult-sheet .questions{align-content:space-between!important}
  .expanded-mult-sheet.count-6 .questions{height:205mm!important}
  .expanded-mult-sheet.count-8 .questions{height:210mm!important}
  .expanded-mult-sheet.count-10 .questions{height:210mm!important}
}
.answer-sheet.expanded-mult-sheet.count-10 .expanded-mult-card{min-height:112px}
.answer-sheet.expanded-mult-sheet.count-10 .questions{row-gap:8px}

/* v114: fixed readable prompt size on standalone number-word worksheets.
   Question count changes spacing only, not prompt typography. */
.whole-words-sheet .long-prompt,
.decimal-words-sheet .long-prompt,
.whole-words-sheet.count-12 .long-prompt,
.decimal-words-sheet.count-12 .long-prompt,
.whole-words-sheet.count-14 .long-prompt,
.decimal-words-sheet.count-14 .long-prompt,
.whole-words-sheet.count-16 .long-prompt,
.decimal-words-sheet.count-16 .long-prompt,
.whole-words-sheet.count-18 .long-prompt,
.decimal-words-sheet.count-18 .long-prompt{
  font-size:13.7px!important;
  line-height:1.25!important;
}


/* v115: one consistent standalone typography system for Whole Numbers in Words
   and Decimals in Words. Question count changes only the available vertical
   spacing; text/answer sizes never change and these sheets are not auto-scaled. */
.whole-words-sheet .long-prompt,
.decimal-words-sheet .long-prompt,
.whole-words-sheet.count-8 .long-prompt,
.decimal-words-sheet.count-8 .long-prompt,
.whole-words-sheet.count-10 .long-prompt,
.decimal-words-sheet.count-10 .long-prompt,
.whole-words-sheet.count-12 .long-prompt,
.decimal-words-sheet.count-12 .long-prompt,
.whole-words-sheet.count-14 .long-prompt,
.decimal-words-sheet.count-14 .long-prompt,
.whole-words-sheet.count-16 .long-prompt,
.decimal-words-sheet.count-16 .long-prompt,
.whole-words-sheet.count-18 .long-prompt,
.decimal-words-sheet.count-18 .long-prompt{
  font-size:13.7px!important;
  line-height:1.25!important;
  padding-right:142px!important;
}
.whole-words-sheet .qnum,
.decimal-words-sheet .qnum{
  font-size:11px!important;
}
.whole-words-sheet .long-answer,
.decimal-words-sheet .long-answer{
  width:130px!important;
  min-width:130px!important;
  max-width:130px!important;
  font-size:13px!important;
}
.whole-words-sheet .long-answer-line,
.decimal-words-sheet .long-answer-line{
  width:124px!important;
  height:19px!important;
}
.whole-words-sheet .question,
.decimal-words-sheet .question{
  padding-left:28px!important;
  padding-bottom:0!important;
}
.whole-words-sheet.count-8 .questions,
.decimal-words-sheet.count-8 .questions{row-gap:12px!important}
.whole-words-sheet.count-8 .question,
.decimal-words-sheet.count-8 .question{min-height:68px!important}
.whole-words-sheet.count-10 .questions,
.decimal-words-sheet.count-10 .questions{row-gap:10px!important}
.whole-words-sheet.count-10 .question,
.decimal-words-sheet.count-10 .question{min-height:56px!important}
.whole-words-sheet.count-12 .questions,
.decimal-words-sheet.count-12 .questions{row-gap:8px!important}
.whole-words-sheet.count-12 .question,
.decimal-words-sheet.count-12 .question{min-height:46px!important}
.whole-words-sheet.count-14 .questions,
.decimal-words-sheet.count-14 .questions{row-gap:6px!important}
.whole-words-sheet.count-14 .question,
.decimal-words-sheet.count-14 .question{min-height:39px!important}
.whole-words-sheet.count-16 .questions,
.decimal-words-sheet.count-16 .questions{row-gap:4px!important}
.whole-words-sheet.count-16 .question,
.decimal-words-sheet.count-16 .question{min-height:34px!important}
.whole-words-sheet.count-18 .questions,
.decimal-words-sheet.count-18 .questions{row-gap:3px!important}
.whole-words-sheet.count-18 .question,
.decimal-words-sheet.count-18 .question{min-height:30px!important}


/* v117: expanded multiplication options. Contracted form reuses the same H/T/O grid. */
.expanded-mult-card.contracted-mult-card{min-height:112px;padding-top:12px;padding-bottom:12px}
.expanded-mult-card.contracted-mult-card .expanded-algorithm{margin-top:8px}
.expanded-mult-sheet.count-10 .expanded-mult-card.contracted-mult-card{min-height:94px;padding-top:8px;padding-bottom:8px}
.answer-sheet.expanded-mult-sheet .expanded-mult-card.contracted-mult-card{min-height:112px}


/* v119: Low-count typography cap ---------------------------------------- */
/* 8/10-question layouts may use extra page space, but their question text
   should not grow beyond the equivalent 12-question typography. */
.vertical-sheet.spacious .vertical-q .row{
  font-size:21px!important;
}
.place-value-sheet.count-8 .pv-number,
.place-value-sheet.count-10 .pv-number{
  font-size:23px!important;
}
.place-value-sheet.count-8 .pv-prompts,
.place-value-sheet.count-10 .pv-prompts{
  font-size:11.8px!important;
}
.place-value-sheet.count-8 .pv-number.pv-number-wide,
.place-value-sheet.count-10 .pv-number.pv-number-wide{
  font-size:22px!important;
}
.place-value-sheet.count-8 .pv-number.pv-number-very-wide,
.place-value-sheet.count-10 .pv-number.pv-number-very-wide{
  font-size:20.5px!important;
}
.place-value-sheet.count-8 .pv-number.pv-number-ultra-wide,
.place-value-sheet.count-10 .pv-number.pv-number-ultra-wide{
  font-size:18.5px!important;
}
.factor-sheet.count-8 .factor-prompt{
  font-size:14px!important;
}

/* v119: Mixed Place Value — remove per-question boxes and reinvest the room
   in the two response rows. The surrounding mixed section border remains. */
.mixed-sheet .mixed-q.pv{
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
}
.mixed-sheet .mixed-q.pv .pv-prompts{
  gap:7px!important;
}
.mixed-slot-half .mixed-q.pv .pv-prompts{
  gap:10px!important;
}
.mixed-slot-full .mixed-q.pv .pv-prompts{
  gap:12px!important;
}
.mixed-sheet .mixed-q.pv .pv-answer-line{
  height:1.25em!important;
  top:1px!important;
}

/* v119: Powers of 10 — let the response rule fill the unused width of each
   question column. Longer equations naturally leave a shorter rule. */
.powers-preview-sheet .question{
  min-width:0;
}
.powers-preview-sheet .horizontal-q{
  display:flex!important;
  align-items:baseline;
  flex:1 1 auto;
  min-width:0;
}
.powers-preview-sheet .horizontal-q .answer-line{
  flex:1 1 auto!important;
  width:auto!important;
  max-width:none!important;
  min-width:34px!important;
  margin-left:6px!important;
}
.mixed-activity-wholePow10 .mixed-q.basic,
.mixed-activity-decimalPow10 .mixed-q.basic{
  display:flex!important;
  align-items:baseline;
  min-width:0;
}
.mixed-activity-wholePow10 .mixed-q.basic .answer-line,
.mixed-activity-decimalPow10 .mixed-q.basic .answer-line{
  flex:1 1 auto!important;
  width:auto!important;
  max-width:none!important;
  min-width:28px!important;
  margin-left:5px!important;
}

/* v120: Ordering Whole Numbers */
.order-whole-sheet .questions{grid-template-columns:1fr;gap:0!important;align-content:stretch}
.order-whole-question{display:grid;grid-template-columns:28px 1fr;align-items:start;padding:7px 8px!important;min-height:0!important;border:0!important}
.order-whole-content{min-width:0}.order-whole-prompt{font-size:14px;line-height:1.25;white-space:nowrap}.order-whole-answers{display:grid;grid-template-columns:repeat(3,minmax(0,96px));justify-content:center;gap:22px;margin-top:12px}.order-answer-line{display:block;border-bottom:1.4px solid #000;height:18px}.order-answer-value{display:block;text-align:center;font-weight:700;font-size:13px;border-bottom:1px solid #000;padding-bottom:2px}
.mixed-q.order-whole{display:grid;grid-template-columns:auto 1fr;align-items:start;gap:5px}.mixed-order-content{min-width:0;font-size:inherit}.mixed-order-answers{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:8px}.mixed-order-line{display:block;border-bottom:1px solid #000;height:14px}.mixed-order-answers strong{text-align:center;font-size:.92em;border-bottom:1px solid #000;padding-bottom:1px}
.mixed-activity-orderWhole .mixed-question-grid{grid-template-columns:1fr!important}


/* v121: Ordering Whole Numbers alignment and answer-line refinements */
.order-whole-question{
  grid-template-columns:30px minmax(0,1fr)!important;
  align-items:start!important;
  column-gap:6px!important;
  padding:7px 8px 11px!important;
}
.order-whole-question .qnum{
  position:static!important;
  left:auto!important;
  top:auto!important;
  transform:none!important;
  width:auto!important;
  min-width:0!important;
  margin:0!important;
  padding-top:1px!important;
  font-size:12px!important;
  line-height:1.25!important;
  text-align:right!important;
  color:#000!important;
}
.order-whole-prompt{font-size:14px!important;line-height:1.25!important;white-space:normal!important}
.order-whole-answers{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(118px,150px))!important;
  justify-content:center!important;
  column-gap:28px!important;
  margin-top:13px!important;
}
.order-answer-line{
  display:block!important;
  width:100%!important;
  min-width:118px!important;
  height:20px!important;
  border:0!important;
  border-bottom:1.5px solid #000!important;
}
.order-answer-value{display:block!important;text-align:center!important;min-width:118px!important;border-bottom:1.2px solid #000!important;padding-bottom:2px!important}
.mixed-q.order-whole{
  display:grid!important;
  grid-template-columns:24px minmax(0,1fr)!important;
  align-items:start!important;
  gap:5px!important;
  padding-left:0!important;
}
.mixed-q.order-whole .mixed-qnum{
  position:static!important;
  left:auto!important;
  top:auto!important;
  transform:none!important;
  width:auto!important;
  min-width:0!important;
  margin:0!important;
  padding-top:1px!important;
  line-height:1.2!important;
  text-align:right!important;
  color:#000!important;
}
.mixed-order-answers{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:12px!important;
  margin-top:8px!important;
  justify-content:center!important;
}
.mixed-order-line{
  display:block!important;
  width:100%!important;
  min-width:0!important;
  height:16px!important;
  border:0!important;
  border-bottom:1.35px solid #000!important;
}

/* v123: Ordering Whole Numbers layout refinement */
/* Standalone: keep the question text aligned with the normal worksheet margin,
   while the response lines remain centred beneath it. */
.order-whole-sheet .questions{
  height:640px!important;
  grid-template-columns:1fr!important;
  grid-template-rows:repeat(8,minmax(0,1fr))!important;
  row-gap:0!important;
  align-content:stretch!important;
  margin-top:8px!important;
}
.order-whole-question{
  height:100%!important;
  min-height:0!important;
  display:grid!important;
  grid-template-columns:24px minmax(0,1fr)!important;
  column-gap:4px!important;
  align-content:center!important;
  align-items:start!important;
  padding:2px 2px 2px 0!important;
}
.order-whole-question .qnum{
  text-align:left!important;
  padding-top:1px!important;
}
.order-whole-content{
  text-align:left!important;
  width:100%!important;
  min-width:0!important;
}
.order-whole-prompt{
  text-align:left!important;
  width:100%!important;
  font-size:14px!important;
  line-height:1.25!important;
  white-space:normal!important;
}
.order-whole-answers{
  grid-template-columns:repeat(3,minmax(120px,150px))!important;
  justify-content:center!important;
  column-gap:26px!important;
  margin-top:11px!important;
}

/* Mixed Practice: ordering questions use their natural height rather than
   stretching each item to fill the whole grid cell. */
.mixed-activity-orderWhole .mixed-question-grid{
  align-content:center!important;
  grid-auto-rows:auto!important;
}
.mixed-activity-orderWhole .mixed-q.order-whole{
  height:auto!important;
  min-height:0!important;
  align-self:center!important;
  width:100%!important;
}
.mixed-activity-orderWhole .mixed-order-content{width:100%!important;text-align:left!important}
.mixed-activity-orderWhole .mixed-order-answers{justify-content:center!important}

/* Quarter allocation: keep the pair together with a normal question gap.
   Extra unused space sits above/below the pair instead of between them. */
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-question-grid{
  display:flex!important;
  flex-direction:column!important;
  justify-content:center!important;
  gap:7px!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-q.order-whole{
  flex:0 0 auto!important;
  font-size:11.5px!important;
  line-height:1.18!important;
  grid-template-columns:20px minmax(0,1fr)!important;
  gap:4px!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-order-answers{
  grid-template-columns:repeat(3,minmax(0,72px))!important;
  justify-content:center!important;
  gap:8px!important;
  margin-top:6px!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-order-line{height:13px!important}

/* v124: Mixed Practice quarter-page ordering refinement.
   Fit three questions, use more of the left side of the quarter box, and
   let the response rules reclaim the number-column width for longer lines. */
.mixed-slot-quarter.mixed-activity-orderWhole{
  padding-left:5px!important;
  padding-right:6px!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-section-title{
  margin-left:0!important;
  margin-right:0!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-question-grid{
  gap:6px!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-q.order-whole{
  grid-template-columns:17px minmax(0,1fr)!important;
  gap:3px!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-q.order-whole .mixed-qnum{
  text-align:left!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-order-answers{
  width:calc(100% + 20px)!important;
  margin-left:-20px!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  column-gap:7px!important;
  margin-top:5px!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-order-line{
  width:100%!important;
  min-width:0!important;
}

/* v125: Rotate quarter-page Ordering whole numbers 90 degrees anti-clockwise.
   The quarter box stays in the normal page grid; only its contents rotate. By
   swapping the usable width/height, the three response lines get substantially
   more horizontal writing space. */
.mixed-slot-quarter.mixed-activity-orderWhole{
  position:relative!important;
  container-type:size!important;
  padding:0!important;
  overflow:hidden!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-quarter-order-rotator{
  position:absolute!important;
  left:4px!important;
  top:calc(100% - 4px)!important;
  width:calc(100cqh - 8px)!important;
  height:calc(100cqw - 8px)!important;
  transform:rotate(-90deg)!important;
  transform-origin:top left!important;
  box-sizing:border-box!important;
  padding:5px 6px!important;
  display:flex!important;
  flex-direction:column!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-quarter-order-rotator .mixed-section-title{
  flex:0 0 auto!important;
  margin:0 0 6px!important;
  padding:0 0 5px!important;
  font-size:13px!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-quarter-order-rotator .mixed-question-grid{
  flex:1 1 auto!important;
  min-height:0!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:repeat(3,minmax(0,1fr))!important;
  align-content:stretch!important;
  gap:0!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-quarter-order-rotator .mixed-q.order-whole{
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  display:grid!important;
  grid-template-columns:17px minmax(0,1fr)!important;
  gap:3px!important;
  align-content:center!important;
  align-items:start!important;
  font-size:11.5px!important;
  line-height:1.18!important;
  padding:1px 0!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-quarter-order-rotator .mixed-order-answers{
  width:calc(100% + 20px)!important;
  margin-left:-20px!important;
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  column-gap:9px!important;
  margin-top:6px!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-quarter-order-rotator .mixed-order-line{
  width:100%!important;
  min-width:0!important;
  height:14px!important;
}

/* v148: Firefox-compatible rotated quarter ordering layout from v132. */
.mixed-slot-quarter.mixed-activity-orderWhole{
  container-type:normal!important;
}
.mixed-slot-quarter.mixed-activity-orderWhole .mixed-quarter-order-rotator{
  width:282px!important;
  height:250.5px!important;
}

/* v148: Firefox-only Mixed Practice print pagination fix.
   Firefox can paginate the live mixed worksheet onto a second blank page when
   CSS zoom enlarges the 595 x 842 design canvas to A4. Keep the layout box at
   its original size and scale it visually instead. Page breaks still come from
   the normal .sheet print rules, so each mixed sheet remains one printed page. */
@-moz-document url-prefix(){
  @media print{
    .mixed-sheet{
      zoom:1!important;
      transform:scale(1.332)!important;
      transform-origin:top left!important;
    }
  }
}

/* v150: Safari print compatibility note */
.safari-print-warning{margin-top:7px;font-size:12px;font-weight:700;color:#9a2e2e;line-height:1.35;}

/* v159: Year 3 Missing Numbers handwriting-sized answer spaces. */
.sheet.missing20-sheet .missing20-horizontal,.mixed-q.missing20-mixed .missing20-horizontal{display:inline-flex;align-items:center;gap:7px;white-space:nowrap;vertical-align:middle}
.sheet.missing20-sheet .missing20-write-box,.mixed-q.missing20-mixed .missing20-write-box{display:inline-block;width:38px;height:34px;flex:0 0 38px;border:1.8px solid #333;border-radius:2px;box-sizing:border-box;background:white}
.sheet.missing20-sheet .missing20-written-answer,.mixed-q.missing20-mixed .missing20-written-answer{display:inline-flex;min-width:38px;min-height:34px;align-items:center;justify-content:center}
.sheet.missing20-sheet .questions{grid-template-columns:1fr 1fr;align-content:space-between}
.sheet.missing20-sheet .question{min-height:54px;align-items:center}
.sheet.missing20-sheet .horizontal-q{padding-top:0;font-size:21px}
.sheet.missing20-sheet.basic-dense .question{min-height:47px}
.sheet.missing20-sheet.basic-dense .horizontal-q{font-size:19px;padding-top:0}
.sheet.missing20-sheet.basic-dense .missing20-write-box{width:36px;height:32px;flex-basis:36px}
@media print{.sheet.missing20-sheet .missing20-write-box,.mixed-q.missing20-mixed .missing20-write-box{print-color-adjust:exact;-webkit-print-color-adjust:exact}}
