@font-face {
  font-family:Atelier;
  src:local('Aptos'),local('Segoe UI')
}
* {
  box-sizing:border-box
}
html {
  font-size:16px
}
body {
  margin:0;
  background:#eaf0f5;
  color:#142d42;
  font-family:Atelier,'Segoe UI',Arial,sans-serif
}
button,input,select {
  font:inherit
}
button {
  cursor:pointer;
  background:#fff;
  border:1px solid #ccd7df;
  border-radius:7px;
  padding:9px 13px;
  color:#16344d;
  transition:background .15s,border-color .15s
}
button:hover {
  background:#edf3f8;
  border-color:#7895ab
}
button:focus-visible,input:focus-visible,select:focus-visible {
  outline:3px solid #287bbd;
  outline-offset:2px
}
button:disabled {
  opacity:.45;
  cursor:not-allowed
}
button.dark {
  background:#12344d;
  color:#fff;
  border-color:#12344d
}
button.dark:hover {
  background:#245375
}
button.primary {
  background:#ffca38;
  border-color:#edb72b;
  color:#152d40;
  font-weight:650
}
header {
  height:66px;
  display:flex;
  align-items:center;
  gap:28px;
  padding:0 26px;
  background:white;
  border-bottom:1px solid #d8e1e8;
  position:relative;
  z-index:5
}
.brand {
  display:flex;
  align-items:center;
  gap:11px;
  text-decoration:none;
  color:inherit;
  font-size:19px;
  letter-spacing:1px;
  white-space:nowrap
}
.brand b {
  font-weight:800
}
.brand small {
  display:block;
  font-size:10px;
  letter-spacing:1.25px;
  color:#6d8191;
  margin-top:5px
}
.brand-mark {
  background:#ffca38;
  font-size:35px;
  line-height:42px;
  width:42px;
  text-align:center;
  border-radius:6px;
  color:#102b43
}
nav {
  display:flex;
  gap:4px;
  background:#eef3f7;
  padding:4px;
  border-radius:9px
}
nav button {
  border:none;
  background:transparent;
  font-size:14px;
  white-space:nowrap
}
nav button.active {
  background:#fff;
  box-shadow:0 1px 5px #112c4216;
  font-weight:650
}
.header-actions {
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
  font-size:14px
}
.version {
  font-size:10px;
  letter-spacing:1.2px;
  color:#62798b;
  margin-right:6px
}
#piece-count {
  display:inline-block;
  margin-left:7px;
  background:#ffffff20;
  padding:0 5px;
  border-radius:4px
}
main {
  display:grid;
  grid-template-columns:minmax(0,1fr) 334px;
  height:calc(100dvh - 66px);
  min-height:560px
}
.workspace {
  position:relative;
  overflow:hidden;
  background:#eaf0f5
}
.scene-head {
  position:absolute;
  top:27px;
  left:30px;
  right:24px;
  z-index:2;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:15px;
  pointer-events:none
}
.scene-head button {
  pointer-events:auto;
  background:#ffffffda;
  font-size:14px
}
.eyebrow {
  font-size:11px;
  letter-spacing:1.8px;
  font-weight:700;
  color:#697f90
}
h1 {
  font-size:28px;
  letter-spacing:-.9px;
  margin:7px 0 5px;
  font-weight:650
}
.scene-head p {
  margin:0;
  color:#657c8f;
  font-size:14px
}
#viewport {
  position:absolute;
  inset:0
}
#viewport canvas {
  width:100%;
  height:100%;
  display:block;
  touch-action:none
}
.box-selection-window{position:absolute;z-index:35;pointer-events:none;border:2px solid #2186d4;background:#2186d426;box-shadow:0 0 0 1px #fff8 inset}
.box-selection-window.crossing{border-color:#d94b42;background:#d94b4226}
.block-selection-card{position:absolute;z-index:34;left:74px;bottom:18px;display:grid;gap:4px;max-width:390px;padding:12px 14px;border:1px solid #b9cbd8;border-radius:10px;background:#fffffff2;box-shadow:0 8px 24px #173b5324;color:#173b53}
.block-selection-card small{color:#60798b}.block-selection-card div{display:flex;gap:8px;margin-top:4px}.block-selection-card button{padding:7px 10px}
#block-select[aria-pressed="true"]{background:#287bbd;color:#fff;border-color:#1f679e;box-shadow:0 0 0 3px #287bbd2b}
#block-select svg{width:27px;height:21px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-dasharray:3 2;stroke-linecap:round}
@media(max-width:800px){.block-selection-card{left:12px;right:12px;bottom:12px;max-width:none}.block-selection-card div{display:grid;grid-template-columns:1fr 1fr}}
.view-tools {
  position:absolute;
  top:150px;
  left:24px;
  display:flex;
  flex-direction:column;
  gap:5px;
  z-index:2
}
.view-tools button {
  width:47px;
  height:40px;
  padding:5px;
  background:#ffffffed;
  font-size:14px
}
.view-tools span {
  height:5px
}
.project-badge {
  position:absolute;
  right:24px;
  bottom:150px;
  background:#ffffffea;
  border:1px solid #d5e0e7;
  padding:14px 17px;
  border-radius:9px;
  display:flex;
  flex-direction:column;
  gap:5px;
  font-size:13px;
  box-shadow:0 3px 18px #12344d08
}
.project-badge strong {
  font-size:20px
}
.project-badge span {
  color:#6b7f8e
}
.project-badge button {
  font-size:12px;
  padding:5px 0;
  border:0;
  background:transparent;
  text-decoration:underline;
  text-align:left
}
.guide {
  position:absolute;
  bottom:47px;
  left:24px;
  right:24px;
  max-width:770px;
  display:flex;
  align-items:center;
  gap:14px;
  padding:17px 18px;
  background:#fff;
  border:1px solid #d3dfe8;
  border-radius:9px;
  box-shadow:0 8px 25px #183e5410
}
.guide-number {
  display:grid;
  place-items:center;
  background:#fff4ce;
  border-radius:7px;
  width:38px;
  height:42px;
  color:#8f6416;
  font-size:19px;
  flex-shrink:0
}
.guide strong {
  font-size:15px
}
.guide p {
  font-size:13px;
  color:#627789;
  margin:5px 0 0;
  line-height:1.5
}
.guide button {
  margin-left:auto;
  border-radius:50%;
  width:30px;
  height:30px;
  padding:0;
  flex-shrink:0
}
.scene-footer {
  position:absolute;
  bottom:13px;
  left:26px;
  right:25px;
  display:flex;
  justify-content:space-between;
  gap:20px;
  font-size:11px;
  color:#718596
}
.catalogue {
  background:#fff;
  border-left:1px solid #d7e1e9;
  display:flex;
  flex-direction:column;
  min-height:0;
  z-index:3
}
.catalogue-title {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:26px 22px 17px
}
.catalogue h2 {
  font-size:21px;
  margin:6px 0 0;
  letter-spacing:-.5px
}
.info-button {
  border-radius:50%;
  width:27px;
  height:27px;
  padding:0;
  font-family:serif
}
.search {
  display:flex;
  gap:8px;
  margin:0 18px 14px;
  border:1px solid #d7e0e7;
  padding:9px 12px;
  border-radius:7px;
  background:#f7f9fb
}
.search span {
  font-size:22px;
  line-height:20px;
  color:#748b9e
}
.search input {
  width:100%;
  min-width:0;
  background:none;
  border:0;
  outline:none;
  font-size:14px;
  color:#18394f
}
.categories {
  display:flex;
  gap:5px;
  flex-wrap:wrap;
  padding:0 18px 15px
}
.categories button {
  font-size:12px;
  padding:6px 9px;
  border-color:#e0e7ed;
  background:#f9fbfc
}
.categories button.active {
  color:#fff;
  background:#183b56;
  border-color:#183b56
}
.level-control {
  border-top:1px solid #e3eaf0;
  border-bottom:1px solid #e3eaf0;
  padding:10px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:13px;
  color:#657b8b
}
.level-control select {
  max-width:150px;
  border:0;
  color:#173b58;
  font-size:13px;
  background:transparent
}
.catalogue-items {
  flex:1;
  overflow:auto;
  padding:10px 12px
}
.part-card {
  display:flex;
  align-items:center;
  position:relative;
  gap:10px;
  width:100%;
  min-height:78px;
  margin:4px 0;
  border:1px solid transparent;
  text-align:left;
  padding:9px;
  background:#fff;
  border-radius:8px
}
.part-card:hover {
  background:#f4f7fa;
  border-color:#d6e1e9
}
.part-card.selected {
  border-color:#dab642;
  background:#fff9e8
}
.part-card.group-start {
  margin-top:17px
}
.part-card.group-start::before {
  content:'';
  position:absolute;
  left:8px;
  right:8px;
  top:-10px;
  height:1px;
  background:#c9d6df;
  pointer-events:none
}
 .part-card canvas, .part-card .part-thumbnail {
  width:58px;
  height:52px;
  flex-shrink:0;
  border-radius:5px;
    background:#edf2f6
  }
  .part-card .part-thumbnail {object-fit:contain;box-sizing:border-box;padding:3px}
.part-copy {
  flex:1;
  min-width:0
}
.part-copy strong {
  display:block;
  font-size:14px;
  font-weight:650
}
.part-copy small {
  display:block;
  color:#647a8c;
  margin-top:5px;
  font-size:11px;
  line-height:1.45
}
.part-card .quantity {
  font-size:11px;
  align-self:flex-start;
  background:#e7eef3;
  border-radius:4px;
  padding:2px 5px
}
.part-card .help-part {
  position:absolute;
  right:6px;
  bottom:7px;
  width:22px;
  height:22px;
  border:1px solid #cbd7df;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-size:12px;
  background:#fff
}
.selection {
  padding:13px 20px;
  border-top:1px solid #e1e8ee;
  background:#f7f9fb;
  font-size:13px
}
.selection p {
  margin:0 0 8px;
  line-height:1.5
}
.selection-actions {
  display:flex;
  gap:6px;
  flex-wrap:wrap
}
.selection button {
  padding:6px 9px;
  font-size:12px
}
.catalogue-foot {
  padding:12px 20px;
  font-size:11px;
  color:#768999;
  line-height:1.6;
  border-top:1px solid #e1e8ee
}
.catalogue-foot button {
  font-size:11px;
  padding:0;
  border:0;
  background:none;
  text-decoration:underline;
  color:#657d90
}
#toast {
  position:fixed;
  bottom:145px;
  left:50%;
  transform:translateX(-50%);
  z-index:30;
  background:#163950;
  color:white;
  box-shadow:0 8px 28px #16395030;
  border-radius:8px;
  padding:14px 19px;
  max-width:550px;
  font-size:14px;
  line-height:1.5
}
#toast.error {
  background:#843d2e
}
dialog {
  border:1px solid #ccd9e3;
  border-radius:14px;
  padding:26px;
  width:min(660px,calc(100vw - 24px));
  max-height:85dvh;
  overflow:auto;
  box-shadow:0 25px 100px #122e4630;
  color:#17364d
}
dialog::backdrop {
  background:#0c263e66;
  backdrop-filter:blur(3px)
}
.dialog-head {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:15px;
  margin-bottom:20px
}
.dialog-head h2 {
  font-size:25px;
  margin:7px 0 0;
  letter-spacing:-.6px
}
.close {
  border:0;
  background:#eff4f8;
  font-size:25px;
  width:35px;
  height:35px;
  padding:0
}
.form-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  margin:23px 0
}
.form-grid label {
  font-size:13px;
  font-weight:600;
  display:flex;
  flex-direction:column;
  gap:7px
}
.form-grid input,.form-grid select,.calc-input {
  border:1px solid #bdcdda;
  border-radius:6px;
  padding:10px;
  background:white;
  color:#17364d;
  min-width:0;
  width:100%
}
.check-label {
  display:flex;
  gap:10px;
  font-size:14px;
  line-height:1.5
}
.note,.source {
  font-size:12px;
  color:#6a7e8d;
  line-height:1.6
}
.dialog-actions {
  display:flex;
  justify-content:flex-end;
  gap:9px;
  margin-top:22px
}
dialog p {
  line-height:1.65;
  font-size:15px
}
dialog h3 {
  font-size:16px;
  margin-top:24px
}
dialog table {
  width:100%;
  border-collapse:collapse;
  font-size:13px
}
dialog td,dialog th {
  border-bottom:1px solid #dee6ed;
  padding:10px 7px;
  text-align:left
}
dialog th {
  background:#f0f5f8;
  font-size:12px
}
.formula {
  padding:19px;
  background:#eff5f9;
  border-left:3px solid #e8b523;
  font-size:21px;
  letter-spacing:.3px;
  margin:15px 0
}
.check-row {
  padding:14px 0;
  border-bottom:1px solid #dce5ec;
  display:flex;
  gap:12px;
  line-height:1.5;
  font-size:14px
}
.check-row .symbol {
  font-weight:bold;
  color:#a46d15
}
.check-row small {
  display:block;
  color:#6c8091
}
.check-row.ok .symbol {
  color:#397859
}
.question {
  background:#f3f7fa;
  border-radius:8px;
  padding:17px;
  margin-top:18px
}
.question button {
  display:block;
  width:100%;
  text-align:left;
  margin:8px 0
}
.position-list {
  max-height:350px;
  overflow:auto
}
.position-list button {
  display:block;
  width:100%;
  text-align:left;
  margin-bottom:7px;
  font-size:13px
}
.position-list small {
  display:block;
  color:#6b7e8c;
  margin-top:4px
}
.chip {
  display:inline-block;
  padding:4px 8px;
  background:#edf3f8;
  border-radius:4px;
  font-size:12px;
  margin-right:5px
}
.callout {
  border-left:3px solid #e8b523;
  padding:10px 15px;
  background:#fff9e6;
  font-size:14px;
  line-height:1.6
}
.empty {
  padding:20px;
  color:#71899c;
  font-size:14px
}
.success {
  color:#276c4a
}
#webgl-error {
  position:absolute;
  top:45%;
  left:12%;
  right:12%;
  background:#fff;
  padding:20px;
  z-index:4
}
.quiz-stat {
  display:flex;
  gap:18px;
  margin:14px 0
}
.quiz-stat div {
  background:#eff4f8;
  flex:1;
  padding:15px;
  border-radius:8px
}
.quiz-stat strong {
  font-size:24px;
  display:block
}
.quiz-stat small {
  font-size:12px
}
.panel-toolbar {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:15px 0
}
@media(max-width:1150px) {
  header {
    gap:14px;
    padding:0 18px
  }
  .version {
    display:none
  }
  .brand small {
    font-size:9px
  }
  .header-actions button {
    font-size:12px;
    padding:9px
  }
  main {
    grid-template-columns:minmax(0,1fr) 300px
  }
  .scene-head {
    left:22px
  }
  h1 {
    font-size:23px
  }
  .scene-footer span:last-child {
    display:none
  }
  .guide {
    right:15px;
    left:15px
  }
  .scene-head button {
    font-size:12px
  }
}
@media(max-width:800px) {
  header {
    height:auto;
    min-height:110px;
    flex-wrap:wrap;
    padding:12px;
    gap:10px
  }
  .brand {
    font-size:16px
  }
  .brand small {
    display:none
  }
  .brand-mark {
    width:32px;
    line-height:32px;
    font-size:28px
  }
  .header-actions {
    gap:5px
  }
  .header-actions #save,.header-actions #load {
    padding:7px;
    font-size:11px
  }
  nav {
    order:3;
    width:100%;
    justify-content:center
  }
  .header-actions #bom {
    font-size:11px
  }
  main {
    height:auto;
    min-height:0;
    display:flex;
    flex-direction:column
  }
  .workspace {
    height:65dvh;
    min-height:430px
  }
  .scene-head {
    top:20px;
    left:18px
  }
  .scene-head h1 {
    font-size:20px
  }
  .scene-head p {
    font-size:12px
  }
  .view-tools {
    left:15px;
    top:125px;
    gap:3px
  }
  .view-tools button {
    width:38px;
    height:32px;
    font-size:12px
  }
  .project-badge {
    bottom:132px;
    right:13px;
    padding:10px;
    font-size:11px
  }
  .project-badge strong {
    font-size:16px
  }
  .guide {
    bottom:35px;
    padding:12px
  }
  .guide p {
    font-size:11px
  }
  .guide strong {
    font-size:13px
  }
  .guide-number {
    width:29px;
    height:34px;
    font-size:15px
  }
  .scene-footer {
    bottom:10px;
    left:16px;
    font-size:9px
  }
  .catalogue {
    border-top:1px solid #ccd8e1
  }
  .catalogue-title {
    padding:17px 20px
  }
  .catalogue-items {
    display:grid;
    grid-template-columns:1fr 1fr;
    max-height:350px
  }
  .part-card canvas, .part-card .part-thumbnail {
    width:45px;
    height:45px
  }
  .part-card {
    min-height:90px;
    padding:6px;
    gap:6px
  }
  .part-copy strong {
    font-size:12px
  }
  .form-grid {
    gap:12px
  }
  .part-copy small {
    font-size:10px
  }
}
@media(prefers-reduced-motion:reduce) {
  * {
    transition:none!important
  }
}
[hidden] {
  display:none!important
}
#eraser[aria-pressed="true"] {
  background:#843d2e;
  color:white;
  border-color:#843d2e
}
#eraser {
  font-size:24px
}
#eraser {
  display:grid;
  place-items:center;
  padding:5px
}
#eraser[aria-pressed="true"] {
  background:#deedfc;
  border-color:#398cd1;
  box-shadow:0 0 0 2px #398cd133
}
nav button[disabled] {
  opacity:.5;
  cursor:not-allowed
}
.level-control {
  border-top:1px solid #d6e2eb;
  border-bottom:1px solid #d6e2eb;
  padding:13px 18px;
  gap:12px;
  font-size:14px;
  background:#f8fbfd
}
.level-control label {
  font-weight:700
}
.level-control select {
  max-width:175px;
  border:1px solid #bfd0dc;
  border-radius:7px;
  color:#12344d;
  background:#fff;
  padding:8px 9px;
  font-size:14px;
  font-weight:700
}
.selection button.add-all {
  background:#2f8d4f;
  border-color:#2f8d4f;
  color:#fff;
  font-weight:850;
  font-size:15px;
  min-width:36px
}
.pdf-excerpt {
  margin:14px 0;
  padding:12px 14px;
  border-left:3px solid #287bbd;
  background:#eef6fc;
  color:#244459;
  font-size:13px;
  line-height:1.6
}
.pdf-excerpt strong {
  display:block;
  margin-bottom:4px;
  color:#15344c
}
.tutorial-cards {
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  list-style:none;
  padding:0;
  margin:16px 0
}
.tutorial-cards li {
  display:flex;
  align-items:flex-start;
  gap:12px;
  background:#f2f7fa;
  border:1px solid #d9e5ee;
  border-radius:8px;
  padding:10px 12px
}
.tutorial-cards strong {
  display:block;
  font-size:14px;
  margin-bottom:3px
}
.tutorial-cards li div > span {
  font-size:13px;
  line-height:1.45;
  display:block
}
.tutorial-step-number {
  display:grid;
  place-items:center;
  flex:0 0 30px;
  height:30px;
  border-radius:50%;
  background:#ffdf68;
  color:#17364d;
  font-weight:750
}
#panel:has(.tutorial-intro) .dialog-actions {
  position:sticky;
  bottom:-26px;
  background:#fff;
  padding:12px 0;
  margin-top:0;
  border-top:1px solid #e1e8ee
}
.tutorial-bubble {
  position:absolute;
  left:24px;
  top:235px;
  z-index:3;
  background:#fff;
  border:2px solid #ffca38;
  border-radius:9px;
  box-shadow:0 8px 25px #183e5418;
  max-width:320px;
  padding:15px 16px;
  font-size:14px;
  line-height:1.5
}
.tutorial-bubble strong {
  display:block;
  margin-bottom:5px
}
.tutorial-bubble button {
  margin-top:10px;
  background:#12344d;
  color:#fff;
  border-color:#12344d;
  font-weight:700
}
@media(max-width:800px) {
  .tutorial-cards {
    grid-template-columns:1fr
  }
  .tutorial-bubble {
    top:175px;
    left:15px;
    right:15px;
    max-width:none
  }
}
.catalogue .tutorial-bubble {
  position:relative;
  inset:auto;
  flex-shrink:0;
  max-width:none;
  margin:10px 14px;
  padding:12px 14px;
  box-shadow:none
}
.tutorial-bubble small {
  display:block;
  color:#7b6100;
  font-weight:700;
  margin-bottom:5px
}
.tutorial-bubble p {
  margin:0
}
@keyframes tutorial-pulse {
  0%,100% {
    background:#fff6bf;
    box-shadow:inset 0 0 0 3px #f2bb00
  }
  50% {
    background:#ffdf38;
    box-shadow:inset 0 0 0 3px #ee7800,0 0 14px #ffc400aa
  }
}
.catalogue .tutorial-highlight, .notice-shortcuts .tutorial-highlight {
  animation:tutorial-pulse 1.3s ease-in-out infinite;
  border-color:#ee9800;
  color:#163950
}
@media(prefers-reduced-motion:reduce) {
  .catalogue .tutorial-highlight, .notice-shortcuts .tutorial-highlight {
    animation:none;
    background:#ffdf38;
    box-shadow:inset 0 0 0 3px #ee7800
  }
}
.project-badge[hidden] {
  display:none!important
}
#fit {
  display:none!important
}
#configure[hidden] {
  display:none!important
}
.level-legend {
  position:absolute;
  right:18px;
  top:112px;
  z-index:2;
  padding:10px 12px;
  background:#ffffffed;
  border:1px solid #c9d9e6;
  border-radius:8px;
  font-size:12px;
  pointer-events:none
}
.level-legend strong {
  display:block;
  margin-bottom:6px
}
.level-legend span {
  display:block;
  padding:3px 6px;
  color:#60798d
}
.level-legend .active {
  background:#ffdf68;
  color:#163950;
  border-radius:4px;
  font-weight:700
}
@media(max-width:800px) {
  .level-legend {
    top:168px;
    right:12px;
    font-size:11px
  }
}
.part-card {
  position:relative
}
.part-card:has(.card-add-all) {
  padding-right:44px
}
.card-add-all {
  position:absolute;
  right:9px;
  bottom:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  width:29px;
  height:29px;
  background:#2e914e;
  color:white;
  border-radius:6px;
  font-size:23px;
  font-weight:800;
  line-height:1;
  cursor:pointer
}
.card-add-all:hover {
  background:#1c743a
}
.card-add-all:focus-visible {
  outline:3px solid #287bbd;
  outline-offset:2px
}
#selection {
  display:none!important
}
#guide,.level-control {
  display:none!important
}
.level-legend {
  left:88px;
  right:auto;
  top:150px;
  pointer-events:auto
}
.level-legend button {
  display:block;
  width:100%;
  text-align:left;
  border:0;
  background:transparent;
  padding:5px 7px;
  font-size:12px
}
.level-legend button.active {
  background:#ffdf68
}
.object-tooltip {
  position:absolute;
  z-index:6;
  max-width:275px;
  padding:11px 13px;
  background:#ffffffef;
  border:1px solid #bdd0df;
  border-radius:8px;
  box-shadow:0 5px 18px #173a5526;
  pointer-events:none;
  font-size:12px;
  line-height:1.4
}
.object-tooltip strong,.object-tooltip span {
  display:block
}
.object-tooltip span {
  color:#60798d;
  margin-top:3px
}
.object-tooltip p {
  margin:6px 0 0
}
@media(max-width:800px) {
  .level-legend {
    left:60px;
    right:auto;
    top:125px
  }
}
.part-card:has(.card-add-all) {
  display:grid;
  grid-template-columns:58px minmax(0,1fr) 29px 18px;
  grid-template-rows:auto auto;
  gap:4px 10px;
  padding:9px;
  align-items:center
}
 .part-card:has(.card-add-all) canvas, .part-card:has(.card-add-all) .part-thumbnail {
  grid-column:1;
  grid-row:1/3
}
.part-card:has(.card-add-all) .part-copy {
  display:contents
}
.part-card:has(.card-add-all) .part-copy strong {
  grid-column:2/4;
  grid-row:1
}
.part-card:has(.card-add-all) .part-copy small {
  grid-column:2;
  grid-row:2;
  margin-top:0
}
.part-card:has(.card-add-all) .quantity {
  grid-column:4;
  grid-row:1;
  justify-self:end;
  align-self:start
}
.part-card .card-add-all {
  position:static;
  grid-column:3;
  grid-row:2;
  align-self:center;
  justify-self:start
}
@media(max-width:800px) {
  .catalogue-items {
    grid-template-columns:1fr
  }
  .part-card:has(.card-add-all) {
    grid-template-columns:45px minmax(0,1fr) 44px 18px;
    gap:4px 8px
  }
  #selection:not([hidden]) {
    display:block!important
  }
  .part-card .card-add-all, .selection button, .categories button,
  .notice-shortcuts button, .view-tools button, .level-legend button {
    min-height:44px
  }
  .part-card .card-add-all {
    width:44px;
    height:44px
  }
  dialog {
    padding:18px;
    max-height:92dvh
  }
  #panel:has(.tutorial-intro) .dialog-actions {
    bottom:-18px
  }
  #start-tutorial {
    width:100%;
    min-height:44px
  }
}
.part-card .card-add-all {
  position:relative;
  font-size:0
}
.card-add-all::before,.card-add-all::after {
  content:'';
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  background:#fff;
  border-radius:1px
}
.card-add-all::before {
  width:12px;
  height:3px
}
.card-add-all::after {
  width:3px;
  height:12px
}

/* Rubriques en onglets : l'onglet sélectionné recouvre ses voisins. */
.stack-tabs{display:flex;flex-wrap:wrap;align-items:flex-end;gap:0;isolation:isolate;border-bottom:2px solid #173B53;padding-top:6px;margin-bottom:12px}
.stack-tabs>button{position:relative;z-index:1;min-height:40px;margin:0 -5px -2px 0;border:1px solid #A9BDCD;border-bottom:2px solid #173B53;border-radius:12px 12px 0 0;background:linear-gradient(#F4F8FC,#DFE8F1);color:#244B67;padding:10px 13px;box-shadow:2px -2px 5px #173b5314;transform:translateY(2px);font-weight:650}
.stack-tabs>button:hover{background:#E8F2FB;z-index:2}
.stack-tabs>button.active{z-index:3;transform:translateY(0);background:#173B53;border-color:#173B53;color:#fff;box-shadow:0 -3px 10px #173b5333;padding-top:13px}
.stack-tabs>button:focus-visible{outline:3px solid #E0A728;outline-offset:2px;z-index:4}
.header-actions .analysis-tabs{position:absolute;right:18px;bottom:-2px;display:flex;align-items:flex-end;justify-content:flex-end;margin:0;padding:0;border-bottom:2px solid #173B53}
.header-actions .analysis-tabs button{font-size:.76rem;white-space:nowrap}
#categories.stack-tabs{justify-content:flex-start;gap:0}
.mesh-catalogue{padding:14px;border:1px solid #C9D8E3;border-radius:0 0 12px 12px;background:#F7FAFC;display:grid;gap:12px}
.mesh-catalogue p{font-size:.8rem;line-height:1.5;color:#496579}
.mesh-facade{padding:12px;margin:14px 0;background:#F4F8FC;border:1px solid #CCDCE8;border-radius:12px}
.mesh-modules{display:flex;flex-wrap:wrap;gap:9px}.mesh-module{padding:8px;background:#fff;border:1px dashed #688BA4;border-radius:9px}
.mesh-module label{display:grid;gap:4px;font-size:.75rem}.mesh-module select{max-width:110px}.mesh-module button{padding:3px 8px;min-height:30px}.mesh-module>div{display:flex;gap:2px;margin-top:5px}
.mesh-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}.mesh-preview svg{display:block;width:100%;max-height:240px;background:#F9FBFC;border:1px solid #DAE5ED;border-radius:10px}.mesh-preview p{font-size:.78rem}
@media(max-width:800px){.header-actions .analysis-tabs{justify-content:flex-start}.stack-tabs>button{min-height:44px}.mesh-module select{min-height:44px}}

/* Une seule rangée, reliée au cadre du contenu. */
.stack-tabs{flex-wrap:nowrap;min-width:0}
.stack-tabs>button{min-width:0}
#categories.stack-tabs{margin:0 8px;padding:6px 0 0;flex:0 0 auto;border-bottom:3px solid #173B53;align-items:flex-end;overflow:visible}
#categories.stack-tabs>button{flex:1 1 auto;font-size:10.5px;line-height:1.2;padding:10px 5px;margin:0 -3px -3px 0;white-space:nowrap;border-bottom:3px solid #173B53;border-radius:10px 10px 0 0;min-height:40px;transform:none}
#categories.stack-tabs>button:last-child{margin-right:0}
#categories.stack-tabs>button.active{padding-top:13px;background:#173B53;border-bottom-color:#173B53;box-shadow:0 -3px 8px #173b5333}
#catalogue-items{margin:0 8px 10px;border:3px solid #173B53;border-top:0;border-radius:0 0 12px 12px;background:#fff;padding:8px;min-height:0}
#catalogue-items .mesh-catalogue{border:0;border-radius:0;padding:8px;background:#fff}
.header-actions .analysis-tabs{flex-wrap:nowrap;min-width:0}
.header-actions .analysis-tabs>button{display:flex;align-items:center;justify-content:center;flex:0 1 auto;min-width:0;height:40px;min-height:40px;margin:0 -4px -2px 0;padding:0 13px;transform:none;white-space:nowrap;text-align:center;border-bottom-width:2px}
.header-actions .analysis-tabs>button.active{height:40px;min-height:40px;margin-top:0;padding:0 13px;transform:none}
.header-actions .analysis-tabs>button:last-child{margin-right:0}
@media(max-width:800px){#categories.stack-tabs>button{min-height:44px}.header-actions .analysis-tabs{left:12px;right:12px}.header-actions .analysis-tabs>button{flex:1 1 0;font-size:11px;padding:0 6px}}

#designer-code-form{display:grid;gap:10px;margin-top:16px}
#designer-code-form label{font-weight:700;color:#17364d}
#designer-code{width:100%;max-width:220px;padding:10px 12px;border:1px solid #a9bdcd;border-radius:7px;font:inherit;letter-spacing:.12em}
#designer-code:focus-visible{outline:3px solid #e0a728;outline-offset:2px}
#designer-code-error{color:#a22a2a;margin:0}

.mesh-editor-card{position:absolute;z-index:22;left:24px;right:24px;bottom:24px;display:flex;align-items:center;justify-content:space-between;gap:18px;padding:12px 14px;background:#fffffff2;border:2px solid #173b53;border-radius:10px;box-shadow:0 10px 30px #173b5330;backdrop-filter:blur(5px)}
.mesh-editor-card>div:first-child{display:grid;gap:3px}.mesh-editor-card strong{font-size:15px}.mesh-editor-card span,.mesh-editor-card small{font-size:12px;color:#526d80}.mesh-editor-card small.error{color:#b23126;font-weight:700}.mesh-editor-actions{display:flex;gap:7px;flex-shrink:0}
.mesh-cursor-action{position:absolute;z-index:25;pointer-events:none;display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#187b4a;color:#fff;border:2px solid #fff;box-shadow:0 2px 7px #173b5355;font-size:20px;font-weight:800;line-height:1}.mesh-cursor-action.remove{background:#b43a2b}.mesh-cursor-action[hidden]{display:none}
@media(max-width:800px){.mesh-editor-card{left:12px;right:12px;bottom:12px;display:grid}.mesh-editor-actions{display:grid;grid-template-columns:1fr 1fr}.mesh-editor-actions [data-mesh-apply]{grid-column:1/3}.header-actions .analysis-tabs>button{font-size:10px;padding:0 5px}}

/* Implantation utilise le même panneau fixe que les autres onglets. */
.mesh-editor-card{position:fixed;top:var(--header-height,66px);left:12px;right:auto;bottom:12px;z-index:25;display:block;width:min(660px,calc(100vw - 24px));max-height:calc(100dvh - var(--header-height,66px) - 12px);overflow:auto;padding:24px;background:#fff;border:1px solid #d4dfe7;border-top:0;border-radius:0 0 12px 12px;box-shadow:0 18px 48px #173b5324;backdrop-filter:none}
.mesh-editor-head{display:flex!important;align-items:flex-start;justify-content:space-between;gap:16px;margin:0 0 16px;padding:0 0 16px;border-bottom:1px solid #e1e8ed}
.mesh-editor-head>div{display:grid;gap:7px}
.mesh-editor-card .mesh-editor-head strong{font-size:23px;letter-spacing:-.45px}
.mesh-editor-head .close{flex:0 0 auto}
.mesh-editor-intro{margin:0 0 12px;color:#526d80;font-size:13px;line-height:1.55}
.mesh-editor-card>[data-mesh-status]{display:block;min-height:19px;margin:0 0 18px;font-size:12px;color:#526d80}
.mesh-editor-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}
@media(max-width:800px){.mesh-editor-card{top:var(--header-height,110px);left:12px!important;right:12px;bottom:12px;width:auto;max-height:calc(100dvh - var(--header-height,110px) - 12px);padding:18px}.mesh-editor-actions{display:grid;grid-template-columns:1fr 1fr}.mesh-editor-actions [data-mesh-apply]{grid-column:1/3}}

/* La scène reste dégagée : les commandes occupent l'espace libéré en haut. */
.scene-head>div{display:none}
.project-title-field{display:grid;gap:1px;width:min(390px,calc(100vw - 400px));pointer-events:auto}
.project-title-field[hidden]{display:none}
.project-title-field span{font-size:10px;letter-spacing:1.55px;font-weight:700;color:#667f91}
.project-title-field input{width:50%;min-width:190px;padding:1px 2px 5px;border:0;border-bottom:1px solid #91a8b8;border-radius:0;background:transparent;color:#142d42;font-size:21px;font-weight:650;line-height:1.18;letter-spacing:-.35px;box-shadow:none}
.project-title-field input:hover{border-bottom-color:#486d86}
.project-title-field input:focus{border-bottom-color:#287bbd;background:#ffffffa8;outline:0}
.view-tools{top:24px}
.level-legend{top:24px}
.designer-layout .view-tools{top:82px}
.designer-layout .level-legend{top:82px}
@media(max-width:800px){.project-title-field{width:min(270px,calc(100vw - 90px))}.project-title-field input{min-width:0;font-size:18px}.view-tools{top:16px}.level-legend{top:16px}.designer-layout .view-tools{top:72px}.designer-layout .level-legend{top:72px}}

/* Navigation à onglets : hiérarchie légère et continuité avec le panneau. */
.stack-tabs{display:flex;flex-wrap:nowrap;align-items:flex-end;gap:4px;min-width:0;isolation:isolate;margin:0;padding:0;border-bottom:1px solid #c9d6df}
.stack-tabs>button{position:relative;z-index:1;display:flex;align-items:center;justify-content:center;min-width:0;min-height:40px;margin:0 0 -1px;padding:0 14px;border:1px solid transparent;border-bottom-color:#c9d6df;border-radius:8px 8px 0 0;background:transparent;color:#587184;box-shadow:none;transform:none;font-weight:600;line-height:1.15}
.stack-tabs>button:hover{z-index:2;background:#f3f7fa;color:#173b53;border-color:#d8e2e9;border-bottom-color:#c9d6df}
.stack-tabs>button.active{z-index:3;margin-bottom:-1px;padding:0 14px;background:#fff;color:#153a54;border-color:#c9d6df;border-bottom-color:#fff;box-shadow:0 -4px 12px #173b530b;font-weight:700;transform:none}
.stack-tabs>button.active::before{content:'';position:absolute;left:12px;right:12px;bottom:5px;height:2px;border-radius:2px;background:#e0a728}
.stack-tabs>button:focus-visible{outline:3px solid #287bbd;outline-offset:2px;z-index:4}
.stack-tabs>button:disabled{background:transparent;color:#9aabb7}
.header-actions .analysis-tabs{position:absolute;right:18px;bottom:-1px;display:flex;align-items:flex-end;justify-content:flex-end;min-width:0;margin:0;padding:0;border-bottom:1px solid #c9d6df}
.header-actions .analysis-tabs>button{flex:0 1 auto;height:40px;min-height:40px;margin:0 0 -1px;padding:0 14px;font-size:.76rem;white-space:nowrap;text-align:center;border-bottom-width:1px}
.header-actions .analysis-tabs>button.active{height:40px;min-height:40px;margin-bottom:-1px;padding:0 14px}
#categories.stack-tabs{justify-content:flex-start;margin:5px 18px 0;padding:0;flex:0 0 auto;overflow:visible;border-bottom:1px solid #c9d6df}
#categories.stack-tabs>button{flex:1 1 0;min-height:39px;margin:0 0 -1px;padding:0 5px;font-size:10.5px;white-space:nowrap;border-bottom-width:1px}
#categories.stack-tabs>button.active{margin-bottom:-1px;padding:0 5px;background:#fff;color:#153a54;border-color:#c9d6df;border-bottom-color:#fff;box-shadow:0 -4px 12px #173b530b}
#categories.stack-tabs>button.active::before{left:9px;right:9px}
#catalogue-items{margin:0 18px 12px;border:1px solid #d4dfe7;border-top:0;border-radius:0 0 10px 10px;background:#fff;padding:8px;min-height:0;box-shadow:0 8px 22px #173b530a}
#catalogue-items .mesh-catalogue{border:0;border-radius:0;padding:8px;background:#fff}
@media(max-width:800px){#categories.stack-tabs>button{min-height:44px}.header-actions .analysis-tabs{left:12px;right:12px}.header-actions .analysis-tabs>button{flex:1 1 0;font-size:10px;padding:0 5px}}

/* Les contenus des onglets d'analyse partagent un panneau fixe sous l'en-tête. */
dialog.analysis-panel,#panel.review-panel.analysis-panel,.load-panel.analysis-panel{position:fixed;inset:var(--header-height,66px) auto 12px 12px;margin:0;width:min(660px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - var(--header-height,66px) - 12px);padding:24px;overflow:auto;border:1px solid #d4dfe7;border-top:0;border-radius:0 0 12px 12px;background:#fff;box-shadow:0 18px 48px #173b5324;resize:none;z-index:25}
#panel.review-panel.analysis-panel{display:block;min-width:0}
.analysis-panel .dialog-head,.load-panel.analysis-panel .dialog-head{position:static;margin:0 0 20px;padding:0 0 16px;border-bottom:1px solid #e1e8ed;background:#fff;cursor:default;touch-action:auto;user-select:auto}
.analysis-panel .dialog-head h2{font-size:23px}
#panel.review-panel.analysis-panel #panel-body{overflow:visible;padding:0}

/* Commandes de fichier compactes, alignées avec le nom du chantier. */
.scene-head>.project-title-tools{display:flex;align-items:flex-end;gap:8px;min-width:0;pointer-events:auto}
.project-title-tools .project-title-field{width:auto;min-width:0}
.project-title-tools .project-title-field input{width:220px;min-width:0}
.project-file-actions{display:flex;align-items:center;gap:5px;pointer-events:auto}
.project-file-actions[hidden]{display:none}
.project-file-actions button{display:grid;place-items:center;width:34px;height:34px;padding:0;border:1px solid #b9cad6;border-radius:7px;background:#ffffffde;color:#244d68;box-shadow:0 2px 8px #173b5312}
.project-file-actions button:hover{background:#fff;border-color:#6f8fa5}
.project-file-actions button svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.header-actions>.project-file-actions{margin-right:4px}
.analysis-tabs>#checks.has-defects{color:#a4510b;background:#fff3e2;border-color:#e1a15e;border-bottom-color:#c9d6df}
.analysis-tabs>#checks.has-defects:hover{color:#843d05;background:#ffe8ca;border-color:#d58a3f}
.analysis-tabs>#checks.has-defects.active{color:#843d05;background:#fff3e2;border-color:#e1a15e;border-bottom-color:#fff3e2}
.analysis-tabs .tab-count{display:inline-grid;place-items:center;min-width:20px;height:20px;margin-left:7px;padding:0 5px;border-radius:10px;background:#dc741c;color:#fff;font-size:11px;font-weight:800;line-height:1}
@media(max-width:800px){.project-title-tools .project-title-field input{width:min(190px,calc(100vw - 150px))}.project-file-actions button{width:36px;height:36px}}
dialog.analysis-panel::backdrop{display:none}
@media(max-width:800px){dialog.analysis-panel,#panel.review-panel.analysis-panel,.load-panel.analysis-panel{inset:var(--header-height,110px) 12px 12px;width:auto;max-height:calc(100dvh - var(--header-height,110px) - 12px);padding:18px}.analysis-panel .dialog-head{margin-bottom:16px}}
