/* Scope box sizing and button colours against the legacy theme defaults. */
.challenge-shell, .challenge-shell *, .challenge-shell *::before, .challenge-shell *::after { box-sizing:border-box; }
.challenge-shell { --challenge-ink:#1b1d22; --challenge-red:#c8102e; --challenge-muted:#555c66; max-width:1120px; padding-block:3rem; color:var(--challenge-ink); font-size:1.05rem; line-height:1.65; }
.challenge-shell [hidden] { display:none !important; }
.challenge-intro { max-width:760px; margin-bottom:1.75rem; }
.challenge-intro h1 { font-size:clamp(2.2rem,4vw,3.5rem); letter-spacing:-.035em; line-height:1.1; margin-bottom:1.25rem; text-wrap:balance; }
.challenge-intro p { font-style:normal; }
.challenge-shell p { margin:0 0 1.25rem; max-width:72ch; }
.challenge-small { font-size:.9rem; color:var(--challenge-muted); }
.challenge-shell h2 { font-size:clamp(1.5rem,2.7vw,2rem); line-height:1.25; margin:0 0 1rem; padding:0; letter-spacing:-.025em; text-wrap:balance; }
.challenge-shell h3 { font-size:1.25rem; margin:2rem 0 .6rem; padding:0; }
.challenge-progress { display:flex; list-style:none; padding:0; margin:0 0 1.75rem; gap:0; border-bottom:1px solid #bfc3ca; }
.challenge-progress li { flex:1; min-width:0; overflow-wrap:anywhere; hyphens:auto; padding:0 .5rem 1rem 0; color:var(--challenge-muted); font-size:.95rem; }
.challenge-progress span { display:inline-grid; place-items:center; width:1.65rem; height:1.65rem; margin-right:.3rem; border:1px solid #949ba5; border-radius:50%; font-size:.8rem; font-variant-numeric:tabular-nums; }
.challenge-progress [aria-current="step"] { color:var(--challenge-ink); font-weight:700; border-bottom:2px solid var(--challenge-red); margin-bottom:-1px; }
.challenge-progress [aria-current="step"] span { background:var(--challenge-red); color:#fff; border-color:var(--challenge-red); }
.challenge-notice { font-size:.9rem; background:#f0f0f2; padding:1rem 1.25rem; max-width:none !important; }
.challenge-shell .challenge-notification-reminder { margin-bottom:1.75rem; }
.challenge-shell .challenge-notification-reminder h2 { font-size:1.125rem; margin-bottom:.35rem; }
.challenge-shell .challenge-notification-reminder p { margin-bottom:0; }
.challenge-notification-reminder .button { margin-top:.75rem; }
@media print { .challenge-notification-reminder { display:none; } }
.challenge-step { background:#fff; padding:clamp(1.25rem,4vw,2.75rem); }
.challenge-step h2 { scroll-margin-top:110px; }
.challenge-shell label, .challenge-shell legend { display:block; font-size:.95rem; font-weight:600; margin:0 0 .45rem; }
.challenge-shell input:not([type="checkbox"]), .challenge-shell select, .challenge-shell textarea { width:100%; background:#fff; color:var(--challenge-ink); font:inherit; line-height:1.5; border:1px solid #9299a3; border-radius:3px; padding:.65rem .8rem; box-shadow:none; margin:0; caret-color:var(--challenge-red); }
.challenge-shell input::placeholder, .challenge-shell textarea::placeholder { color:#626975; opacity:1; }
.challenge-shell textarea { resize:vertical; min-height:120px; }
.challenge-shell :focus-visible { outline:3px solid var(--challenge-red); outline-offset:3px; }
.challenge-shell input:focus, .challenge-shell select:focus, .challenge-shell textarea:focus { border-color:var(--challenge-red); }
.challenge-shell button { font-family:inherit; white-space:normal; line-height:1.35; min-height:44px; }
.challenge-shell .button { padding:.85rem 1.25rem; font-size:.95rem; letter-spacing:0; border-radius:3px; }
.challenge-shell button:disabled { opacity:.55; cursor:not-allowed; }
.challenge-text-button { background:transparent; border:0; padding:.4rem .2rem; color:#a70c26 !important; font-weight:600; text-decoration:underline; text-underline-offset:.2em; cursor:pointer; box-shadow:none; }
.challenge-text-button:hover { color:var(--challenge-ink) !important; background:#f0f0f2; }
.challenge-actions { display:flex; flex-wrap:wrap; align-items:center; gap:.75rem; margin-top:1.75rem; }
.challenge-sketch { margin-top:1.75rem; border-top:1px solid #d4d6db; padding-top:1.5rem; }
.challenge-sketch summary { cursor:pointer; font-weight:600; padding:.2rem 0 .8rem; }
.challenge-node-form { display:grid; grid-template-columns:minmax(0,2fr) minmax(0,1fr) auto; gap:.75rem; align-items:end; margin:1.5rem 0 1rem; }
.challenge-canvas { height:360px; position:relative; overflow:hidden; background-color:#f7f7f8; background-image:radial-gradient(#c9ccd2 .8px,transparent .8px); background-size:20px 20px; border:1px solid #d4d6db; }
.challenge-canvas svg { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.challenge-canvas line { stroke:#69717c; stroke-width:2; vector-effect:non-scaling-stroke; marker-end:url(#challenge-arrow); }
.challenge-canvas marker { fill:#69717c; }
.challenge-canvas-empty { position:absolute; top:45%; width:100%; text-align:center; color:var(--challenge-muted); padding:0 1rem; pointer-events:none; }
.challenge-map-node { position:absolute; transform:translate(-50%,-50%); width:132px; padding:.6rem; background:#fff; color:var(--challenge-ink) !important; border:1px solid #69717c; border-radius:4px; cursor:grab; touch-action:none; box-shadow:0 3px 8px #1b1d2212; font-size:.85rem; overflow-wrap:anywhere; }
.challenge-map-node:hover, .challenge-map-node:active { background:#fff; border-color:var(--challenge-red); }
.challenge-map-node:active { cursor:grabbing; }
.challenge-map-node small { display:block; color:#626975; font-size:.7rem; font-weight:400; }
.challenge-node-list { display:grid; gap:.5rem; margin:1rem 0; }
.challenge-node-row { display:grid; grid-template-columns:7rem minmax(0,1fr) auto; align-items:center; gap:.5rem; }
.challenge-node-row label { margin:0; font-size:.85rem; }
.challenge-shell fieldset { padding:1rem 0 0; border:0; margin:1.25rem 0 0; min-width:0; }
.challenge-edge-form { display:grid; grid-template-columns:1fr 1fr 1.3fr auto; gap:.75rem; align-items:end; }
.challenge-edges { padding:0; margin-top:1rem; list-style:none; }
.challenge-edges li { display:flex; justify-content:space-between; align-items:center; gap:1rem; border-bottom:1px solid #dedfe3; padding:.4rem 0; font-size:.9rem; overflow-wrap:anywhere; }
.challenge-question { margin-top:1.75rem; }
.challenge-question textarea { min-height:90px; }
.challenge-error { padding:1rem; border:1px solid #c8102e; color:#8f0820; background:#fff5f6; max-width:none !important; }
.challenge-review-description { white-space:pre-wrap; overflow-wrap:anywhere; }
.challenge-review-graph { padding:1rem 0; border-block:1px solid #dedfe3; }
.challenge-review-graph ul { margin-bottom:.5rem; }
.challenge-assessment { margin:1.5rem 0; }
.challenge-assessment > div { display:grid; grid-template-columns:150px minmax(0,1fr); border-bottom:1px solid #dedfe3; padding:1rem 0; gap:1rem; }
.challenge-assessment dt { font-weight:700; }
.challenge-assessment dd { margin:0; }
.challenge-assessment dd span { display:block; font-size:.95rem; color:var(--challenge-muted); }
.challenge-send-prompt { border-top:1px solid #dedfe3; margin-top:2rem; }
#challenge-contact { max-width:650px; }
#challenge-contact > input { margin-bottom:1.25rem; }
.challenge-consent { display:flex !important; align-items:flex-start; gap:.75rem; font-weight:400 !important; margin:1rem 0 !important; }
.challenge-consent input { appearance:auto; -webkit-appearance:auto; flex:0 0 22px; width:22px; height:22px; margin:.2rem 0 0; accent-color:var(--challenge-red); }
.challenge-fallback { padding-top:2rem; font-size:.95rem; }
#turnstile-widget { min-height:70px; margin:1.5rem 0 .5rem; }
#challenge-success { padding:1.5rem 0; }
@media(max-width:736px) {
 .challenge-shell { padding-block:1.5rem; }
 .challenge-progress li { font-size:.75rem; text-align:center; padding-right:.2rem; }
 .challenge-progress span { display:grid; margin:0 auto .4rem; }
 .challenge-node-form, .challenge-edge-form { grid-template-columns:1fr 1fr; }
 .challenge-node-form > :first-child { grid-column:1/-1; }
 .challenge-edge-form > :nth-child(3) { grid-column:1/-1; }
 .challenge-map-node { width:92px; font-size:.75rem; padding:.4rem; }
 .challenge-node-row { grid-template-columns:1fr auto; }
 .challenge-node-row label { grid-column:1/-1; }
 .challenge-assessment > div { grid-template-columns:1fr; gap:.3rem; }
 .challenge-actions .button { flex:1 1 auto; }
}

.challenge-progress { scroll-margin-top:100px; }
.challenge-review-graph .challenge-map-node { cursor:default; }

.challenge-draft-tools { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem 1rem; margin-bottom:1rem; }
.challenge-graph-tools { margin:1rem 0; }
.challenge-shell dialog { max-width:640px; width:calc(100% - 2rem); padding:clamp(1.25rem,4vw,2rem); border:1px solid #9299a3; border-radius:6px; color:#1b1d22; background:#fff; }
.challenge-shell dialog::backdrop { background:#1b1d2280; }
.challenge-review-graph svg { width:100%; height:auto; max-height:600px; }
.challenge-review-graph ul { overflow-wrap:anywhere; }
.challenge-print-frame { position:fixed; left:-10000px; top:0; width:820px; height:1100px; border:0; }
.challenge-map-node span { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.challenge-edges li span { min-width:0; }
.challenge-edges li button { flex-shrink:0; }
#challenge-success .button { margin:.5rem .5rem .5rem 0; }
@media (prefers-reduced-motion: reduce) { .challenge-shell * { scroll-behavior:auto !important; transition:none !important; } }
@media (forced-colors: active) {
 .challenge-shell :focus-visible { outline:3px solid Highlight; }
 .challenge-map-node, .challenge-shell .button { border:1px solid ButtonText; }
 .challenge-canvas line { stroke:CanvasText; }
 .challenge-canvas marker { fill:CanvasText; }
 .challenge-progress [aria-current="step"] { border-color:Highlight; }
}

/* Diagram tools and direct connection handles. */
.challenge-toolbar { display:flex; flex-wrap:wrap; gap:.4rem; align-items:stretch; padding:.6rem; margin:1.25rem 0 .8rem; border:1px solid #c1c5cd; background:#f7f7f8; border-radius:4px; }
.challenge-shell .challenge-tool { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.35rem; flex:1 1 72px; min-width:68px; padding:.65rem .5rem; background:transparent; color:#383e47 !important; border:1px solid transparent; border-radius:3px; font-size:.8rem; font-weight:600; }
.challenge-shell .challenge-tool:hover { background:#fff; border-color:#9299a3; }
.challenge-shell .challenge-tool[aria-pressed="true"] { background:#fff; border-color:#c8102e; color:#a70c26 !important; }
.challenge-tool svg { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.challenge-component-editor { display:grid; grid-template-columns:auto minmax(0,1fr); gap:.4rem .8rem; align-items:center; padding:.75rem 0; }
.challenge-component-editor label { margin:0; }
.challenge-component-editor .challenge-small { grid-column:1/-1; }
.challenge-connection-feedback { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem 1rem; min-height:2.5rem; }
.challenge-connection-feedback p { margin:0; }
.challenge-list-editor { padding-top:1.2rem; }
.challenge-list-editor summary { cursor:pointer; font-size:.95rem; font-weight:600; }
.challenge-node-shell { position:absolute; width:132px; transform:translate(-50%,-50%); }
.challenge-node-shell .challenge-map-node { position:relative; width:100%; transform:none; display:block; padding:.65rem; }
.challenge-node-shell .challenge-map-node .challenge-node-icon { position:static; display:block; width:20px; height:20px; margin:0 auto .25rem; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.challenge-shell .challenge-connect-handle { position:absolute; right:-22px; top:50%; transform:translateY(-50%); display:grid; place-items:center; width:44px; height:44px; min-height:44px; padding:0; background:transparent; color:#555c66 !important; border:0; border-radius:50%; touch-action:none; cursor:crosshair; }
.challenge-connect-handle svg { position:static; width:24px; height:24px; fill:#fff; stroke:currentColor; stroke-width:1.8; }
.challenge-node-shell.port-left .challenge-connect-handle { right:auto; left:-22px; }
.challenge-node-shell.is-selected .challenge-map-node { border-color:#1b1d22; }
.challenge-node-shell.is-connection-source .challenge-map-node { outline:2px solid #c8102e; outline-offset:2px; }
.challenge-shell .challenge-connect-handle:hover, .challenge-shell .challenge-connect-handle[aria-pressed="true"] { color:#c8102e !important; background:#fff; }
.is-connecting .challenge-map-node { cursor:crosshair; }
.is-connecting .challenge-node-shell:not(.is-connection-source) .challenge-map-node:hover { outline:2px solid #c8102e; outline-offset:2px; }
#challenge-preview line { stroke:#c8102e; stroke-dasharray:6 4; }
.challenge-edges li > div { flex:1; min-width:0; }
@media(max-width:736px) {
 .challenge-node-shell { width:92px; }
 .challenge-component-editor { grid-template-columns:1fr; }
 .challenge-toolbar { gap:.2rem; padding:.3rem; }
 .challenge-shell .challenge-tool { flex-basis:22%; min-width:54px; font-size:.75rem; }
}
@media(forced-colors:active) {
 .challenge-shell .challenge-tool { border:1px solid ButtonText; }
 .challenge-node-shell.is-connection-source .challenge-map-node { outline-color:Highlight; }
 .challenge-connect-handle svg { fill:Canvas; stroke:ButtonText; }
 #challenge-preview line { stroke:Highlight; }
}

#email-destination { overflow-wrap:anywhere; }

/* Saved enquiries share the brief's typography and keep reports in a readable measure. */
.challenge-history { margin:0 0 2.5rem; padding-bottom:2rem; border-bottom:1px solid #bfc3ca; }
.enquiries-list { list-style:none; padding:0; margin:0; }
.enquiries-list li { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:.25rem 1.5rem; padding:.6rem 0; border-bottom:1px solid #dedfe3; }
.enquiries-list button { text-align:left; font-variant-numeric:tabular-nums; }
.enquiries-list button[aria-expanded="true"] { color:var(--challenge-ink) !important; text-decoration-thickness:2px; }
.enquiry-detail { margin-top:1.5rem; padding:clamp(1.25rem,4vw,2.75rem); background:#fff; overflow-wrap:anywhere; }
.enquiry-navigation { margin:0 0 1.5rem; justify-content:space-between; }
.enquiry-detail details { margin-top:1.75rem; border-block:1px solid #dedfe3; padding:1rem 0; }
.enquiry-detail summary { cursor:pointer; font-weight:600; }
#enquiry-brief { margin-top:1rem; }
.enquiry-messages { padding-left:1.5rem; }
.enquiry-messages li { padding:1rem 0 .25rem; border-bottom:1px solid #dedfe3; }
.enquiry-messages li p:first-child { margin-bottom:.35rem; }
.enquiry-artifact { padding:1rem 0; border-bottom:1px solid #dedfe3; }
.enquiry-artifact h4 { font-size:1rem; margin:0; padding:0; font-weight:700; }
.enquiry-artifact .challenge-actions { margin:.35rem 0 .75rem; }
.enquiry-report { max-width:75ch; max-height:36rem; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; padding:1.25rem; margin:0; border:1px solid #d4d6db; background:#f7f7f8; color:var(--challenge-ink); font:inherit; font-size:.95rem; }
.enquiry-forget { margin-top:2rem; font-size:.85rem; }
#enquiry-followup-help { margin-top:.65rem; }
#enquiry-followup-message, #enquiry-email { margin-top:1rem; }
#enquiry-status { scroll-margin-top:110px; }
#enquiry-reference { font-variant-numeric:tabular-nums; }
@media print { .challenge-history { display:none; } }

.challenge-retention { margin-top:2.5rem; padding-top:1.5rem; border-top:1px solid #d4d6db; }
.challenge-retention p { max-width:75ch; }

.challenge-app { margin:0 0 2.5rem; padding:1.5rem 0; border-block:1px solid #d4d6db; }
.challenge-app h2 { font-size:1.25rem; margin-bottom:.75rem; }
.challenge-app .challenge-actions { margin:1rem 0; }
.challenge-app .challenge-actions:not(:has(button:not([hidden]))), .challenge-app [role="status"]:empty { display:none; }
.challenge-app p:last-child { margin-bottom:0; }

.challenge-app summary { font-weight:600; cursor:pointer; }
.challenge-app-help[open] summary { margin-bottom:1rem; }

/* The same editor moves into a top-layer workspace, preserving its graph and controls. */
.sketch-is-fullscreen { overflow:hidden; }
.sketch-editor-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.75rem; margin-bottom:1rem; }
.challenge-shell .sketch-editor-heading h2 { margin:0; font-size:1.25rem; }
.challenge-shell .sketch-fullscreen { display:inline-flex; align-items:center; gap:.5rem; }
.sketch-fullscreen svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.sketch-help { margin-bottom:1rem; }
.sketch-help summary { cursor:pointer; font-size:.9rem; color:#a70c26; }
.sketch-help[open] summary { margin-bottom:.5rem; }
.challenge-shell #sketch-dialog { position:fixed; inset:0; width:100%; max-width:none; height:100dvh; max-height:none; margin:0; border:0; border-radius:0; padding:clamp(1rem,2vw,2rem); overflow:auto; overscroll-behavior:contain; }
#sketch-dialog .sketch-editor { display:flex; flex-direction:column; min-height:100%; }
#sketch-dialog .sketch-editor-heading { position:sticky; top:0; z-index:3; background:#fff; padding-block:.5rem; }
#sketch-dialog .challenge-canvas { flex:1 0 auto; }
#sketch-dialog .challenge-toolbar { flex-shrink:0; }
.challenge-review-actions { display:flex; align-items:flex-start; flex-wrap:wrap; gap:.75rem 1.25rem; margin-block:1.5rem; }
.challenge-export-options summary, .challenge-file-formats summary, .challenge-retention summary { cursor:pointer; font-weight:600; text-underline-offset:.2em; }
.challenge-export-options summary { color:#a70c26; padding:.6rem .2rem; }
.challenge-export-list { display:flex; flex-direction:column; align-items:flex-start; gap:.4rem; padding:.5rem 0; }
.challenge-file-formats { margin-bottom:1rem; }
.challenge-file-formats[open] summary, .challenge-retention details[open] summary { margin-bottom:.75rem; }
.challenge-draft-tools { margin-block:1.5rem 0; }
.challenge-app { margin-top:2rem; }
#challenge-submit { margin-top:1.5rem; padding-top:1rem; border-top:1px solid #d4d6db; }
#challenge-submit.is-ready .button { font-weight:700; }
@media(max-width:736px) {
 .challenge-shell #sketch-dialog { padding:max(.75rem,env(safe-area-inset-top)) max(.75rem,env(safe-area-inset-right)) max(.75rem,env(safe-area-inset-bottom)) max(.75rem,env(safe-area-inset-left)); }
 #challenge-submit .button { width:100%; }
}

.challenge-files { margin-top:1.75rem; padding-top:.25rem; border-top:1px solid #d4d6db; }
.challenge-file-drop { position:relative; border:1px dashed #9299a3; border-radius:3px; background:#f7f7f8; cursor:pointer; transition:background-color .15s,border-color .15s; }
.challenge-file-drop:hover, .challenge-file-drop.is-dragging { border-color:var(--challenge-red); background:#fff5f6; }
.challenge-file-drop:has(button:disabled) { cursor:wait; }
.challenge-shell .challenge-file-select { display:block; width:100%; min-height:130px; padding:1.5rem; border:0; border-radius:3px; background:transparent; color:var(--challenge-ink) !important; font:inherit; font-weight:600; text-align:center; box-shadow:none; cursor:pointer; }
.challenge-file-drop.has-files .challenge-file-select { min-height:64px; padding:1rem; font-size:.95rem; }
.challenge-file-select span { color:inherit; font:inherit; }
.challenge-shell #challenge-file-select,
.challenge-shell #challenge-file-prompt { color:#1b1d22 !important; -webkit-text-fill-color:currentColor; }
.challenge-shell #to-verify { background:#c8102e; color:#fff !important; -webkit-text-fill-color:currentColor; }
.challenge-shell #to-verify:hover { background:#a60d26; }
.challenge-shell #to-verify:active { background:#940c22; }
.challenge-file-drop .challenge-files-list { list-style:none; padding:0 1rem; margin:0; }
.challenge-file-drop .challenge-files-list li:last-child { border-bottom:0; }
.challenge-files-list li { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.35rem 0; border-bottom:1px solid #d4d6db; }
.challenge-files-list span, .challenge-uploaded-files button { overflow-wrap:anywhere; min-width:0; }
.challenge-files-list button { flex-shrink:0; }
.challenge-uploaded-files li { margin-bottom:.5rem; }
.challenge-uploaded-files [role="status"] { display:block; font-size:.9rem; }
