/* Fonts are hosted alongside the app (SIL Open Font Licence): no third-party requests. The STEM Racing livery uses
   Barlow (text), Barlow Condensed italic (headings and buttons) and Chakra Petch (labels), as on the STEM Racing
   side of detscotland.co.uk; Poppins and JetBrains Mono are kept for the computer check page. */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: italic; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-700-italic.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: italic; font-weight: 800; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-800-italic.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/chakra-petch-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/chakra-petch-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/poppins-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 800; font-display: swap; src: url("../assets/fonts/poppins-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }
/* STEM Racing livery: the colours of the STEM Racing side of detscotland.co.uk (its .sr-* styles). The names are
   the DesignClass tokens the rest of this file uses, so every part of the app takes the livery: --paper is the
   page, --card a card or field on it, --text the main text (white here), --blue the highlight (STEM Racing
   magenta) and --cyan the bright accent on the picture (the site's teal). */
:root {
  --ink: #0A0318;          /* darkest purple: the picture's stage, the header */
  --ink2: #160832;
  --paper: #12052A;        /* the page */
  --card: #2A0C4C;         /* cards and fields */
  --card-2: #2F1052;
  --white: #FFFFFF;
  --blue: #E6007E;         /* STEM Racing magenta */
  --blue-d: #B8006A;
  --cyan: #2FD6C9;         /* teal */
  --orange: #ED6D05;
  --yellow: #FFCC00;
  --lime: #95C11F;
  --text: #FFFFFF;
  --pencil: #BDB4D8;       /* soft lilac text */
  --field: #4B3373;        /* field and card edges */
  --body-dark: #CDC6E0;
  --tb-label: #A99FC4;
  --tb-value: #E9E4F5;
  --danger: #FF4D5E;
  --line: rgba(205, 198, 224, .16);
  --line-dark: rgba(170, 140, 230, .26);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sans: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Chakra Petch", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --hot: linear-gradient(100deg, #961B81 0%, #E6007E 52%, #ED6D05 100%);   /* the STEM Racing gradient */
  --kerb: repeating-linear-gradient(-60deg, #E6007E 0 14px, #FFFFFF 14px 28px);
  --panel-w: 400px;
  --header-h: 64px;
  --blueprint:
    linear-gradient(rgba(117, 111, 144, .09) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(117, 111, 144, .09) 1px, transparent 1px) 0 0 / 40px 40px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 14px/1.5 var(--sans); color: var(--text); background: var(--paper);
  display: flex; flex-direction: column; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.site-header :focus-visible, .viewport :focus-visible { outline-color: var(--white); }

/* ---------------------------------------------------------------- header */
.site-header {
  height: var(--header-h); flex: none; position: relative; z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 0 clamp(14px, 2vw, 24px); color: var(--white);
  background: radial-gradient(60% 180% at 85% 0%, rgba(230, 0, 126, .38), transparent 70%), var(--blueprint), var(--ink);
  border-bottom: 1px solid var(--line-dark);
}
.brand { display: block; line-height: 0; flex: none; }
.brand img { height: 40px; width: auto; display: block; }
.brand-text {
  display: flex; flex-direction: column; line-height: 1.15; min-width: 0;
  padding-left: 16px; border-left: 1px solid var(--line-dark);
}
.eyebrow { font: 500 .68rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
.app-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; white-space: nowrap; }
.app-name .accent { color: var(--cyan); }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- buttons */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--h); padding: 0 1.15em; border-radius: 999px; border: 1.5px solid var(--text);
  background: transparent; color: var(--text); font-weight: 600; font-size: .86rem; line-height: 1.1;
  cursor: pointer; white-space: nowrap; user-select: none; text-align: center;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.btn:hover { background: var(--text); color: var(--white); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--white); box-shadow: 0 10px 24px -10px var(--blue); }
.btn.primary:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn.ghost { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .55); color: var(--white); }
.btn.ghost:hover { background: rgba(255, 255, 255, .14); }
.btn.small { --h: 36px; padding: 0 .95em; font-size: .8rem; }
.btn.block { width: 100%; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--white); }
.btn.on { background: var(--blue); border-color: var(--blue); color: var(--white); }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; box-shadow: none; }
.btn .arrow { font-family: var(--mono); }

/* ---------------------------------------------------------------- layout */
.layout { flex: 1; display: grid; grid-template-columns: var(--panel-w) minmax(0, 1fr); min-height: 0; }
.panel {
  overflow-y: auto; padding: 16px clamp(14px, 1.4vw, 20px) 40px;
  background:
    linear-gradient(rgba(18, 23, 38, .05) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(18, 23, 38, .05) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--paper);
  border-right: 1px solid var(--line);
}
.viewport {
  position: relative; min-width: 0; overflow: hidden; color: var(--white);
  background: radial-gradient(ellipse at 60% 30%, rgba(230, 0, 126, .22), transparent 60%), var(--blueprint), var(--ink);
}
/* once a model is loaded the viewport shows the studio colour behind the (transparent) render */
.viewport.has-model { background: var(--studio, #e8e9eb); }
.viewport:not(.has-model) #canvas { visibility: hidden; }   /* empty floor would wash out the blueprint stage */
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
/* the second ray tracer (WebGPU) draws over the normal canvas; clicks go through to the one underneath */
#canvasGpu { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
#canvasGpu[hidden] { display: none; }

/* ---------------------------------------------------------------- panel sheets */
details.sheet {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; margin-bottom: 14px;
  box-shadow: 0 28px 50px -34px rgba(18, 23, 38, .45);
}
details.sheet > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; min-height: 56px; border-radius: 20px;
}
details.sheet > summary::-webkit-details-marker { display: none; }
details.sheet > summary::after { content: "+"; margin-left: auto; font-size: 1.35rem; line-height: 1; color: var(--blue); }
details.sheet[open] > summary::after { content: "−"; }
.sheet-tag {
  display: inline-flex; align-items: center; gap: .7em; padding-right: .7em; flex: none;
  border: 1.5px solid var(--text); border-radius: 6px; overflow: hidden;
  font: 700 .68rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.sheet-tag .num { background: var(--text); color: var(--white); padding: .45em .6em; }
.sum-title { font-weight: 800; font-size: 1.02rem; letter-spacing: -.01em; }
.sbody { padding: 0 16px 18px; display: flex; flex-direction: column; gap: 14px; }

/* ---------------------------------------------------------------- fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font: 700 .68rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text);
}
.field > .top output { font: 500 .74rem var(--mono); letter-spacing: 0; text-transform: none; color: var(--blue); white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; }
.muted { color: var(--pencil); font-size: .8rem; line-height: 1.45; }
.video-warn { color: var(--yellow); font-size: .85rem; line-height: 1.45; margin: 8px 0; }   /* 2.4.2: a shape in the turntable camera's way */
.video-warn[hidden] { display: none; }
.readout { font: 500 .74rem/1.5 var(--mono); color: var(--pencil); }
select, input[type="text"] {
  height: 40px; border: 1.5px solid var(--field); border-radius: 12px; background: var(--card);
  padding: 0 10px; min-width: 0; transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
select:focus, input[type="text"]:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(230, 0, 126, .15); }
input[type="range"] { width: 100%; accent-color: var(--blue); margin: 2px 0; }
input[type="color"] {
  -webkit-appearance: none; appearance: none; width: 40px; height: 40px; flex: none; cursor: pointer;
  border: 1.5px solid var(--field); border-radius: 12px; padding: 3px; background: var(--card);
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 8px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 8px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; font-size: .86rem; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
.seg {
  display: flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--field);
}
.seg button {
  flex: 1; border: 0; background: transparent; min-height: 32px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: .8rem; color: var(--pencil); white-space: nowrap;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--blue); color: var(--white); }
.seg.wrap { flex-wrap: wrap; border-radius: 16px; }
.seg.wrap button { flex: 1 1 45%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  border: 1.5px solid var(--field); background: var(--card); border-radius: 999px; height: 28px; padding: 0 10px;
  font: 500 .7rem var(--mono); letter-spacing: .04em; color: var(--pencil); cursor: pointer;
}
.chips button:hover { border-color: var(--text); color: var(--text); }

/* ---------------------------------------------------------------- material slots & decals */
.slots, .decals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.slot { border: 1.5px solid var(--field); border-radius: 16px; padding: 8px; display: flex; flex-direction: column; gap: 8px; background: var(--card); }
.slot.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(230, 0, 126, .12); }
.slot .head { display: flex; gap: 8px; align-items: center; }
.slot .head input[type="text"] { flex: 1; border-color: transparent; background: transparent; padding: 0 8px; font-weight: 700; }
.slot .head input[type="text"]:hover, .slot .head input[type="text"]:focus { border-color: var(--field); }
.slot .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot .opts .full { grid-column: 1 / -1; }
.icon-btn {
  width: 32px; height: 32px; flex: none; border-radius: 999px; border: 1.5px solid var(--field); background: transparent;
  cursor: pointer; color: var(--pencil); font-size: 1rem; line-height: 1;
}
.icon-btn:hover { border-color: var(--danger); color: var(--danger); }
.decal { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border: 1.5px solid var(--field); border-radius: 16px; cursor: pointer; background: var(--card); }
.decal.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(230, 0, 126, .12); }
.decal.pending { border-style: dashed; }   /* uploaded, waiting to be clicked onto the model */
.decal img {
  width: 40px; height: 40px; object-fit: contain; border-radius: 10px; flex: none;
  background: repeating-conic-gradient(#d9dbe0 0 25%, #f4f5f7 0 50%) 50% / 10px 10px;
}
.decal .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.decal .state { font: 500 .66rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--pencil); }
.editor { border-top: 1px dashed var(--field); padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }

/* ---------------------------------------------------------------- viewport overlays */
.view-tools { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; z-index: 3; }
.viewport:not(.has-model) .view-tools { display: none; }
.dark-seg {
  pointer-events: auto; display: inline-flex; border-radius: 999px; padding: 3px; gap: 2px;
  background: rgba(10, 16, 32, .82); backdrop-filter: blur(12px); border: 1px solid var(--line-dark);
}
.dark-seg button {
  border: 0; background: transparent; color: var(--body-dark); min-height: 34px; padding: 0 12px; border-radius: 999px;
  font: 500 .72rem var(--mono); letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.dark-seg button:hover { color: var(--white); background: rgba(255, 255, 255, .08); }
.dark-seg button.active { background: var(--cyan); color: var(--ink); }
#viewSeg { margin-left: auto; }
.hint {
  position: absolute; top: 62px; left: 50%; transform: translateX(-50%); z-index: 3; max-width: min(540px, calc(100% - 28px));
  background: rgba(10, 16, 32, .9); backdrop-filter: blur(12px); border: 1px solid var(--line-dark); color: var(--white);
  padding: 8px 16px; border-radius: 999px; font-size: .8rem; text-align: center; pointer-events: none;
}
.badge {
  position: absolute; top: 62px; right: 14px; z-index: 3; padding: 6px 12px; border-radius: 999px;
  background: rgba(10, 16, 32, .9); border: 1px solid var(--line-dark); color: var(--cyan);
  font: 500 .72rem var(--mono); letter-spacing: .06em; text-transform: uppercase;
}

/* engineering-drawing title block: live facts about the render */
.title-block {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 3;
  display: grid; grid-template-columns: 1.3fr 2.1fr 1fr 1fr 1.2fr auto;
  border: 1px solid var(--line-dark); border-radius: 12px; overflow: hidden;
  background: rgba(10, 16, 32, .86); backdrop-filter: blur(12px);
}
.tb-cell { padding: 6px 12px 7px; border-right: 1px solid var(--line-dark); min-width: 0; }
.tb-cell:last-child { border-right: 0; }
.tb-cell span { display: block; font: 700 .6rem/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--tb-label); }
.tb-cell b { display: block; font: 500 .76rem/1.4 var(--mono); color: var(--tb-value); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 3px; border-radius: 3px; background: rgba(160, 195, 255, .2); margin-top: 4px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--cyan); transition: width .2s; }

/* empty state on the blueprint stage */
.empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px; text-align: center; color: var(--body-dark);
}
.empty-title { margin: 0; font-weight: 800; font-size: clamp(1.5rem, 2.6vw, 2.3rem); letter-spacing: -.025em; line-height: 1.1; color: var(--white); }
.empty-title b { color: var(--cyan); font-weight: 800; }
.empty-sub { margin: 0 0 10px; max-width: 420px; font-size: .9rem; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: min(420px, 100%); min-height: 120px; border: 1.5px dashed var(--line-dark); border-radius: 18px; cursor: pointer;
  background: rgba(18, 27, 54, .6); transition: border-color .18s var(--ease), background-color .18s var(--ease);
}
.dropzone::before, .dropzone::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1.5px solid var(--cyan); }
.dropzone::before { top: -8px; left: -8px; border-right: 0; border-bottom: 0; }
.dropzone::after { bottom: -8px; right: -8px; border-left: 0; border-top: 0; }
.dropzone:hover, .viewport.dragging .dropzone { border-color: var(--cyan); background: rgba(79, 227, 255, .08); }
.dropzone strong { font-weight: 600; color: var(--white); font-size: 1rem; }
.dropzone span { font-size: .82rem; }
.empty .readout { color: var(--tb-label); margin-top: 8px; }
.empty .readout a { color: var(--cyan); }

/* what went wrong with the graphics card, over the picture (js/app.js showProblem) */
.gpu-problem {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 6;
  width: min(460px, calc(100% - 28px)); padding: 16px 18px; border-radius: 14px; text-align: left;
  background: rgba(10, 16, 32, .94); border: 1px solid var(--danger); color: var(--body-dark); font-size: .8rem; line-height: 1.5;
}
.gpu-problem b { display: block; margin-bottom: 6px; color: var(--white); font-size: .9rem; font-weight: 600; }
.gpu-problem p { margin: 0 0 8px; }
.gpu-problem span { font-family: var(--mono); font-size: .72rem; }
.gpu-problem a { color: var(--cyan); }
.gpu-problem .row { margin-top: 12px; }

/* Save card: shown while the ray tracer is off on this computer */
.simple-note {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px;
  border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 10px;
  background: var(--card); color: var(--pencil); font-size: .8rem; line-height: 1.45;
}
.simple-note[hidden] { display: none; }

/* Information for IT */
.it-dialog {
  width: min(640px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 20px 22px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--card); color: var(--text); font-size: .86rem; line-height: 1.5;
}
.it-dialog::backdrop { background: rgba(10, 16, 32, .6); }
.it-dialog h2 { margin: 0 0 10px; font-size: 1.05rem; }
.it-dialog h3 { margin: 14px 0 4px; font-size: .9rem; }
.it-dialog p { margin: 0 0 8px; }
.it-dialog ol { margin: 0 0 8px; padding-left: 20px; }
.it-dialog li { margin-bottom: 6px; }
.it-dialog code { font: 500 .78rem var(--mono); background: rgba(18, 23, 38, .06); padding: 1px 4px; border-radius: 4px; }
.it-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: rgba(18, 23, 38, .05); font: 500 .76rem/1.45 var(--mono); }
.it-facts dt { color: var(--pencil); }
.it-facts dd { margin: 0; overflow-wrap: anywhere; }
.it-copy-text { width: 100%; height: 120px; margin-top: 8px; font: 12px/1.4 var(--mono); }
.it-dialog .row { margin-top: 14px; }
.simple-note b { color: var(--text); font: 700 .68rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; }

/* busy overlay (STEP import, HDRI loading) */
.busy {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 16px; text-align: center; color: var(--white);
  background: rgba(10, 16, 32, .74); backdrop-filter: blur(4px);
}
.ring { width: 54px; height: 54px; border-radius: 50%; border: 2px dashed var(--cyan); animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.busy-label { font: 500 .85rem/1.4 var(--mono); letter-spacing: .06em; }
.busy-sub { font-size: .78rem; color: var(--body-dark); min-height: 1em; }
.bar { position: relative; width: min(320px, 80%); height: 6px; border-radius: 999px; background: rgba(160, 195, 255, .2); overflow: hidden; }
.bar span { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: 999px; background: var(--cyan); transition: width .25s; }
.bar.indeterminate span { width: 35% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { left: -35%; } to { left: 100%; } }

.toast {
  position: absolute; left: 50%; bottom: 78px; z-index: 7; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 28px); padding: 9px 18px; border-radius: 999px; font-size: .82rem;
  background: var(--ink); color: var(--white); border: 1px solid var(--line-dark); transition: all .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 1100px) { :root { --panel-w: 360px; } .title-block { grid-template-columns: 1.2fr 2fr 1fr 1fr; } .tb-cell.wide-only { display: none; } }
/* Phones and small tablets held upright: the picture fills the top half of the screen and stays there; the
   cards sit side by side in the bottom half and swipe sideways (the next card peeks in), each scrolling up and
   down on its own. Held sideways they keep the side-by-side layout of a computer (see the landscape rules). */
@media (max-width: 860px) and (orientation: portrait) {
  body { height: 100dvh; }
  .layout { display: flex; flex-direction: column-reverse; }
  .viewport { flex: 0 0 50%; min-height: 0; }
  .panel {
    flex: 1 1 0; min-height: 0; display: flex; align-items: flex-start; gap: 12px;
    overflow-x: auto; overflow-y: hidden; padding: 12px 14px; border-right: 0; border-top: 1px solid var(--line);
    scroll-snap-type: x mandatory; scroll-padding: 0 14px; overscroll-behavior-x: contain;
  }
  .panel > details.sheet {
    flex: 0 0 min(86vw, 420px); max-height: 100%; margin: 0; overflow-y: auto; overscroll-behavior-y: contain;
    scroll-snap-align: start;
  }
  /* a finger dragging along a slider moves the slider; up and down still scrolls the card */
  .panel input[type="range"] { touch-action: pan-y; }
}
@media (max-width: 860px) {
  .brand img { height: 32px; }
  .brand-text .eyebrow { display: none; }
  /* the facts under the picture: just the model and the render's progress, on one line */
  .title-block { grid-template-columns: 1fr 1.6fr; left: 10px; right: 10px; bottom: 10px; }
  .tb-cell:nth-child(n+3) { display: none; }
  .view-tools { top: 10px; left: 10px; right: 10px; gap: 6px; }
  .toast { bottom: 64px; }
  /* the start screen fits the half-height stage */
  .empty { justify-content: safe center; overflow-y: auto; gap: 6px; }
  .empty-sub, .empty .steps { display: none; }
  .dropzone { min-height: 84px; }
  /* cards are narrow on a phone: long choices go on two lines rather than out of the card */
  .seg button { white-space: normal; line-height: 1.15; padding: 4px 8px; }
}
/* Phones held sideways: the cards scroll up and down in a narrower column on the left, the picture fills the
   rest, and the header is lower so the picture gets as much of the short screen as it can. */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --panel-w: min(320px, 42vw); --header-h: 48px; }
  body { height: 100dvh; }
  .brand img { height: 28px; }
  .brand-text .eyebrow { display: none; }
  .app-name { font-size: 1rem; }
  .header-actions .btn { --h: 34px; padding: 0 .8em; font-size: .78rem; }
  .panel { padding: 10px 10px 24px; }
  details.sheet { margin-bottom: 10px; }
  details.sheet > summary { min-height: 46px; padding: 10px 12px; }
  .title-block { grid-template-columns: 1fr 1.6fr; left: 8px; right: 8px; bottom: 8px; }
  .tb-cell:nth-child(n+3) { display: none; }
  .view-tools { top: 8px; left: 8px; right: 8px; gap: 4px; }
  .dark-seg button { min-height: 28px; padding: 0 8px; font-size: .64rem; letter-spacing: .03em; }
  .phone-hide { display: none; }
  #viewSeg { margin-left: 0; }
  .hint, .badge { top: 48px; }
  .toast { bottom: 56px; }
  .empty { justify-content: safe center; overflow-y: auto; gap: 6px; }
  .empty-sub, .empty .steps { display: none; }
  .dropzone { min-height: 72px; }
  .seg button { white-space: normal; line-height: 1.15; padding: 4px 8px; }
}
@media (max-width: 520px) {
  .site-header { gap: 10px; }
  .brand-text { padding-left: 10px; }
  .app-name { font-size: 1rem; }
  .app-prefix { display: none; }   /* the logo already says designclass */
  .brand img { height: 28px; }
  .header-actions { flex: none; gap: 6px; }
  .header-actions .btn { --h: 34px; padding: 0 .8em; font-size: .78rem; }
  .header-actions .wide-only { display: none; }
  /* the buttons over the picture take two rows, not three, so most of the picture shows */
  .view-tools { gap: 4px; }
  .dark-seg button { min-height: 28px; padding: 0 8px; font-size: .64rem; letter-spacing: .03em; }
  .phone-hide { display: none; }
  #viewSeg { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- BGE edition: friendlier controls */
.help { margin: 0; color: var(--pencil); font-size: .84rem; line-height: 1.45; }
details.more { border: 1.5px dashed var(--field); border-radius: 14px; padding: 0 12px; }
details.more > summary {
  list-style: none; cursor: pointer; display: flex; padding: 10px 0;
  font: 700 .68rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--blue);
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; margin-left: auto; font-size: 1rem; line-height: 1; }
details.more[open] > summary::after { content: "−"; }
details.more > .field, details.more > .check { margin-bottom: 14px; }

/* paint pots: one row of balls the pupil picks from */
.pots { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pot {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 66px; padding: 6px 2px;
  border: 1.5px solid transparent; border-radius: 14px; background: transparent; cursor: pointer;
  font: 600 .68rem/1.2 var(--sans); color: var(--pencil);
}
.pot:hover { border-color: var(--field); color: var(--text); }
.pot.active { border-color: var(--blue); background: var(--card); box-shadow: 0 0 0 3px rgba(230, 0, 126, .12); color: var(--text); }
.pot .ball { width: 40px; height: 40px; }
.pot .label { max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pot.add .ball {
  background: var(--card); border: 1.5px dashed var(--field); color: var(--blue); box-shadow: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 500;
}
.pot-editor {
  border: 1.5px solid var(--field); border-radius: 16px; padding: 10px; background: var(--card);
  display: flex; flex-direction: column; gap: 10px;
}
.pot-editor .icon-btn:disabled { opacity: .35; pointer-events: none; }

/* material tiles */
.mat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.mat-grid h4 {
  grid-column: 1 / -1; margin: 8px 0 0;
  font: 700 .62rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--pencil);
}
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px;
  border: 1.5px solid transparent; border-radius: 12px; background: transparent; cursor: pointer;
  font: 600 .64rem/1.15 var(--sans); color: var(--pencil); text-align: center;
}
.tile:hover { border-color: var(--field); color: var(--text); }
.tile.active { border-color: var(--blue); color: var(--text); box-shadow: 0 0 0 3px rgba(230, 0, 126, .12); }
.tile .ball { width: 34px; height: 34px; }

/* material balls: a lit sphere drawn with gradients, coloured by --c (plain colour if color-mix is missing) */
.ball {
  position: relative; flex: none; border-radius: 50%;
  box-shadow: 0 6px 10px -6px rgba(18, 23, 38, .6);
  background: var(--c, #d0142c);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .55), transparent 42%), radial-gradient(circle at 50% 50%, var(--c, #d0142c), color-mix(in srgb, var(--c, #d0142c), black 45%) 95%);
}
.ball.gloss::after { content: ""; position: absolute; left: 22%; top: 12%; width: 28%; height: 18%; border-radius: 50%; background: rgba(255, 255, 255, .85); }
.ball.satin { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .3), transparent 50%), radial-gradient(circle at 50% 50%, var(--c), color-mix(in srgb, var(--c), black 40%) 95%); }
.ball.matte, .ball.rubber { background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--c), white 15%), color-mix(in srgb, var(--c), black 35%) 95%); }
.ball.metallic::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .14) 0 1px, transparent 1px 3px); }
.ball.metal { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .9), transparent 30%), linear-gradient(160deg, color-mix(in srgb, var(--c), white 35%) 0%, var(--c) 40%, color-mix(in srgb, var(--c), black 55%) 62%, color-mix(in srgb, var(--c), white 10%) 100%); }
.ball.brushed { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .5), transparent 40%), repeating-linear-gradient(90deg, color-mix(in srgb, var(--c), black 25%) 0 1px, var(--c) 1px 3px); }
.ball.acrylic { border: 1px solid rgba(18, 23, 38, .15); background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .95), transparent 28%), radial-gradient(circle at 65% 72%, rgba(255, 255, 255, .55), transparent 35%), radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--c), white 55%), color-mix(in srgb, var(--c), white 10%) 95%); }
.ball.frosted { border: 1px solid rgba(18, 23, 38, .15); background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .7), transparent 50%), radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--c), white 50%), color-mix(in srgb, var(--c), white 15%) 95%); }
.ball.glass { border: 1px solid rgba(18, 23, 38, .2); background: radial-gradient(circle at 35% 30%, #fff, transparent 25%), radial-gradient(circle at 50% 50%, rgba(225, 242, 255, .7), rgba(165, 200, 232, .6) 95%); }
.ball.wood { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .3), transparent 45%), repeating-linear-gradient(100deg, var(--c) 0 3px, color-mix(in srgb, var(--c), black 30%) 3px 4px, var(--c) 4px 7px, color-mix(in srgb, var(--c), black 20%) 7px 8px); }
.ball.mdf { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .25), transparent 45%), repeating-radial-gradient(circle at 30% 60%, color-mix(in srgb, var(--c), black 14%) 0 .6px, transparent .6px 3px), var(--c); }
.ball.carbon { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .5), transparent 40%), repeating-conic-gradient(#222 0 25%, #555 0 50%) 50% / 8px 8px; }
.ball.image { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .4), transparent 40%), conic-gradient(#ff5a1f, #ffcc00, #2fd37a, #0a84ff, #b44dff, #ff5a1f); }

/* lighting tiles and background swatches */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tiles button {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--field); border-radius: 12px; background: var(--card);
  font: 600 .76rem/1.2 var(--sans); color: var(--text);
}
.tiles button small { display: block; font-weight: 500; font-size: .68rem; color: var(--pencil); }
.tiles button .sw { width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--g, linear-gradient(#eee, #999)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.tiles button:hover { border-color: var(--text); }
.tiles button.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(230, 0, 126, .12); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--field); background: var(--c); cursor: pointer; padding: 0; }
.swatches button:hover { border-color: var(--text); }
.swatches button.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(230, 0, 126, .18); }
.swatches input[type="color"] { width: 30px; height: 30px; border-radius: 50%; padding: 2px; }
.swatches input[type="color"]::-webkit-color-swatch { border-radius: 50%; }

/* the five steps on the welcome screen */
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; gap: 12px 16px; flex-wrap: wrap; justify-content: center; font-size: .8rem; color: var(--body-dark); }
.steps b { display: inline-flex; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--cyan); color: var(--ink); align-items: center; justify-content: center; font-size: .7rem; }


/* ---------------------------------------------------------------- added in 2.0, 2.1 and 2.2 (RenderClass) */
.ball.glow { background: radial-gradient(circle at 50% 50%, #fff 0 18%, var(--c) 45%, color-mix(in srgb, var(--c), transparent 60%) 75%, transparent 100%); box-shadow: 0 0 12px 2px color-mix(in srgb, var(--c), transparent 40%); }
.ball.screen { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .5), transparent 40%), linear-gradient(135deg, #3ad0ff, #8a5bff 55%, #ff4f9a); box-shadow: 0 0 10px 1px rgba(138, 91, 255, .55); }

/* the picture's frame: letterboxed shapes, the thirds grid and the words */
.viewport.has-model { background: #141a2c; }
.viewport.has-model #canvas { background: var(--studio, #e8e9eb); }
.viewport.shaped.has-model { background: radial-gradient(ellipse at 60% 30%, rgba(230, 0, 126, .16), transparent 60%), var(--blueprint), var(--ink); }
.frame-overlay { position: absolute; z-index: 2; pointer-events: none; }
.thirds { position: absolute; inset: 0; }
.thirds i { position: absolute; background: rgba(255, 255, 255, .8); box-shadow: 0 0 0 1px rgba(10, 16, 32, .25); }
.thirds i:nth-child(1), .thirds i:nth-child(2) { top: 0; bottom: 0; width: 1px; }
.thirds i:nth-child(3), .thirds i:nth-child(4) { left: 0; right: 0; height: 1px; }
.thirds i:nth-child(1) { left: 33.333%; } .thirds i:nth-child(2) { left: 66.667%; }
.thirds i:nth-child(3) { top: 33.333%; } .thirds i:nth-child(4) { top: 66.667%; }
.caption { position: absolute; display: flex; flex-direction: column; line-height: 1.15; font-family: var(--sans); color: var(--cap, #121726); }
.caption b { font-weight: 700; font-size: calc(var(--fh, 600px) * .045); }
.caption span { font-weight: 500; font-size: calc(var(--fh, 600px) * .028); opacity: .85; }
.caption.light { --cap: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); }
.caption.bl { left: 4%; bottom: 4%; } .caption.br { right: 4%; bottom: 4%; text-align: right; align-items: flex-end; }
.caption.tl { left: 4%; top: 4%; }
.caption.band { left: 0; right: 0; bottom: 0; padding: 2.2% 4%; background: rgba(10, 16, 32, .72); --cap: #fff; }

/* explanations next to a light or a recipe */
.recipes button .sw { border-radius: 8px; }
.recipe-note, .role-note {
  padding: 8px 12px; border-radius: 10px; background: rgba(230, 0, 126, .07); border-left: 3px solid var(--blue);
  font-size: .8rem; line-height: 1.45; color: var(--text);
}
.recipe-note b, .role-note b { font-weight: 700; }

/* the list of lights */
.light-list, .shots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.light-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 8px; border: 1.5px solid var(--field); border-radius: 14px;
  background: var(--card); cursor: pointer; font-weight: 600; font-size: .84rem;
}
.light-item.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(230, 0, 126, .12); }
.light-item.off { opacity: .55; }
.light-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.light-item small { font: 500 .64rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--pencil); }
.light-dot { width: 22px; height: 22px; border-radius: 50%; flex: none; background: radial-gradient(circle, #fff 0 25%, var(--c, #fff4e5) 60%); box-shadow: 0 0 0 1.5px var(--field), 0 0 10px 1px var(--c, #fff4e5); }
.add-lights { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.add-lights button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; cursor: pointer;
  border: 1.5px dashed var(--field); border-radius: 12px; background: var(--card); color: var(--text);
  font: 600 .72rem/1.15 var(--sans);
}
.add-lights button small { font-weight: 500; font-size: .62rem; color: var(--pencil); }
.add-lights button:hover { border-color: var(--blue); border-style: solid; }
.add-lights button:disabled { opacity: .4; pointer-events: none; }
.light-editor { border: 1.5px solid var(--field); border-radius: 16px; padding: 10px; background: var(--card); display: flex; flex-direction: column; gap: 12px; }
.light-editor .field { gap: 4px; }
.light-editor .icon-btn:hover { border-color: var(--danger); }
.switch { position: relative; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--field); transition: background-color .18s var(--ease); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }

/* camera shots */
.shot { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border: 1.5px solid var(--field); border-radius: 14px; background: var(--card); cursor: pointer; }
.shot:hover { border-color: var(--blue); }
.shot img { width: 64px; height: 40px; object-fit: cover; border-radius: 8px; flex: none; background: var(--paper); }
.shot .name { flex: 1; min-width: 0; font-weight: 600; font-size: .84rem; border: 0; background: transparent; height: 30px; padding: 0 4px; border-radius: 8px; }
.shot .name:hover, .shot .name:focus { background: var(--paper); }

/* Explore */
.explore-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 14px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--field); border-radius: 14px; background: var(--card); color: var(--text);
}
.explore-btn b { font-weight: 700; font-size: .86rem; }
.explore-btn span { font-size: .76rem; color: var(--pencil); }
.explore-btn:hover { border-color: var(--blue); }
.explore-btn:disabled { opacity: .45; pointer-events: none; }
.busy .btn.ghost { margin-top: 6px; }
.learn-dialog {
  width: min(1100px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 18px 22px 22px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--card); color: var(--text);
}
.learn-dialog::backdrop { background: rgba(10, 16, 32, .7); }
.learn-head { display: flex; align-items: center; gap: 12px; }
.learn-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; flex: 1; }
.learn-intro { margin: 6px 0 14px; color: var(--pencil); font-size: .88rem; line-height: 1.5; }
.learn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.learn-grid figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.learn-grid img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
.learn-grid figcaption { font-size: .8rem; line-height: 1.45; color: var(--pencil); }
.learn-grid figcaption b { display: block; color: var(--text); font-size: .88rem; }
.compare { position: relative; width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); user-select: none; touch-action: none; cursor: ew-resize; }
.compare img { display: block; width: 100%; }
.compare .over { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0); }
.compare .divider { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 3px; margin-left: -1.5px; background: var(--cyan); box-shadow: 0 0 0 1px rgba(10, 16, 32, .4); }
.compare .divider::after { content: "◀ ▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 6px 8px; border-radius: 999px; background: var(--ink); color: var(--cyan); font-size: .7rem; white-space: nowrap; }
.compare .tag { position: absolute; top: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(10, 16, 32, .8); color: #fff; font: 600 .72rem var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.compare .tag.left { left: 10px; } .compare .tag.right { right: 10px; background: var(--blue); }
.compare-text { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; font-size: .84rem; line-height: 1.5; color: var(--pencil); }
.compare-text b { color: var(--text); }

/* moving, turning and sizing (the model in Start, the shapes in Shapes) */
.place-fields { display: flex; flex-direction: column; gap: 10px; }
details.more.place > .place-fields { margin-bottom: 12px; }
details.more.place > .btn { margin-bottom: 8px; }
details.more.place > .muted { margin-bottom: 14px; }
.place-fields .field { gap: 2px; }
.slider-row { flex-wrap: nowrap; gap: 6px; }
.deg-box {
  width: 58px; height: 30px; flex: none; border: 1.5px solid var(--field); border-radius: 10px; background: var(--card);
  padding: 0 4px 0 8px; font: 500 .78rem var(--mono); text-align: right;
}
.deg-box:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(230, 0, 126, .15); }
.deg-box:disabled, .place-fields input[type="range"]:disabled { opacity: .45; }
.deg-unit { font: 500 .78rem var(--mono); color: var(--pencil); margin-left: -3px; }

/* shapes */
.shape-icon { width: 24px; height: 24px; flex: none; color: var(--blue); display: inline-flex; }
.shape-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.shape-palette .shape-icon { width: 28px; height: 28px; }
.shape-pots { display: flex; gap: 3px; flex: none; }
.shape-pots .ball { width: 18px; height: 18px; }
.icon-btn.copy:hover { border-color: var(--blue); color: var(--blue); }
/* print it (Save card) */
.print-field .seg[hidden], .paper-custom[hidden] { display: none; }
.paper-custom { gap: 12px; font-size: .82rem; font-weight: 600; }
.paper-custom input { width: 72px; height: 34px; margin: 0 4px; border: 1.5px solid var(--field); border-radius: 4px; padding: 0 6px; font: 500 .8rem var(--mono); background: var(--ink2); }
/* while a print picture is made the rest of the app waits: a change part way would show in only some parts */
body.printing .panel, body.printing .header-actions { pointer-events: none; opacity: .5; }
.busy-preview { max-width: min(260px, 70%); max-height: 34vh; border-radius: 6px; background: rgba(255, 255, 255, .08); box-shadow: 0 0 0 1px var(--line-dark); }
.busy-preview[hidden] { display: none; }
@media (max-width: 1100px) { .header-actions .header-project { display: none; } }
@media (max-width: 520px) {
  .add-lights { grid-template-columns: repeat(2, 1fr); }
  .compare-text { grid-template-columns: 1fr; }
  .brand-text { display: none; }   /* room for Undo and Redo: the logo already says designclass */
  .header-actions .btn { padding: 0 .7em; }
}

/* ================================================================ STEM Racing livery
   Matches the STEM Racing side of detscotland.co.uk: dark race purple, the magenta-to-orange STEM Racing
   gradient, slanted buttons, italic condensed headings, a kerb under the header and start lights. Kept in one
   place, after the shared rules, so the rest of the file stays the same as DesignClass Studio Pro. */
body { font-size: 15px; }   /* Barlow is narrower than Poppins */
:focus-visible, .site-header :focus-visible, .viewport :focus-visible { outline-color: var(--yellow); }
.panel { scrollbar-color: var(--field) transparent; }

/* header: the STEM Racing and DesignClass logos, and a kerb along the bottom */
.site-header {
  background: radial-gradient(55% 220% at 82% 0%, rgba(150, 27, 129, .45), transparent 70%), radial-gradient(40% 160% at 20% 100%, rgba(58, 13, 85, .9), transparent 70%), var(--ink);
  border-bottom: 0;
}
.site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--kerb); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img.sr-logo { height: 34px; }
.brand img.dc-logo { height: 30px; }
.brand .brand-x { font: 600 .85rem/1 var(--mono); color: rgba(255, 255, 255, .55); }
.eyebrow { font: 600 .7rem/1.3 var(--mono); letter-spacing: .08em; color: var(--cyan); }
.app-name { font: italic 800 1.5rem/1 var(--display); letter-spacing: .005em; text-transform: uppercase; }
/* words in the gradient start lighter than the buttons' gradient, so their first letters stand out on the dark purple */
.app-name .accent, .empty-title b {
  background: linear-gradient(100deg, #FF4FA8 0%, #E6007E 45%, #ED6D05 100%); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .08em;
}

/* buttons: square-cornered and slanted, like the site's */
.btn { border-radius: 4px; border-color: rgba(255, 255, 255, .75); color: var(--white); font: italic 700 1.05rem/1 var(--display); letter-spacing: .01em; }
.btn:hover { background: rgba(255, 255, 255, .12); color: var(--white); }
.btn.small { font-size: .98rem; }
.btn.primary {
  background: var(--hot); border-color: transparent; box-shadow: none; padding: 0 1.45em;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.btn.primary:hover { border-color: transparent; filter: brightness(.9); }   /* darker, so the white words stay clear */
.btn.primary:focus-visible { outline-offset: -5px; }   /* the slant would cut an outline outside it */
.btn.on { background: var(--blue); border-color: var(--blue); }
.btn.ghost { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .6); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: #C8102E; border-color: #C8102E; color: var(--white); }
.icon-btn { border-radius: 4px; }
.icon-btn.copy:hover { border-color: var(--cyan); color: var(--cyan); }

/* the cards */
details.sheet { border-radius: 6px; border-color: #33204F; box-shadow: 0 30px 50px -30px rgba(0, 0, 0, .75); }
details.sheet > summary { border-radius: 6px; }
details.sheet > summary::after { color: var(--yellow); }
.sheet-tag { border-color: rgba(255, 255, 255, .55); border-radius: 3px; font: 600 .72rem/1 var(--mono); }
.sheet-tag .num { background: var(--hot); color: var(--white); }
.sum-title { font: italic 800 1.38rem/1 var(--display); letter-spacing: .005em; }
.field > .top { font: 600 .72rem/1.3 var(--mono); }
.field > .top output { font: 600 .78rem var(--mono); color: var(--cyan); }
details.more { border-radius: 6px; }
details.more > summary { font: 600 .72rem/1.3 var(--mono); color: var(--cyan); }
.mat-grid h4 { font: 600 .66rem/1.3 var(--mono); color: var(--tb-label); }

/* fields sit a shade darker than their card, items a shade lighter */
select, input[type="text"], input[type="color"], .deg-box, .seg, .chips button, .pot.add .ball { background: var(--ink2); }
select, input[type="text"], input[type="color"] { border-radius: 6px; }
select option { background: var(--card); color: var(--white); }
.deg-box { border-radius: 4px; }
.seg { border-radius: 6px; }
.seg.wrap { border-radius: 8px; }
.seg button { border-radius: 4px; }
.seg button:hover { color: var(--white); }
.chips button { border-radius: 4px; font: 600 .74rem var(--mono); }
.pot.active, .tiles button, .light-item, .shot, .decal, .explore-btn, .add-lights button, .light-editor, .pot-editor { background: var(--card-2); }
.pot.active, .pot-editor, .light-editor, .light-item, .shot, .decal, .explore-btn, .add-lights button, .tiles button, .tile { border-radius: 6px; }
.pot.add .ball { color: var(--yellow); }
.tiles button .sw { width: 40px; height: 26px; border-radius: 4px; background: var(--g, linear-gradient(#eee, #999)); background-size: cover; background-position: center; }
.recipe-note, .role-note { background: rgba(230, 0, 126, .12); color: var(--body-dark); border-radius: 4px; }
.simple-note { border-left-color: var(--yellow); background: var(--card-2); }
.shape-icon { color: var(--cyan); }
.add-lights button:hover, .explore-btn:hover, .shot:hover { border-color: var(--cyan); }

/* the picture's stage */
.viewport { background: radial-gradient(70% 90% at 72% 35%, rgba(58, 13, 85, .95) 0%, transparent 70%), var(--blueprint), var(--ink); }
.viewport.has-model { background: #0D041D; }
.viewport.shaped.has-model { background: radial-gradient(ellipse at 60% 30%, rgba(58, 13, 85, .8), transparent 60%), var(--blueprint), var(--ink); }
.dark-seg { background: rgba(10, 3, 24, .86); border-radius: 6px; }
.dark-seg button { border-radius: 4px; font: 600 .74rem var(--mono); }
.dark-seg button.active { background: var(--cyan); color: var(--ink); }
.hint, .badge, .title-block, .gpu-problem { background: rgba(10, 3, 24, .9); border-radius: 6px; }
.badge { color: var(--yellow); font-family: var(--mono); font-weight: 600; }
.tb-cell span, .tb-cell b { font-family: var(--mono); }
.meter span, .bar span { background: var(--hot); }
.toast { border-radius: 6px; }
.busy { background: rgba(10, 3, 24, .78); }
.ring { border-color: var(--blue); }
.empty-title { font: italic 800 clamp(2rem, 4.2vw, 3.6rem)/.92 var(--display); letter-spacing: 0; text-transform: uppercase; }
.dropzone { border-radius: 6px; background: rgba(42, 12, 76, .55); }
.dropzone::before, .dropzone::after { border-color: var(--yellow); }
.dropzone:hover, .viewport.dragging .dropzone { border-color: var(--cyan); background: rgba(47, 214, 201, .08); }
.dropzone strong { font: italic 700 1.3rem/1.1 var(--display); }

/* start lights on the start screen: they come on one by one, then go out ("lights out and away we go") */
.start-lights { display: inline-flex; gap: 10px; padding: 9px 14px; margin-bottom: 4px; border-radius: 999px; background: #07020F; border: 1px solid #33204F; }
.start-lights i { width: 16px; height: 16px; border-radius: 50%; background: #2B1B3B; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .6); animation: start-light 5s infinite; }
.start-lights i:nth-child(2) { animation-delay: .5s; } .start-lights i:nth-child(3) { animation-delay: 1s; }
.start-lights i:nth-child(4) { animation-delay: 1.5s; } .start-lights i:nth-child(5) { animation-delay: 2s; }
@keyframes start-light {
  0%, 2% { background: #2B1B3B; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .6); }
  4%, 60% { background: #FF2A3A; box-shadow: 0 0 12px 2px rgba(255, 42, 58, .65); }
  62%, 100% { background: #2B1B3B; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .6); }
}

/* dialogs */
.it-dialog, .learn-dialog { border-color: #33204F; border-radius: 8px; }
.it-dialog code { background: rgba(255, 255, 255, .08); }
.it-facts { background: rgba(255, 255, 255, .05); }
.it-dialog::backdrop, .learn-dialog::backdrop { background: rgba(10, 3, 24, .8); }
.learn-head h2 { font: italic 800 1.6rem/1 var(--display); }

/* the words on the picture: the STEM Racing display type (js/app.js draws the same in the saved picture) */
.caption b { font-family: var(--display); font-style: italic; font-weight: 800; letter-spacing: .005em; }
.caption span { font-family: var(--sans); }
.caption.band { background: rgba(10, 3, 24, .78); }

@media (max-width: 1100px) { .brand img.dc-logo, .brand .brand-x { display: none; } }
@media (max-width: 520px) { .brand img.sr-logo { height: 28px; } .app-name { font-size: 1.2rem; } .dark-seg button { font-size: .64rem; padding: 0 7px; letter-spacing: .03em; } }
@media (orientation: landscape) and (max-height: 500px) { .brand img.sr-logo { height: 28px; } .app-name { font-size: 1.2rem; } .dark-seg button { font-size: .64rem; padding: 0 7px; letter-spacing: .03em; } }
/* the built-in STEM Racing logo stickers (Stickers card) */
.logo-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.logo-pick {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 6px; cursor: pointer;
  border: 1.5px solid var(--field); border-radius: 6px; background: var(--card-2); color: var(--text);
  font: italic 700 1rem/1 var(--display); text-align: center;
}
.logo-pick img { width: 100%; aspect-ratio: 1400 / 580; object-fit: contain; border-radius: 2px; display: block; }
.logo-pick:hover { border-color: var(--cyan); }
.logo-pick:disabled { opacity: .5; pointer-events: none; }
/* the STEM Racing model block's swatch: pale grey-green foam with fine cells */
.ball.block { background: radial-gradient(circle at 38% 32%, rgba(255, 255, 255, .35), transparent 50%), repeating-radial-gradient(circle at 30% 60%, rgba(70, 76, 66, .28) 0 .7px, transparent .7px 2.6px), radial-gradient(circle at 50% 50%, var(--c), color-mix(in srgb, var(--c), black 38%) 95%); }
/* the heading over the garage and track lighting */
.tiles .tiles-head { grid-column: 1 / -1; margin: 6px 0 0; font: 600 .68rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tb-label); }
/* white words on the primary buttons stay readable at the gradient's orange end */
.btn.primary, .btn.primary:hover { background: linear-gradient(100deg, #961B81 0%, #E6007E 52%, #C04F00 100%); }
/* material balls keep a light edge, so a black or very dark pot still shows on the purple cards */
.ball { box-shadow: 0 0 0 1px rgba(255, 255, 255, .18), 0 6px 10px -6px rgba(0, 0, 0, .7); }
.ball.acrylic, .ball.frosted, .ball.glass { border-color: rgba(255, 255, 255, .25); }
.meter, .bar { background: rgba(205, 198, 224, .18); }
.compare .tag { background: rgba(10, 3, 24, .82); }
/* the Shapes card: the STEM Racing parts above the simple shapes */
.palette-head { margin: 4px 0 -4px; font: 600 .68rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tb-label); }
.part-palette { grid-template-columns: repeat(3, 1fr); }
.part-palette .shape-icon { color: var(--yellow); }
#partOptions { gap: 10px; }/* a gate's lights: a round button each, glowing red when on */
.gate-lights-row { align-items: center; gap: 10px; }
.gate-lights { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.gate-light {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid #2a2a2e; background: radial-gradient(circle at 40% 35%, #5a1414, #2a0606 70%);
  transition: box-shadow .18s var(--ease), background .18s var(--ease);
}
.gate-light.on { background: radial-gradient(circle at 40% 35%, #ffd0c8, #ff3b30 45%, #c8101b 80%); box-shadow: 0 0 10px 2px rgba(255, 50, 40, .65); }
.gate-light:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
/* the start gate's screen: the heading, then a little table of names and times */
.screen-times { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.screen-grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px 8px; align-items: center; font-size: .8rem; }
.screen-grid b { font: 600 .68rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tb-label); }
.screen-grid input[type="text"] { height: 34px; width: 100%; font-family: var(--mono); }
#screenWords {
  width: 100%; margin-top: 8px; padding: 8px 10px; resize: vertical; font: inherit; color: inherit;
  border: 1.5px solid var(--field); border-radius: 6px; background: var(--ink2);
}
#screenWords:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(230, 0, 126, .15); }

/* ================================================================ new in 2.3.0 */
/* guidance: the progress strip at the top of the panel (one button per card, ticked when done) */
.step-strip {
  position: sticky; top: 0; z-index: 6; display: flex; flex-direction: column; gap: 7px;
  margin: -16px calc(clamp(14px, 1.4vw, 20px) * -1) 12px; padding: 10px clamp(14px, 1.4vw, 20px);
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.steps-row { display: flex; gap: 5px; }
.challenge-chip { border-radius: 4px !important;
  align-self: flex-start; max-width: 100%; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--blue); background: var(--card); color: var(--text);
  font: 600 .74rem/1.3 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.challenge-chip.all { background: #1a9b4b; border-color: #1a9b4b; color: var(--white); }
.step {
  flex: 1 1 0; min-width: 0; height: 30px; padding: 0; border-radius: 4px; cursor: pointer;
  border: 1.5px solid var(--field); background: var(--card); color: var(--text); font: 600 .74rem/1 var(--mono);
  transition: background-color .18s var(--ease), border-color .18s var(--ease);
}
.step.optional { border-style: dashed; }
.step:hover { border-color: var(--blue); }
.step.done { background: var(--blue); border-color: var(--blue); color: var(--white); }
.step.done .step-num { font-size: 0; }
.step.done .step-num::before { content: "✓"; font-size: .82rem; }
.step.current { box-shadow: 0 0 0 3px rgba(230, 0, 126, .4); border-color: var(--blue); }
/* a closed card says how far that part has got */
.sum-title { min-width: 0; }
.sum-state { display: block; font: 500 .74rem/1.35 var(--sans); color: var(--pencil); letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.sheet[open] .sum-state, .sum-state:empty { display: none; }
.btn.next-step { border-color: var(--yellow); color: var(--yellow); margin-top: 2px; }
.btn.next-step:hover { background: var(--yellow); color: var(--ink); }
/* ⓘ tips */
.tip {
  width: 18px; height: 18px; flex: none; padding: 0; margin: 0 auto 0 0; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  border: 1.5px solid var(--blue); background: var(--card); color: var(--text);
  font: italic 700 .7rem/1 Georgia, "Times New Roman", serif; text-transform: none; letter-spacing: 0;
}
label .tip, .muted .tip { margin: 0 0 0 4px; }
.tip:hover, .tip:focus-visible { background: var(--cyan); color: var(--ink); }
.tip-pop {
  position: fixed; z-index: 60; padding: 10px 13px; border-radius: 12px; background: var(--ink); color: var(--white); border: 1px solid var(--field);
  font: 400 .86rem/1.5 var(--sans); box-shadow: 0 18px 40px -16px rgba(10, 16, 32, .7); pointer-events: auto;
}
/* the check before saving */
.check-dialog { width: min(560px, calc(100% - 32px)); }
.check-list { margin: 0 0 14px; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; line-height: 1.5; }
.dialog-buttons { justify-content: flex-end; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
/* challenges (Start card) */
.brief { border: 1.5px dashed var(--blue); border-radius: 6px; padding: 10px 12px; background: rgba(230, 0, 126, .1); }
.brief p { margin: 0 0 8px; font-size: .84rem; line-height: 1.45; }
.targets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: .8rem; line-height: 1.35; }
.targets li { position: relative; padding-left: 24px; color: var(--pencil); }
.targets li::before { content: ""; position: absolute; left: 0; top: 1px; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--field); background: var(--card); }
.targets li.met { color: var(--text); }
.targets li.met::before { content: "✓"; border-color: #1a9b4b; background: #1a9b4b; color: #fff; font-size: .62rem; line-height: 15px; text-align: center; font-weight: 700; }
/* text stickers */
.text-sticker { display: flex; flex-direction: column; gap: 8px; }
.text-sticker input[type="text"], .text-sticker select { height: 38px; border: 1.5px solid var(--field); border-radius: 10px; padding: 0 10px; background: var(--ink2); color: var(--text); min-width: 0; }
.text-sticker input[type="color"] { width: 44px; height: 38px; padding: 2px; border: 1.5px solid var(--field); border-radius: 4px; background: var(--ink2); flex: none; }
/* show your work (Save card) and its dialogs */
.work-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.work-buttons .btn { white-space: normal; padding: 4px 8px; line-height: 1.15; }
.work-dialog { width: min(720px, calc(100% - 32px)); }
.work-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.work-grid label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .82rem; }
.work-grid label.check { flex-direction: row; font-weight: 500; }
.work-grid .wide { grid-column: 1 / -1; }
#videoCleanRow { margin-top: 14px; font-weight: 500; }   /* 1.4.0 */
.work-grid input[type="text"], .work-grid textarea { border: 1.5px solid var(--field); border-radius: 10px; padding: 8px 10px; background: var(--ink2); color: var(--text); font: 500 .9rem var(--sans); resize: vertical; }
.board-shots { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow-y: auto; }
@media (max-width: 520px) { .work-grid { grid-template-columns: 1fr; } .work-buttons { grid-template-columns: 1fr; } }
@media (max-width: 860px) and (orientation: portrait) {
  .step-strip { display: none; }   /* the cards are side by side and all open here */
}
@media (orientation: landscape) and (max-height: 500px) {
  .step-strip { top: 0; margin: -10px -10px 10px; padding: 8px 10px; gap: 3px; }
  .step { height: 26px; }
}

/* RenderClass F1: race livery stickers (Stickers card) */
.livery-colours { gap: 12px; }
.livery-colours label { display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; }
.livery-preview { width: 100%; height: auto; aspect-ratio: 2 / 1; border-radius: 4px; border: 1px solid var(--field);
  background: repeating-conic-gradient(#2a1846 0 25%, #1d0f36 0 50%) 0 0 / 20px 20px; }