/* Shared pieces of the public IELTS and CELPIP marking guides: the "mark it
   yourself" tool, buttons, tables and the one-page printable marking sheet.
   Each page sets the --mg-* colour tokens on .mg-theme. */
.mg-theme{--mg-ink:#25362f;--mg-muted:#5e665b;--mg-paper:#fffdf9;--mg-line:#d9ddd2;--mg-soft:#ebefe4;--mg-accent:#335842;--mg-accent-ink:#fffdf9;--mg-warn:#9a5b13;--mg-good:#2f6b43}
.mg-theme .mg-kicker{font-size:10px;letter-spacing:.13em;font-weight:750;margin:0 0 10px;color:var(--mg-muted);text-transform:uppercase}
.mg-theme .mg-note{font-size:12px;line-height:1.65;color:var(--mg-muted);margin:10px 0 0}
.mg-theme .mg-button{display:inline-flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:10px 16px;background:var(--mg-accent);color:var(--mg-accent-ink);border:1px solid var(--mg-accent);border-radius:7px;text-decoration:none;font:inherit;font-size:14px;font-weight:650;line-height:1.3;cursor:pointer}
.mg-theme .mg-button:hover{filter:brightness(1.08)}
.mg-theme .mg-button:disabled{opacity:.45;cursor:not-allowed;filter:none}
.mg-theme .mg-button-secondary{background:transparent;color:var(--mg-accent)}
.mg-theme .mg-link-button{background:none;border:0;padding:8px 4px;font:inherit;font-size:13px;color:var(--mg-accent);text-decoration:underline;text-underline-offset:3px;cursor:pointer;min-height:44px}
.mg-theme .mg-table-wrap{overflow-x:auto;max-width:100%;border:1px solid var(--mg-line);border-radius:9px;margin:18px 0 12px;background:var(--mg-paper)}
.mg-theme .mg-table-wrap table{border-collapse:collapse;width:100%;font-size:13.5px;text-align:left;line-height:1.55}
.mg-theme .mg-table-wrap caption{text-align:left;padding:11px 14px;color:var(--mg-muted);font-size:11.5px;border-bottom:1px solid var(--mg-line)}
.mg-theme .mg-table-wrap th,.mg-theme .mg-table-wrap td{padding:11px 13px;border-bottom:1px solid var(--mg-line);vertical-align:top}
.mg-theme .mg-table-wrap thead{background:var(--mg-soft);font-size:12px}
.mg-theme .mg-table-wrap tbody tr:last-child>*{border-bottom:0}
.mg-theme .mg-table-wrap tbody th{font-weight:650;min-width:7em}
.mg-theme .mg-cal-reasons tbody th{min-width:9em}
/* Tables written inside copy sections: same look, scroll inside the column. */
.mg-theme section>table{display:block;overflow-x:auto;max-width:100%;border:1px solid var(--mg-line);border-radius:9px;border-collapse:collapse;margin:18px 0 12px;font-size:13.5px;line-height:1.55;background:var(--mg-paper)}
.mg-theme section>table caption{text-align:left;padding:11px 14px;color:var(--mg-muted);font-size:11.5px}
.mg-theme section>table th,.mg-theme section>table td{padding:10px 12px;border-top:1px solid var(--mg-line);vertical-align:top;text-align:left}
.mg-theme section>table thead th{background:var(--mg-soft);font-size:12px}

/* Calibration tool */
.mg-cal{border:1px solid var(--mg-line);border-radius:16px;background:var(--mg-paper);padding:28px 30px;margin:32px 0;scroll-margin-top:90px}
.mg-cal-head h2{margin-bottom:10px}
.mg-cal-head p{margin:0 0 12px}
.mg-cal-task{background:var(--mg-soft);border-radius:10px;padding:18px 20px;margin:18px 0 20px}
.mg-cal-task p{margin:0 0 10px}
.mg-cal-task-label{font-size:11px;letter-spacing:.1em;font-weight:750;color:var(--mg-muted);text-transform:uppercase}
.mg-cal-instructions{font-size:13px;color:var(--mg-muted);margin-bottom:0!important}
.mg-cal-data{overflow-x:auto;margin:6px 0 12px}
.mg-cal-data table{border-collapse:collapse;font-size:13px;background:var(--mg-paper);min-width:100%}
.mg-cal-data caption{text-align:left;font-size:12px;color:var(--mg-muted);padding:0 0 6px}
.mg-cal-data th,.mg-cal-data td{border:1px solid var(--mg-line);padding:7px 10px;text-align:left}
.mg-cal-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 16px}
.mg-cal-tabs [role=tab]{min-height:44px;padding:8px 16px;border:1px solid var(--mg-line);border-radius:100px;background:transparent;color:var(--mg-ink);font:inherit;font-size:14px;cursor:pointer}
.mg-cal-tabs [role=tab][aria-selected=true]{background:var(--mg-accent);border-color:var(--mg-accent);color:var(--mg-accent-ink);font-weight:650}
.mg-cal-sample{border-top:1px solid var(--mg-line);padding-top:18px;margin-top:18px}
.mg-cal-ready .mg-cal-sample{border-top:0;padding-top:0;margin-top:0}
.mg-cal-sample-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap}
.mg-cal-sample-head h3{margin:0}
.mg-cal-sample-head span{font-size:12px;color:var(--mg-muted)}
.mg-cal-text{border-left:3px solid var(--mg-line);padding:4px 0 4px 18px;margin:14px 0 20px;font-size:15px;line-height:1.75}
.mg-cal-text p{margin:0 0 12px}
.mg-cal-transcript p{margin-bottom:8px}
.mg-cal-form fieldset{border:0;margin:0;padding:0;min-width:0}
.mg-cal-form legend{font-weight:650;font-size:14px;margin-bottom:12px}
.mg-cal-inputs{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px 18px}
.mg-cal-select span{display:block;font-size:13px;font-weight:600;margin-bottom:6px}
.mg-cal-select select{width:100%;min-height:44px;border:1px solid var(--mg-line);border-radius:7px;background:var(--mg-paper);color:var(--mg-ink);font:inherit;font-size:16px;padding:8px 10px}
.mg-cal-choice{border:1px solid var(--mg-line);border-radius:9px;padding:10px 12px;display:flex;flex-direction:column;gap:4px}
.mg-cal-choice>span{font-size:13px;font-weight:650;margin-bottom:2px}
.mg-cal-choice label{display:flex;align-items:center;gap:8px;min-height:36px;font-size:14px;cursor:pointer}
.mg-cal-choice input{width:18px;height:18px;accent-color:var(--mg-accent)}
.mg-cal-actions{display:flex;gap:10px 16px;align-items:center;flex-wrap:wrap;margin:18px 0 6px}
.mg-cal-result{margin:16px 0 4px}
.mg-cal-message{font-weight:650;font-size:15px;margin:0 0 6px}
.mg-cal-result td[data-cal-diff="0"]{color:var(--mg-good);font-weight:650}
.mg-cal-result td[data-cal-diff="1"]{color:var(--mg-ink)}
.mg-cal-result td[data-cal-diff="2"]{color:var(--mg-warn);font-weight:650}
.mg-cal-reference{margin-top:10px}
.mg-cal-reference h4{font-size:15px;margin:18px 0 0}
.mg-cal-reasons td:nth-child(2){font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}
.mg-cal-summary{font-style:italic;color:var(--mg-muted)}
.mg-cal-next{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:16px 0 4px;padding-top:16px;border-top:1px dashed var(--mg-line)}
.mg-cal-next .mg-note{flex-basis:100%;margin-top:2px}
.mg-cal-disclaimer{margin-top:18px}

/* Printable marking sheet */
.mg-sheet{scroll-margin-top:90px}
.mg-sheet-screen-head p{margin:0 0 14px}
.mg-sheet-paper{border:1px solid var(--mg-line);border-radius:10px;background:#fff;color:#1d2420;padding:22px 24px;margin:14px 0;font-size:13px;line-height:1.5}
.mg-sheet-paper-head{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;border-bottom:2px solid #1d2420;padding-bottom:8px;margin-bottom:12px}
.mg-sheet-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.mg-sheet-box{border:1px solid #9aa39a;border-radius:6px;padding:9px 11px}
.mg-sheet-box-title{display:flex;gap:6px;align-items:baseline;margin:0 0 4px}
.mg-sheet-band{margin-left:auto;white-space:nowrap;font-weight:650}
.mg-sheet-box ul,.mg-sheet-checks ul{margin:0;padding-left:18px}
.mg-sheet-box li{margin:3px 0}
.mg-sheet-checks{margin-top:12px}
.mg-sheet-checks p{margin:0 0 4px}
.mg-sheet-checks ul{list-style:none;padding-left:0;columns:2;column-gap:20px}
.mg-sheet-checks li{display:flex;gap:8px;margin:4px 0;break-inside:avoid}
.mg-sheet-tick{flex:none;width:12px;height:12px;border:1.5px solid #1d2420;border-radius:2px;margin-top:3px}
.mg-sheet-maths{border:1px dashed #9aa39a;border-radius:6px;padding:8px 11px;margin:12px 0 8px}
.mg-sheet-foot{font-size:10.5px;color:#4b544c;margin:8px 0 0}
.mg-sheet-two{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.mg-sheet-two h3{font-size:13px;margin:0 0 6px}

html.dark-mode .mg-theme .mg-cal-result td[data-cal-diff="2"]{color:#f0b16b}
html.dark-mode .mg-theme .mg-cal-result td[data-cal-diff="0"]{color:#9ed3a8}

@media(max-width:640px){
  .mg-cal{padding:20px 16px;border-radius:12px}
  .mg-cal-task{padding:14px}
  .mg-cal-text{padding-left:12px;font-size:14.5px}
  .mg-cal-inputs{grid-template-columns:1fr 1fr}
  .mg-sheet-grid,.mg-sheet-two{grid-template-columns:1fr}
  .mg-sheet-checks ul{columns:1}
  .mg-sheet-paper{padding:16px}
}
@media print{
  html.mg-printing body *{visibility:hidden!important}
  html.mg-printing .mg-sheet-paper,html.mg-printing .mg-sheet-paper *{visibility:visible!important}
  html.mg-printing .mg-sheet-paper{position:absolute;left:0;top:0;width:100%;border:0;margin:0;padding:0;font-size:11.5px}
  html.mg-printing .mg-sheet-grid{grid-template-columns:1fr 1fr}
  html.mg-printing .mg-sheet-two{grid-template-columns:1fr 1fr}
  html.mg-printing .mg-sheet-checks ul{columns:2}
  @page{size:A4;margin:12mm}
}
