:root{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#172033;background:#f1f5f9}*{box-sizing:border-box}body{margin:0}.top{display:flex;justify-content:space-between;align-items:center;background:#14263c;color:white;padding:16px 26px}.top span{color:#a9c5ef}.top small{margin-left:12px;color:#cbd5e1}.topright{font-size:13px}.layout{display:grid;grid-template-columns:335px minmax(0,1fr);min-height:calc(100vh - 60px)}.panel{padding:23px;background:white;border-right:1px solid #dce3ed}.controls{overflow:auto}.controls h1{font-size:22px;margin:0 0 18px}.controls h2{font-size:15px;margin-top:22px}.controls label{display:block;font-size:13px;font-weight:650;margin:13px 0}.controls input:not([type=color]):not([type=range]),select,textarea{display:block;width:100%;padding:10px;margin-top:6px;border:1px solid #cbd5e1;border-radius:7px;background:white;font:inherit}.controls input[type=color]{display:block;width:100%;height:40px;margin-top:6px;border:0;background:transparent}.controls input[type=range]{width:85%}.twocol{display:grid;grid-template-columns:1fr 1fr;gap:10px}.actions{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0}button,.filebutton{font:inherit;font-size:13px;font-weight:650;cursor:pointer;border:1px solid #cbd5e1;background:#fff;border-radius:7px;padding:10px 12px;color:#233449}.primary{background:var(--brand-primary,#2563eb);color:white;border-color:var(--brand-primary,#2563eb)}.filebutton{display:inline-block!important;margin:0!important}.note,.hint{font-size:12px;color:#64748b;line-height:1.6}#status{font-size:13px;color:#155e75}.workspace{padding:18px 28px;overflow:auto}.workbar{display:flex;justify-content:space-between;align-items:center;max-width:800px;margin:0 auto 12px}.workbar button{margin-left:6px}.page{width:min(100%,794px);min-height:1122px;background:white;margin:auto;box-shadow:0 7px 30px #0f172a22;padding:42px}.sheet-head{text-align:center;border-bottom:2px solid var(--accent);padding-bottom:14px;margin-bottom:18px}.sheet-head h2{margin:0;font-size:24px}.sheet-head p{font-size:13px;margin:8px 0 0}.sheet-meta{display:flex;justify-content:space-between;font-size:12px;margin-bottom:16px}.activity-svg{display:block;width:100%;height:auto}.maze-cell{cursor:pointer}.maze-cell rect{fill:white;stroke:#94a3b8;stroke-width:1.5}.maze-cell.start rect{stroke:#16a34a;stroke-width:3}.maze-cell.finish rect{stroke:#d97706;stroke-width:3}.maze-cell text{font-size:13px;text-anchor:middle;fill:#172033}.maze-cell .tiny{font-size:9px;fill:#64748b}.colour-cell{cursor:pointer}.colour-cell rect{stroke:#475569;stroke-width:1.2}.colour-cell text{text-anchor:middle;fill:#111827;font-size:11px;font-weight:600}.key{display:flex;flex-wrap:wrap;gap:12px;margin:18px 0}.swatch{display:inline-flex;align-items:center;gap:6px;font-size:12px}.swatch i{width:18px;height:18px;border:1px solid #94a3b8;display:inline-block}.answer-note{font-size:12px;color:#166534;margin-top:14px}.hint{max-width:794px;margin:10px auto}.question-edit{margin:8px 0}.question-edit input{font:inherit;padding:6px;width:100%}@media(max-width:950px){.layout{grid-template-columns:1fr}.panel{border-right:0;border-bottom:1px solid #dce3ed}.page{min-height:0;padding:20px}.workspace{padding:15px}.topright{display:none}}@page{size:A4 portrait;margin:13mm}@media print{body{background:white}.top,.panel,.workbar,.hint{display:none!important}.layout{display:block}.workspace{padding:0;overflow:visible}.page{box-shadow:none;width:auto;min-height:0;padding:0;margin:0}.sheet-head{break-after:avoid}.activity-svg{max-height:240mm}}

/* Configurable branding: shared site header */
.top{background:#fff;color:#17153d;border-bottom:1px solid #e9e3f4;min-height:80px;padding:10px 26px}.brand-link{display:inline-flex;align-items:center;text-decoration:none}.brand-logo{display:block;width:225px;max-width:100%;height:60px;object-fit:contain;object-position:left center}.brand-right{display:flex;align-items:center;gap:12px}.top .topright{color:#5e5776}.top small{color:#766e8b;font-size:12px}@media(max-width:520px){.top{padding:8px 15px;min-height:65px}.brand-logo{width:58px;height:52px}.brand-right{gap:4px}.brand-right small{font-size:10px}}

/* v0.2.0 public website */
:root{--brand:#6935d6;--ink:#13153c;--sub:#5d647a}body{color:var(--ink);background:#fff}.top{position:relative;z-index:2;gap:24px;max-width:none;padding:10px max(24px,calc((100vw - 1280px)/2));min-height:86px}.site-nav{display:flex;gap:28px;align-items:center}.site-nav a,.site-footer a{color:var(--ink);text-decoration:none;font-weight:650;font-size:14px}.site-nav a:hover,.site-nav a[aria-current]{color:var(--brand)}.nav-cta,.button-primary{background:var(--brand);color:#fff!important;text-decoration:none;border-radius:12px;padding:13px 21px;font-weight:750;white-space:nowrap}.nav-cta:hover,.button-primary:hover{background:#5222ba}.marketing{background:linear-gradient(180deg,#fbf9ff,#fff 64%)}.hero{max-width:1280px;margin:auto;padding:66px 30px 55px;display:grid;grid-template-columns:1fr 1fr;gap:55px;align-items:center;min-height:445px}.eyebrow{color:#7443d5;text-transform:uppercase;font-weight:800;letter-spacing:.13em;font-size:12px}.hero h1{font-size:clamp(35px,4.2vw,62px);letter-spacing:-.05em;line-height:1.08;margin:17px 0}.hero h1 em{font-style:normal;color:var(--brand)}.hero-copy>p{font-size:18px;line-height:1.6;color:var(--sub);max-width:550px}.button{display:inline-flex;align-items:center;gap:9px;text-decoration:none;border-radius:10px;font-weight:750;font-size:14px;padding:12px 18px}.hero-footnote{font-size:12px!important;margin-top:17px}.hero-art{position:relative;min-height:310px;display:flex;align-items:center;justify-content:center}.hero-art>img{max-width:65%;max-height:330px;object-fit:contain;position:relative;z-index:1}.hero-sheet{background:#fff;transform:rotate(5deg);box-shadow:0 15px 45px #372b5c25;border:1px solid #d7c7f6;border-radius:16px;padding:23px;position:absolute;right:0;top:20px;width:57%;min-height:280px}.hero-sheet strong{display:block;color:#5126ad;margin-bottom:16px}.mini-maze{display:grid;grid-template-columns:1fr 1fr;gap:10px}.mini-maze span{padding:11px 5px;text-align:center;border:1px solid #bcb2d2;border-radius:6px;font-size:12px}.mini-maze span:first-child,.mini-maze span:last-child{background:#efe7ff}.benefits{max-width:1280px;margin:auto;display:grid;grid-template-columns:repeat(4,1fr);gap:12px;padding:25px 30px;border-top:1px solid #eee8f7}.benefits>div{display:flex;flex-direction:column;gap:7px}.benefits b{font-size:15px}.benefits span{font-size:13px;color:var(--sub)}.template-section{max-width:1280px;margin:0 auto;padding:42px 30px 65px}.section-heading{display:flex;justify-content:space-between;align-items:center;gap:15px}.section-heading h2{font-size:29px;letter-spacing:-.03em}.section-heading a{color:var(--brand);font-weight:700;text-decoration:none}.template-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.template-card{border-radius:20px;min-height:218px;padding:30px;display:flex;gap:20px;position:relative;overflow:hidden}.maze-card{background:#f1eaff}.colour-card{background:#e4f8f5}.template-card h3,.template-card h2{font-size:24px;margin:0 0 8px}.template-card p{font-size:14px;line-height:1.55;max-width:320px}.template-icon{font-size:40px;color:#6b35cf}.button-outline{border:1px solid #7039d9;background:#fff;color:#6230c6;margin-top:10px}.card-preview{margin-left:auto;display:grid;grid-template-columns:1fr 1fr;gap:5px;align-content:center;transform:rotate(7deg);min-width:110px}.card-preview span{font-size:10px;background:#fff;border:1px solid #ac91d9;border-radius:4px;padding:12px 5px;text-align:center}.colour-preview{margin-left:auto;display:grid;grid-template-columns:1fr 1fr;gap:6px;align-content:center;transform:rotate(8deg)}.colour-preview i{display:block;width:46px;height:46px;border:2px solid #444;border-radius:50% 8px 50% 8px;background:#fff}.colour-preview i:nth-child(2){background:#ffd6e8}.colour-preview i:nth-child(3){background:#e1d2ff}.coming-soon{margin-top:20px;background:#f5f2fd;padding:24px 30px;border-radius:16px}.coming-soon p{margin:7px 0 0;color:var(--sub)}.site-footer{background:#f7f5fd;border-top:1px solid #ebe7f6}.footer-inner{max-width:1280px;margin:auto;padding:24px 30px;display:flex;justify-content:space-between;gap:20px;align-items:center}.site-footer nav{display:flex;gap:20px}.content-page{max-width:1140px;min-height:60vh;margin:0 auto;padding:65px 30px}.content-page.readable{max-width:850px}.content-page h1{font-size:clamp(32px,4vw,48px);letter-spacing:-.04em}.content-page h2{margin-top:34px}.content-page p{line-height:1.75;color:#4f566a}.content-page .lead{font-size:19px}.content-page .template-grid{margin-top:32px}.notice{background:#f5f2fd;padding:18px;border-radius:10px;margin-top:30px}.creator-layout{min-height:calc(100vh - 86px)}.creator-layout .panel{color:#172033}.creator-layout .workspace{background:#f1f5f9}@media(max-width:1000px){.top{padding:12px 20px}.site-nav{gap:13px}.hero{gap:10px}.template-card{padding:20px}.card-preview,.colour-preview{display:none}}@media(max-width:700px){.top{flex-wrap:wrap;gap:12px;justify-content:space-between}.site-nav{order:3;width:100%;justify-content:space-around;gap:8px;padding:4px 0}.site-nav a{font-size:13px}.nav-cta{font-size:12px;padding:10px}.hero{grid-template-columns:1fr;padding:35px 20px}.hero-art{min-height:230px}.hero-art>img{max-height:230px}.hero-sheet{min-height:200px;padding:12px}.mini-maze span{padding:7px 2px;font-size:10px}.benefits{grid-template-columns:repeat(2,1fr);padding:20px;gap:20px}.template-grid{grid-template-columns:1fr}.template-section,.content-page{padding:30px 20px}.footer-inner{flex-direction:column;text-align:center}.site-footer nav{flex-wrap:wrap;justify-content:center}}@media print{.site-footer{display:none!important}}

/* Language switch */
.lang-switch{display:flex;align-items:center;gap:.35rem;white-space:nowrap;font-size:.85rem}
.lang-switch a{color:inherit;text-decoration:none;padding:.2rem .25rem}
.lang-switch a[aria-current="true"]{font-weight:800;color:#6d36d9;text-decoration:underline}
@media(max-width:720px){.lang-switch{margin-left:auto}.site-nav{flex-wrap:wrap}}

/* v0.3.6 dual entry and topic-first browsing */
.entry-choices{max-width:1280px;margin:auto;padding:18px 30px 30px}.entry-choices h2{font-size:25px}.entry-grid,.topic-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.entry-choice,.topic-card{display:flex;flex-direction:column;gap:10px;padding:22px;border:1px solid #e1d8f5;border-radius:16px;background:#fbf9ff;text-decoration:none;color:var(--ink)}.entry-choice:hover{border-color:var(--brand);box-shadow:0 5px 22px #6935d61c}.entry-choice strong{font-size:19px}.entry-choice span{color:var(--sub);font-size:14px}.topic-search-label{display:block;margin:22px 0 7px;font-weight:700}.topic-page input[type=search]{width:min(100%,560px);padding:13px;border:1px solid #bcb3d5;border-radius:10px;font:inherit}.topic-group{margin-top:35px}.topic-card h3{margin:0;font-size:20px}.topic-card p{margin:0}.topic-template-links{display:flex;flex-wrap:wrap;gap:8px}.topic-template-links .button{margin-top:0}.topic-card[hidden],.topic-group[hidden]{display:none!important}@media(max-width:700px){.entry-choices{padding:16px 20px}.entry-grid,.topic-grid{grid-template-columns:1fr}}

/* v0.3.7 mobile-first creator enhancements */
.mobile-editor-tabs{display:none}
@media(max-width:700px){
 .mobile-editor-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:12px 16px;background:#f7f3ff;position:sticky;top:0;z-index:5}
 .mobile-editor-tabs button{min-height:44px;font-size:15px;border-radius:10px}
 .mobile-editor-tabs button[aria-pressed="true"]{background:var(--brand);color:white;border-color:var(--brand)}
 .creator-layout[data-mobile-view="settings"] .workspace{display:none}
 .creator-layout[data-mobile-view="preview"] .controls{display:none}
 .creator-layout .controls{padding:18px 16px}
 .creator-layout .workspace{padding:14px 10px;overflow:hidden}
 .creator-layout .page{width:100%;min-height:0;padding:clamp(10px,3vw,20px);box-shadow:0 3px 16px #0f172a18}
 .creator-layout .workbar{flex-wrap:wrap;gap:8px}
 .creator-layout button,.creator-layout .filebutton{min-height:44px}
 .creator-layout .actions>button{flex:1 1 140px}
 .creator-layout .sheet-head h2{font-size:clamp(15px,4vw,22px)}
 .creator-layout .sheet-meta{font-size:10px;gap:8px;flex-wrap:wrap}
 .site-nav{overflow-x:auto;justify-content:flex-start;scrollbar-width:thin;padding-bottom:8px}
 .site-nav a{white-space:nowrap;min-height:40px;display:inline-flex;align-items:center}
 .nav-cta{min-height:44px;display:inline-flex;align-items:center}
}
@media print{.mobile-editor-tabs{display:none!important}.creator-layout .workspace{display:block!important}}

/* Shared worksheet layout: dimensions originate in data/worksheet-layout.json. */
.creator-layout .page{position:relative;min-height:var(--sheet-height,1122px);padding:var(--sheet-top,56px) var(--sheet-right,60px) var(--sheet-bottom,49px) var(--sheet-left,57px)}
.creator-layout .sheet-brand-footer{position:absolute;left:var(--sheet-left,57px);right:var(--sheet-right,60px);bottom:var(--sheet-footer-bottom,49px);color:#64748b;text-align:left;line-height:1;font-weight:400}
@media print{.creator-layout .page{min-height:var(--sheet-height,1122px)}}

.creator-layout .sheet-head{min-height:var(--sheet-rule-offset,72px);padding-bottom:10px;margin-bottom:0;display:flex;flex-direction:column;justify-content:flex-start}
.creator-layout .sheet-meta{margin-top:calc(var(--sheet-meta-offset,31px) - 19px);margin-bottom:16px}

/* Explicit difficulty labels: colour is not used to communicate level. */
.creator-layout .difficulty-native{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important}
.creator-layout .difficulty-buttons{display:flex;gap:3px;margin-top:7px;padding:3px;border:1px solid #cbd5e1;border-radius:8px;background:#f8fafc}
.creator-layout .difficulty-choice{flex:1;min-width:0;padding:8px 3px;border:0;background:transparent;font-size:12px;border-radius:5px}
.creator-layout .difficulty-choice[aria-pressed="true"]{background:#334155;color:white}
.creator-layout .difficulty-choice:focus-visible{outline:2px solid var(--brand-primary,#2563eb);outline-offset:2px}
.creator-layout .difficulty-indicator{display:flex;align-items:center;gap:8px;margin-top:7px;font-size:12px;color:#475569;font-weight:400}
.creator-layout .difficulty-bars{display:flex;gap:3px}
.creator-layout .difficulty-bars i{display:block;width:23px;height:6px;border-radius:3px;background:#e2e8f0}
.creator-layout .difficulty-bars i.active{background:#475569}
.creator-layout .sheet-difficulty{display:block;font-size:11px;color:#475569;margin-top:5px}

/* v0.3.20: the three bars themselves are the accessible difficulty selector. */
.creator-layout .difficulty-buttons{display:none}
.creator-layout .difficulty-indicator{display:flex;align-items:center;gap:5px;margin-top:10px;flex-wrap:wrap}
.creator-layout .difficulty-bar{appearance:none;display:block;flex:0 0 30px;width:30px;height:10px;min-height:10px;padding:0;border:0;border-radius:4px;background:#d1d5db;cursor:pointer;transition:background .12s ease}
.creator-layout .difficulty-bar.active{background:#475569}
.creator-layout .difficulty-bar:hover{background:#64748b}
.creator-layout .difficulty-bar:focus-visible{outline:2px solid var(--brand-primary,#2563eb);outline-offset:3px}
.creator-layout .difficulty-caption{margin-left:8px;font-size:12px;color:#475569}

/* Difficulty is a full-width standalone control; theme colour is fixed. */
.creator-layout .difficulty-control{display:block;width:100%}
.creator-layout .difficulty-control>label{display:block;width:100%}

/* v0.3.23: Shared absolute header baselines, in PDF points converted to CSS px. */
.creator-layout #page{position:relative}
.creator-layout #worksheet{padding-top:calc(var(--sheet-activity-y,204px) - var(--sheet-top,56px))}
.creator-layout .sheet-head{position:absolute;top:0;left:var(--sheet-left,57px);right:var(--sheet-right,60px);height:var(--sheet-rule-y,128px);min-height:0;padding:0;margin:0;border:0;display:block;text-align:center}
.creator-layout .sheet-head h2{position:absolute;top:var(--sheet-title-y,73px);left:0;right:0;margin:0;transform:translateY(-0.8em);font-size:24px;line-height:1.2}
.creator-layout .sheet-head p{position:absolute;top:var(--sheet-instructions-y,103px);left:0;right:0;margin:0;transform:translateY(-0.8em);font-size:13px;line-height:1.2}
.creator-layout .sheet-head::after{content:'';position:absolute;top:var(--sheet-rule-y,128px);left:0;right:0;border-top:var(--sheet-rule-thickness,2.6667px) solid var(--brand-primary,#2563eb)}
.creator-layout .sheet-meta{position:absolute;top:var(--sheet-meta-y,159px);left:var(--sheet-left,57px);right:var(--sheet-right,60px);margin:0;transform:translateY(-0.8em);display:grid;grid-template-columns:1fr auto 1fr;align-items:baseline;gap:4px;flex-wrap:nowrap;font-size:12px;white-space:nowrap}
.creator-layout .sheet-meta span:first-child{text-align:left}
.creator-layout .sheet-meta span:last-child{text-align:right}
.creator-layout .sheet-meta .sheet-difficulty{margin:0;font-size:11px;color:#475569;text-align:center;display:inline}
.creator-layout .sheet-answer-label{position:absolute;top:var(--sheet-answer-y,181px);left:var(--sheet-left,57px);right:var(--sheet-right,60px);transform:translateY(-0.8em);font-size:12px;font-weight:700;text-align:center;line-height:1.2}

/* Instructions must match the title field width and cannot be dragged outside the settings panel. */
.creator-layout .controls #instructions{display:block;width:100%;max-width:100%;min-width:0;resize:vertical;box-sizing:border-box;}

/* Compact template/topic selectors: change on demand, preserve current values. */
.creator-layout .selection-control{margin-bottom:14px;min-width:0}
.creator-layout .selection-header{display:flex;align-items:center;justify-content:space-between;gap:10px}
.creator-layout .selection-heading{font-weight:600;font-size:13px}
.creator-layout .selection-change{border:1px solid #cbd5e1;background:transparent;color:#334155;border-radius:6px;padding:4px 10px;font-size:12px;cursor:pointer;min-height:30px}
.creator-layout .selection-change:hover{border-color:var(--brand-primary,#2563eb)}
.creator-layout .selection-change:focus-visible{outline:2px solid var(--brand-primary,#2563eb);outline-offset:2px}
.creator-layout .selection-current{padding:7px 0;font-size:14px;color:#334155}
.creator-layout .selection-picker[hidden]{display:none!important}
.creator-layout .selection-picker label{display:block;font-size:12px;margin-bottom:4px}
.creator-layout .selection-picker select{display:block;width:100%;max-width:100%;box-sizing:border-box}

/* Scalable modal catalogue; native dialog handles focus, Escape and background inertness. */
.creator-layout .selection-picker{display:none!important}
.selection-dialog{box-sizing:border-box;width:min(92vw,620px);max-height:min(82vh,760px);margin:auto;padding:22px;border:1px solid #cbd5e1;border-radius:14px;background:#fff;color:#0f172a;box-shadow:0 18px 60px #0f172a33}
.selection-dialog::backdrop{background:rgba(15,23,42,.48)}
.selection-dialog-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:15px}
.selection-dialog-header h2{margin:0;font-size:19px}
.selection-dialog-close{border:0;background:transparent;font-size:27px;line-height:1;cursor:pointer;padding:3px 8px}
#selection-dialog-search{box-sizing:border-box;width:100%;min-height:42px;margin-bottom:12px;padding:9px 12px;border:1px solid #cbd5e1;border-radius:8px}
.selection-dialog-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;max-height:55vh;overflow:auto}
.selection-dialog-option{min-height:56px;padding:12px;text-align:left;border:1px solid #cbd5e1;border-radius:9px;background:#fff;color:#334155;cursor:pointer}
.selection-dialog-option[aria-pressed="true"]{border:2px solid var(--brand-primary,#2563eb);background:#eff6ff;color:#1e40af;font-weight:600}
.selection-dialog-option:hover{border-color:var(--brand-primary,#2563eb)}
.selection-dialog-option:focus-visible,.selection-dialog-close:focus-visible{outline:2px solid var(--brand-primary,#2563eb);outline-offset:2px}
.selection-dialog-empty{padding:18px;color:#64748b;text-align:center}
@media(max-width:500px){.selection-dialog{padding:16px}.selection-dialog-options{grid-template-columns:1fr}}

/* v0.3.30: Current selection and its Change action share one horizontal row. */
.creator-layout .selection-value-row{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}
.creator-layout .selection-value-row .selection-current{flex:1 1 auto;min-width:0;overflow-wrap:anywhere}
.creator-layout .selection-value-row .selection-change{flex:0 0 auto;white-space:nowrap}

/* Keep route and answer actions together, with PDF download on its own row. */
.creator-layout .worksheet-actions{display:flex;flex-direction:column;gap:8px}
.creator-layout .worksheet-actions-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;width:100%}
.creator-layout .worksheet-actions-row>button{width:100%;min-width:0;white-space:normal}
.creator-layout .worksheet-actions>.worksheet-download{display:block;width:100%;flex:none}

/* Formula edit feedback appears beside the preview, where edits happen. */
.edit-feedback{max-width:794px;margin:0 auto 12px;padding:11px 14px;border:1px solid #86c7a1;border-radius:7px;background:#f0fdf4;color:#166534;font-size:13px;font-weight:600;line-height:1.5}
.edit-feedback[data-kind="error"]{border-color:#f5b5b5;background:#fef2f2;color:#991b1b}
.edit-feedback[hidden]{display:none}
@media print{.edit-feedback{display:none!important}}

.edit-feedback{display:flex;align-items:center;justify-content:space-between;gap:12px}
.edit-feedback-close{flex:none;padding:0 5px;min-width:26px;min-height:26px;border:0;background:transparent;color:inherit;font-size:22px;line-height:1;cursor:pointer}
.edit-feedback-close:hover,.edit-feedback-close:focus-visible{background:rgba(0,0,0,.07);outline-offset:2px}
.edit-feedback[hidden]{display:none}

/* Writing lines are real rules in both preview and PDF, not underscore glyphs. */
.creator-layout .sheet-writing-field{display:inline-flex;align-items:baseline;gap:5pt;white-space:nowrap}
.creator-layout .sheet-writing-rule{display:inline-block;flex:none;border-bottom:.6pt solid #000;height:.15em;vertical-align:baseline}
.creator-layout .name-rule{width:120pt}
.creator-layout .date-rule{width:75pt}
html[lang="zh"] .creator-layout .name-rule{width:80pt}
html[lang="zh"] .creator-layout .date-rule{width:55pt}
.creator-layout .sheet-meta .date-field{justify-self:end}

/* v0.3.64: Heading and answer-key typography from the shared PDF/preview JSON contract. */
.creator-layout .sheet-head h2{font-size:var(--sheet-title-font-size,24px);font-weight:var(--sheet-title-font-weight,700);color:var(--sheet-title-color,#172033)}
.creator-layout .sheet-answer-label{font-size:var(--sheet-answer-font-size,12px);font-weight:var(--sheet-answer-font-weight,700);color:var(--sheet-answer-color,#172033)}

/* v0.3.85: The editor head supplies the same configured TTF fonts used by PDF.
   font-display:swap keeps first-preview text visible while fonts load. */
.creator-layout .page{font-family:"CB Noto EN","CB Noto ZH",sans-serif}
html[lang="zh"] .creator-layout .page{font-family:"CB Noto ZH","CB Noto EN",sans-serif}
.creator-layout .activity-svg text{font-family:inherit}

/* v0.3.69: The worksheet is one A4 coordinate system. Scale the entire
   preview on portrait/narrow screens, never individual positioned labels. */
.creator-layout .sheet-preview-frame{width:100%;max-width:794px;margin-inline:auto}
@media(max-width:700px){
 .creator-layout .sheet-preview-frame{position:relative;max-width:100%;overflow:visible}
 .creator-layout .sheet-preview-frame>.page{
   position:absolute;top:0;left:0;margin:0;
   width:793.7067px;min-width:793.7067px;max-width:none;
   min-height:1122.52px;padding:var(--sheet-top,56px) var(--sheet-right,60px) var(--sheet-bottom,49px) var(--sheet-left,57px);
   transform-origin:top left;transform:scale(var(--sheet-preview-scale,1));
 }
 .creator-layout .sheet-head h2{font-size:var(--sheet-title-font-size,24px)}
 .creator-layout .sheet-meta{font-size:12px;gap:4px;flex-wrap:nowrap}
}
@media print{
 .creator-layout .sheet-preview-frame{display:contents}
 .creator-layout .sheet-preview-frame>.page{position:relative;transform:none;width:auto;min-width:0;max-width:none}
}

/* v0.3.70: responsive template/topic picker. Dialog lives outside .creator-layout,
   so its responsive rules must not depend on the creator ancestor. */
#selection-dialog.selection-dialog{
 position:fixed;inset:0;box-sizing:border-box;
 width:min(620px,calc(100vw - 32px));max-width:calc(100vw - 32px);
 max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);
 margin:auto;padding:clamp(12px,3vw,22px);
 overflow:hidden;flex-direction:column;gap:0;
 overscroll-behavior:contain;
}
#selection-dialog.selection-dialog[open]{display:flex}
#selection-dialog .selection-dialog-header{flex:0 0 auto;min-width:0}
#selection-dialog .selection-dialog-header h2{font-size:clamp(16px,3.5vw,19px);overflow-wrap:anywhere}
#selection-dialog #selection-dialog-search{flex:0 0 auto;font-size:16px;min-width:0}
#selection-dialog .selection-dialog-options{
 flex:1 1 auto;min-height:0;max-height:none;
 overflow-y:auto;overscroll-behavior:contain;
 grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr));
 -webkit-overflow-scrolling:touch;
}
#selection-dialog .selection-dialog-option{min-width:0;overflow-wrap:anywhere;min-height:48px}
#selection-dialog .selection-dialog-close{flex:0 0 auto;min-width:44px;min-height:44px}
@media(max-width:700px){
 #selection-dialog.selection-dialog{width:calc(100vw - 24px);max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);padding:14px}
 #selection-dialog .selection-dialog-options{grid-template-columns:1fr;gap:8px}
}
@media(max-height:500px) and (orientation:landscape){
 #selection-dialog.selection-dialog{width:min(720px,calc(100vw - 24px));max-height:calc(100dvh - 12px);padding:8px 14px}
 #selection-dialog .selection-dialog-header{margin-bottom:4px}
 #selection-dialog #selection-dialog-search{margin-bottom:6px;min-height:38px}
 #selection-dialog .selection-dialog-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 #selection-dialog .selection-dialog-option{min-height:40px;padding:8px}
}


/* v0.3.71: Consistent touch-device editor settings in portrait and landscape.
   A phone can be wider than 700px in landscape; do not switch its editor to
   desktop typography merely because the viewport rotates. */
@media (max-width:700px), (hover:none) and (pointer:coarse) and (max-width:1024px){
 .mobile-editor-tabs{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;padding:10px 16px;background:#f7f3ff;position:sticky;top:0;z-index:5}
 .mobile-editor-tabs button{min-height:44px;font-size:15px;line-height:1.35}
 .mobile-editor-tabs button[aria-pressed="true"]{background:var(--brand);color:white;border-color:var(--brand)}
 .creator-layout{display:grid;grid-template-columns:minmax(0,1fr);min-height:0}
 .creator-layout[data-mobile-view="settings"] .workspace{display:none}
 .creator-layout[data-mobile-view="preview"] .controls{display:none}
 .creator-layout .controls{padding:18px 16px;min-width:0;border-right:0;border-bottom:1px solid #dce3ed}
 .creator-layout .workspace{padding:14px 10px;overflow:hidden;min-width:0}
 .creator-layout .selection-heading,.creator-layout .controls h2{font-size:14px;line-height:1.4}
 .creator-layout .selection-current{font-size:16px;line-height:1.45;padding:7px 0;min-width:0;overflow-wrap:anywhere}
 .creator-layout .selection-value-row{align-items:center;gap:10px;min-width:0}
 .creator-layout .selection-change{font-size:14px;line-height:1.3;min-height:44px;padding:10px 12px}
 .creator-layout .controls label{font-size:14px;line-height:1.45}
 .creator-layout .controls input:not([type=color]):not([type=range]),
 .creator-layout .controls textarea,
 .creator-layout .controls select{font-size:16px;line-height:1.45;max-width:100%;min-width:0}
 .creator-layout .difficulty-caption,.creator-layout .difficulty-indicator{font-size:14px;line-height:1.4}
 .creator-layout .difficulty-bar{flex-basis:36px;width:36px;height:12px;min-height:12px}
 .creator-layout button,.creator-layout .filebutton{min-height:44px}
 .creator-layout .worksheet-actions-row{grid-template-columns:repeat(2,minmax(0,1fr))}
 .creator-layout .worksheet-actions-row>button{font-size:14px;line-height:1.4;overflow-wrap:anywhere}
 .creator-layout .sheet-preview-frame{position:relative;max-width:100%;overflow:visible}
 .creator-layout .sheet-preview-frame>.page{position:absolute;top:0;left:0;margin:0;width:793.7067px;min-width:793.7067px;max-width:none;min-height:1122.52px;padding:var(--sheet-top,56px) var(--sheet-right,60px) var(--sheet-bottom,49px) var(--sheet-left,57px);transform-origin:top left;transform:scale(var(--sheet-preview-scale,1))}
}
@media (hover:none) and (pointer:coarse) and (max-width:1024px) and (orientation:landscape){
 .mobile-editor-tabs{padding:6px 16px}
 .creator-layout .controls{padding:12px 16px}
}
@media print{
 .mobile-editor-tabs{display:none!important}
 .creator-layout .workspace{display:block!important}
 .creator-layout .sheet-preview-frame{display:contents}
 .creator-layout .sheet-preview-frame>.page{position:relative;transform:none;width:auto;min-width:0;max-width:none}
}

/* v0.3.72: deterministic mobile editor typography across orientation changes.
   Avoid iOS/Android automatic text inflation and touch-media mismatches. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
@media screen and (max-width:1024px){
 .creator-layout .selection-heading,.creator-layout .controls h2{font-size:14px;line-height:1.4}
 .creator-layout .selection-current{font-size:16px;line-height:1.45;overflow-wrap:anywhere}
 .creator-layout .selection-change{font-size:14px;line-height:1.3}
 .creator-layout .controls label{font-size:14px;line-height:1.45}
 .creator-layout .controls input:not([type=color]):not([type=range]),
 .creator-layout .controls textarea,.creator-layout .controls select{font-size:16px;line-height:1.45}
 .creator-layout .difficulty-caption,.creator-layout .difficulty-indicator{font-size:14px;line-height:1.4}
 .creator-layout .difficulty-choice{font-size:14px;line-height:1.4}
 .creator-layout .worksheet-actions-row>button{font-size:14px;line-height:1.4}
 .creator-layout .mobile-editor-tabs button{font-size:15px;line-height:1.35}
 #selection-dialog .selection-dialog-header h2{font-size:19px;line-height:1.35}
 #selection-dialog .selection-dialog-options button{font-size:14px;line-height:1.4}
}

/* v0.3.73: difficulty is controlled exclusively by the three direct-tap bars.
   Do not expose a native select or wrap the bars in a label: tapping a label
   can open the native picker on mobile browsers. */
.creator-layout select#difficulty.difficulty-native{display:none!important}
.creator-layout .difficulty-heading{display:block;font-weight:600}
.creator-layout .difficulty-bar{touch-action:manipulation}

/* Stable maze cell index, aligned with validation Cell 1–16 references. */
.maze-cell text.cell-index{font-size:10px;text-anchor:end;fill:#64748b;font-weight:600}

/* v0.3.76: Align maze path slider with the numeric value in both orientations. */
.creator-layout .maze-path-length-row{display:grid;grid-template-columns:minmax(0,1fr) 2ch;align-items:center;gap:12px;width:100%;margin-top:7px}
.creator-layout .maze-path-length-row input[type=range]{display:block;width:100%;min-width:0;margin:0;align-self:center;cursor:pointer}
.creator-layout .maze-path-length-row output{display:block;margin:0;line-height:1;text-align:center;font-variant-numeric:tabular-nums;align-self:center}
.creator-layout #mazeControls>label{margin-bottom:0}
/* Loading indicator appears after the button text only while the export is running. */
.creator-layout .download-progress-button{display:inline-flex;align-items:center;justify-content:center;column-gap:0;line-height:1.25}
.creator-layout .download-progress-button .download-label{display:inline-block;line-height:inherit}
.creator-layout .download-spinner{display:none;width:14px;height:14px;box-sizing:border-box;vertical-align:middle;align-self:center;flex:none;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:cb-download-spin .7s linear infinite}
.creator-layout .download-progress-button[aria-busy="true"] .download-spinner{display:inline-block;margin-left:12px}
@keyframes cb-download-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.creator-layout .download-spinner{animation-duration:1.8s}}
