/* Step-by-step interface, minimal style. Loaded after styles.css: the result
   panels keep their original styling, the header and the case setup are
   redrawn here. */

:root {
  --faint: #9aa6b0;
  --soft: #f6f8fa;
  --stepper-h: 50px;
  --preview-h: 660px;
  --math: "Cambria Math", "STIX Two Math", "Latin Modern Math", "Times New Roman", serif;
}

body { background: #fff; }
.engine { display: none !important; }

/* ---------- header ---------- */
.topbar { padding: 10px 28px; gap: 18px; }
.topbar::before { height: 2px; }
.brand { gap: 14px; }
.brand-logo { height: 34px; }
.brand-wordmark { font-size: 22px; }
.brand-text h1 { font-size: 14.5px; font-weight: 600; color: var(--ink); letter-spacing: 0; }
.analysis-mode-switcher {
  margin: 0 0 0 auto; padding: 3px; gap: 0; display: inline-flex; width: auto; max-width: none;
  background: var(--soft); border: 0; border-radius: 9px; box-shadow: none;
}
.analysis-mode-btn {
  min-height: 0; padding: 5px 14px; border: 0; border-radius: 7px; background: transparent;
  box-shadow: none; display: block; text-align: center; color: var(--muted);
}
.analysis-mode-btn strong { font-size: 12.5px; font-weight: 500; }
.analysis-mode-btn:hover { background: transparent; color: var(--ink); transform: none; }
.analysis-mode-btn.active {
  background: #fff; color: var(--brand); border: 0; box-shadow: 0 1px 2px rgba(20, 32, 43, 0.14);
}
.analysis-mode-btn.active strong { color: var(--brand); }
.polito-logo-wrap { padding: 6px 10px; border-radius: 7px; }
.polito-logo { height: 22px; }
.polito-fallback { font-size: 12px; font-weight: 600; }

/* ---------- stepper ---------- */
.stepper {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 2px;
  height: var(--stepper-h); padding: 0 28px;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.step {
  appearance: none; border: 0; background: none; cursor: pointer;
  height: 100%; padding: 0 10px; display: flex; align-items: center; gap: 9px;
  color: var(--faint); font-weight: 500; font-size: 13.5px; position: relative; white-space: nowrap;
}
.step .n {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 600;
}
.step:hover:not(:disabled):not(.on) { color: var(--ink); }
.step.done { color: var(--muted); }
.step.done .n { background: var(--soft); border-color: var(--line); color: var(--brand); }
.step.on { color: var(--brand); }
.step.on .n { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); }
.step:disabled { cursor: default; opacity: 0.45; }
.step-sep { width: 20px; height: 1px; background: var(--line); flex: 0 0 auto; }
.run-cta {
  margin-left: auto; border: 0; cursor: pointer; white-space: nowrap;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 13px;
  padding: 8px 18px; border-radius: 8px; transition: filter 0.12s;
}
.run-cta:hover:not(:disabled) { filter: brightness(0.94); }
.run-cta:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- layout ---------- */
.shell {
  display: grid; grid-template-columns: 400px minmax(0, 1fr);
  gap: 0; padding: 0; max-width: none; align-items: stretch;
}
.setup-panel {
  border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none;
  padding: 26px 28px 24px; min-height: var(--preview-h);
  display: flex; flex-direction: column; align-self: stretch;
}
.step-pane { display: none; flex-direction: column; }
.step-pane.on { display: flex; }
.pane-head h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--brand); letter-spacing: 0; }
.pane-head { margin-bottom: 18px; }
.pane-label {
  margin: 18px 0 8px; font-size: 11px; font-weight: 600; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.pane-head + .pane-label { margin-top: 0; }
.pane-label-row { display: flex; align-items: center; justify-content: space-between; }
.pane-label-note { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--faint); margin-left: 6px; }
.unit-switch { display: inline-flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; }
.unit-switch label { display: inline; font-size: 12px; color: var(--muted); font-weight: 500; }
.unit-switch select { width: 72px; height: 28px; padding: 0 6px; font-size: 12.5px; }
.pane-note { margin-top: 14px; font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 8px; padding: 8px 10px; }
.pane-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.pane-nav { margin-top: auto; padding-top: 24px; display: flex; justify-content: space-between; gap: 10px; }
.pane-nav .btn[hidden] { display: none; }

/* buttons */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  padding: 7px 14px; border-radius: 8px; font-weight: 500; font-size: 13px; width: auto; height: auto;
}
.btn:hover:not(:disabled) { border-color: #c9d2d9; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.15); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pane-nav .run-button { margin: 0; width: auto; min-height: 0; height: auto; box-shadow: none; }
.text-button { align-self: flex-start; border: 0; background: none; color: var(--brand); font-weight: 500; font-size: 13px; padding: 6px 0; cursor: pointer; width: auto; height: auto; }
.text-button:hover:not(:disabled) { text-decoration: underline; }
.text-button:disabled { color: var(--faint); cursor: default; }

/* fields */
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.field i, .dims i { font-family: var(--math); font-size: 14px; color: var(--ink); font-style: italic; }
.setup-panel input:not([type=checkbox]):not([type=radio]):not([type=range]),
.setup-panel select { height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 13px; }
.setup-panel input:focus-visible, .setup-panel select:focus-visible { border-color: var(--brand); box-shadow: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form-grid .field:first-child:nth-last-child(3) { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--ink); letter-spacing: 0; margin-top: 6px; }
.check input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.check i { font-family: var(--math); font-size: 14px; }
.hint-line { font-size: 12px; color: var(--muted); margin-top: 6px; }
.hint-line:empty { display: none; }

details.more { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
details.more > summary { cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--brand); list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; display: inline-block; width: 14px; color: var(--faint); }
details.more[open] > summary::before { content: "−"; }
details.more[open] > summary { margin-bottom: 10px; }

/* segmented control */
.seg { display: inline-flex; background: var(--soft); border-radius: 8px; padding: 3px; }
.seg button {
  border: 0; background: none; padding: 4px 12px; border-radius: 6px; cursor: pointer;
  color: var(--muted); font-weight: 500; font-size: 12.5px; width: auto; height: auto;
}
.seg button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 2px rgba(20, 32, 43, 0.14); }
.seg button:disabled { color: #c5ccd2; cursor: not-allowed; }

/* ---------- step 1: geometry ---------- */
.geo-options { display: flex; flex-direction: column; gap: 2px; }
.geo-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid transparent; background: none; padding: 5px 10px 5px 6px; border-radius: 9px;
  color: var(--ink); font-size: 13.5px; font-weight: 500;
}
.geo-opt canvas { width: 46px; height: 32px; flex: 0 0 auto; }
.geo-opt:hover:not(:disabled) { background: var(--soft); }
.geo-opt.on { border-color: var(--brand); background: #fff; }
.geo-opt .sub { margin-left: auto; color: var(--faint); font-family: var(--math); font-style: italic; font-size: 13px; font-weight: 400; }
.geo-opt:disabled { opacity: 0.45; cursor: not-allowed; }
.dims { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.dims .slider { grid-column: span 2; display: flex; flex-direction: column; gap: 2px; }
.dims .slider .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 500; }
.dims .slider .row b { color: var(--ink); font-weight: 600; }
.dims .slider .ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; margin-top: -2px; }
.dims input[type=range] { width: 100%; height: auto; padding: 0; border: 0; accent-color: var(--brand); margin: 4px 0 0; }
.dims .error-line { grid-column: span 2; }

/* ---------- step 2: laminate ---------- */
.layer-table { width: 100%; border-collapse: collapse; }
.layer-table thead tr, .layer-table tbody tr { display: grid; grid-template-columns: 22px minmax(0, 1fr) 76px 64px 24px; gap: 6px; align-items: center; }
.layer-table th { font-size: 11px; font-weight: 500; color: var(--faint); text-align: left; padding: 0 0 4px; }
.layer-table tbody { display: flex; flex-direction: column-reverse; gap: 6px; }
.layer-table td { padding: 0; border: 0; font-size: 11.5px; color: var(--faint); }
.layer-table td:first-child { text-align: right; }
.layer-table select, .layer-table input { height: 32px !important; min-width: 0; }
.layer-table .remove-btn { border: 0; background: none; color: var(--faint); font-size: 15px; cursor: pointer; width: auto; height: auto; padding: 0; }
.layer-table .remove-btn:hover { color: var(--ink); background: none; }
.error-line:empty { display: none; }
.custom-materials-panel { border: 0; padding: 0; margin: 0; }

/* ---------- step 4: theory, acronym composer ---------- */
.composer { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; }
.composer .links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 0; }
.links path { fill: none; stroke: #c3cdd5; stroke-width: 1; transition: stroke 0.15s; }
.links circle { fill: #c3cdd5; transition: fill 0.15s; }
.links g.off path { stroke-dasharray: 3 3; }
.links g.hot path { stroke: var(--brand); }
.links g.hot circle { fill: var(--brand); }
.c-card {
  position: relative; z-index: 1; display: flex; flex-direction: column; gap: 1px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 8px 8px;
  transition: border-color 0.15s, opacity 0.15s;
}
.c-card:hover { border-color: #c9d2d9; }
.c-card.off { opacity: 0.5; }
.c-card h4 { margin: 0 0 4px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.c-opt {
  display: flex; align-items: flex-start; gap: 8px; width: 100%; height: auto; padding: 5px 4px; margin: 0;
  border: 0; border-radius: 7px; background: none; cursor: pointer; text-align: left;
  color: var(--muted); font-size: 12.5px; font-weight: 500; line-height: 1.3;
  transition: background 0.12s, color 0.12s;
}
.c-opt .k {
  flex: 0 0 22px; height: 22px; margin-top: -2px; border-radius: 6px; border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; color: var(--brand); font-size: 12px; font-weight: 600;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.c-opt .t { min-width: 0; }
.c-opt small { display: block; font-size: 11px; font-weight: 400; color: var(--faint); }
.c-opt:hover:not(:disabled), .c-opt:focus-visible { background: var(--soft); color: var(--ink); outline: none; }
.c-opt:hover:not(:disabled) .k { border-color: var(--brand); }
.c-opt.on { color: var(--ink); }
.c-opt.on .k { background: var(--brand); border-color: var(--brand); color: #fff; }
.c-opt:disabled { cursor: not-allowed; }
.order-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 2px 4px 0; }
.c-num {
  height: 32px; width: auto; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 600; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.c-num:hover, .c-num:focus-visible { border-color: var(--brand); color: var(--brand); outline: none; }
.c-num.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.order-name { margin: auto 4px 1px; padding-top: 8px; font-size: 12px; color: var(--muted); }
.band {
  grid-column: 1 / -1; position: relative; z-index: 1; margin: 30px 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 7px;
  border-radius: 12px; background: rgba(123, 212, 208, 0.16);
}
.band .slot {
  height: 44px; border-radius: 8px; background: #fff; border: 1px solid rgba(0, 43, 73, 0.14);
  display: grid; place-items: center; color: var(--brand); font-size: 21px; font-weight: 600; line-height: 1;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.band .slot.ghost { background: transparent; border-style: dashed; border-color: rgba(0, 43, 73, 0.16); color: rgba(0, 43, 73, 0.16); }
.band .slot.hot { border-color: var(--brand); }
.band .slot.changed { color: var(--accent); }
.band .slot.ghost.changed { color: rgba(239, 123, 0, 0.45); border-color: rgba(239, 123, 0, 0.45); }
.shear-correction-options .check { display: flex; width: fit-content; }
.shear-correction-options details.more { margin-top: 16px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; padding: 10px 0 0; overflow: visible; }
.shear-correction-options details.more > summary { padding: 0; font-size: 12.5px; font-weight: 500; }
.shear-correction-options details.more label { display: flex; padding: 0; font-size: 12px; font-weight: 500; color: var(--muted); }
.setup-panel select:disabled { background: var(--soft); color: var(--muted); opacity: 1; cursor: not-allowed; }
.th-more { margin-top: 18px; }
.th-more > summary { display: flex; align-items: baseline; }
.th-more .sum-note { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--faint); }
.th-more[open] .sum-note { display: none; }
.th-suboption { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--soft); }
.th-suboption[hidden] { display: none; }
.th-suboption i { font-family: var(--math); font-size: 14px; }
.th-suboption sub { font-size: 0.72em; }
.th-suboption select { background: #fff; }
.th-option-label { margin-bottom: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.geo-family { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-bottom: 14px; }
.geo-family button { padding: 7px 4px; font-size: 13.5px; }
.geo-options[hidden] { display: none; }
.seg-wide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.seg-wide button { padding: 6px 4px; font-size: 12.5px; white-space: nowrap; }
.seg-wide button b { margin-right: 3px; font-weight: 700; }
.switch-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; cursor: pointer; }
.switch-row input {
  appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 30px; width: 30px; height: 18px; margin: 1px 0 0;
  border-radius: 9px; background: #d3dae0; cursor: pointer; transition: background 0.15s;
}
.switch-row input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(20, 32, 43, 0.25); transition: transform 0.15s;
}
.switch-row input:checked { background: var(--brand); }
.switch-row input:checked::after { transform: translateX(12px); }
.switch-row input:focus-visible { outline: 2px solid rgba(0, 43, 73, 0.3); outline-offset: 2px; }
.switch-text { font-size: 12.5px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.switch-text i { font-family: var(--math); font-size: 14px; padding: 0 2px 0 1px; }
.switch-text small { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.switch-text small i { font-size: 13px; }
.switch-text sub { font-size: 0.72em; }
#normalRecoveryHint { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.shear-correction-options .check { margin-top: 8px; }

/* ---------- preview (right) ---------- */
.viewport { background: var(--soft); position: relative; min-width: 0; }
.preview { display: none; position: sticky; top: var(--stepper-h); height: var(--preview-h); flex-direction: column; }
.preview.on { display: flex; }
#geoStage { flex: 1; width: 100%; min-height: 0; display: block; cursor: grab; touch-action: none; }
#geoStage:active { cursor: grabbing; }
.preview-foot { position: absolute; left: 24px; right: 24px; bottom: 16px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.preview-foot .seg { pointer-events: auto; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.preview-hint { font-size: 11.5px; color: var(--faint); }
.preview-center { flex: 1; display: grid; place-items: center; padding: 30px; min-height: 0; }
.preview-center > svg { width: 100%; max-width: 760px; max-height: 100%; height: auto; display: block; }
.preview-note { color: var(--muted); max-width: 380px; text-align: center; font-size: 13px; }
/* load: the structure in 3D beside the plan */
#evaluationPointHint, #loadHint, #fourierHint, .shear-correction-options .hint-line { display: none !important; }
.load-view { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.load-pane { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 18px 24px 16px; }
.load-pane + .load-pane { border-left: 1px solid var(--line); }
.load-cap {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px;
  font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em;
}
.load-cap-note { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 11.5px; }
.face-chip {
  text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 500; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}
.load-pane canvas { flex: 1; width: 100%; min-height: 0; display: block; touch-action: none; outline: none; }
#loadStage { cursor: grab; }
#loadStage:active { cursor: grabbing; }
#loadPlan { cursor: crosshair; border-radius: 8px; }
#loadPlan:focus-visible { box-shadow: inset 0 0 0 2px rgba(0, 43, 73, 0.25); }
.load-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 22px; }
.load-legend { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.load-legend i { font-family: var(--math); font-size: 14px; color: var(--ink); }
.load-legend b {
  width: 110px; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, rgb(252, 253, 254), rgb(250, 212, 172) 45%, rgb(241, 134, 32));
  box-shadow: inset 0 0 0 1px rgba(0, 43, 73, 0.1);
}
.load-readout { width: 100%; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.load-readout i { font-family: var(--math); font-size: 14px; color: var(--ink); margin-right: 3px; }
.load-readout .sep { display: inline-block; width: 18px; }

.theory-view { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 28px 44px; width: 100%; max-width: 920px; margin: 0 auto; }
.theory-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.theory-head h3 { margin: 0; font-size: 30px; font-weight: 600; color: var(--brand); letter-spacing: 0.3px; }
.theory-state { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.theory-w { font-size: 12px; color: var(--accent); font-weight: 500; }
.theory-unknowns { margin-left: auto; font-size: 12px; color: var(--muted); }
.theory-sub { color: var(--muted); margin: 2px 0 10px; font-size: 13px; }

.preview[data-preview="theory"] { height: auto; min-height: var(--preview-h); }
.theory-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; margin-top: 10px; }
.theory-cols.one { grid-template-columns: minmax(0, 430px); justify-content: center; }
.th-col { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.th-col-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); text-align: center; }
.th-col-title .vars { margin-left: 6px; font-family: var(--math); font-size: 15px; font-weight: 400; color: var(--muted); }
.th-col-title sub { font-size: 0.7em; }
.th-plot { width: 100%; }
.th-plot svg { width: 100%; height: auto; display: block; }
.th-eq { max-width: 100%; overflow-x: auto; text-align: center; white-space: nowrap; font-family: var(--math); color: var(--ink); padding: 2px 0; }
.th-eq math { font-family: var(--math); }
.th-eq .eq1 { font-size: 17px; }
.th-eq .eq2 { margin-top: 3px; font-size: 14.5px; color: var(--muted); }
.th-eq .eq-sep { display: inline-block; width: 1.4em; }
.theory-cols:not(.one) .th-eq { min-height: 56px; }
.th-fns-title { margin-top: 16px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.th-fns { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; margin-top: 6px; }
.th-fns svg { width: 50px; height: auto; display: block; cursor: help; }
.th-fns-note { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.th-fns-note .dot { width: 7px; height: 7px; border-radius: 50%; border: 1.3px solid currentColor; background: currentColor; flex: none; }
.th-fns-note .dot.open { background: #fff; }
.th-col:first-child .th-fns-note .dot { color: var(--ink); }
.th-col:last-child:not(:first-child) .th-fns-note .dot { color: #1d7c78; }

/* ---------- footer ---------- */
.footer-left { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.site-footer a.footer-refs {
  font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none;
  padding: 6px 14px; border: 1px solid rgba(239, 123, 0, 0.45); border-radius: 8px; transition: background 0.15s;
}
.site-footer a.footer-refs:hover { background: rgba(239, 123, 0, 0.08); }

/* ---------- results ---------- */
.results[hidden] { display: none !important; }
.shell[data-step="results"] { grid-template-columns: minmax(0, 1fr); }
.shell[data-step="results"] > .setup-panel,
.shell[data-step="results"] > .viewport { display: none; }
.results { padding: 20px 28px 40px; max-width: 1640px; width: 100%; margin: 0 auto; }
.results-bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 2px 0 6px; }
.case-summary { font-size: 13px; color: var(--muted); }
.case-summary b { color: var(--ink); font-weight: 600; }
.results-bar .hold-controls { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 0 auto; padding: 0; border: 0; background: none; }
.results-bar .hold-controls .check { margin: 0; }
.results-bar .hold-controls small { color: var(--faint); font-size: 12px; }
.results-bar .btn { margin-left: 4px; }
body[data-analysis-mode="scf"] .results-bar .btn { margin-left: auto; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  :root { --preview-h: 440px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .setup-panel { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; padding: 20px 18px; }
  .preview { position: relative; top: 0; }
  .topbar, .stepper { padding-left: 14px; padding-right: 14px; }
  .stepper { overflow-x: auto; scrollbar-width: none; }
  .stepper::-webkit-scrollbar { display: none; }
  .brand-text { display: none; }
  .results { padding: 16px; }
  .theory-view { padding: 20px 16px; }
  .preview[data-preview="load"] { height: auto; }
  .load-view { grid-template-columns: minmax(0, 1fr); }
  .load-pane { height: 400px; padding: 14px 16px 12px; }
  .load-pane + .load-pane { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .polito-mark { display: none; }
  .step { padding: 0 6px; }
  .step .t { display: none; }
  .step.on .t { display: inline; }
  .step-sep { width: 8px; }
  .run-cta { padding: 7px 12px; }
  .run-cta .long { display: none; }
  .theory-cols { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .theory-cols:not(.one) .th-eq { min-height: 0; }
  .analysis-mode-btn { padding: 5px 9px; }
}

/* ---------- Free vibration ---------- */
body:not([data-analysis-mode="vibration"]) .vibration-only { display: none !important; }
body[data-analysis-mode="vibration"] .no-vibration,
body[data-analysis-mode="vibration"] .scf-only { display: none !important; }
.modes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.modes-grid .field input { width: 100%; }
.modes-preview { display: grid; place-items: center; width: 100%; height: 100%; padding: 18px; }
.modes-preview svg { max-width: 100%; height: auto; }
.vib-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.vib-metrics .metric small { display: block; margin-top: 3px; color: var(--muted); font-family: var(--font-num); font-size: 12px; }
.vib-panel { margin-bottom: 14px; }
.vib-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vib-bar h2 { margin-right: 6px; }
.vib-pick { display: flex; align-items: center; gap: 6px; }
.vib-pick select { font: inherit; font-size: 13px; font-weight: 500; min-width: 300px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); }
.vib-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.vib-seg { display: flex; gap: 6px; }
.vib-chip { font: inherit; font-size: 12.5px; line-height: 1.2; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 7px; padding: 6px 12px; cursor: pointer; }
.vib-chip:hover { border-color: #b8c4cd; }
.vib-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.vib-scale { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.vib-scale input { accent-color: var(--brand); width: 110px; }
.vib-views { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px 14px; }
.vib-view { position: relative; height: 340px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: grab; touch-action: none;
  background: linear-gradient(180deg, #ffffff 0%, #f3f6f8 55%, #e4eaef 100%); }
.vib-view.grabbing { cursor: grabbing; }
.vib-view canvas { display: block; width: 100%; height: 100%; }
.vib-ov { position: absolute; left: 14px; top: 11px; pointer-events: none; font-family: var(--font-num); color: var(--ink); }
.vib-ov-m { display: flex; align-items: center; gap: 8px; font-family: var(--font); font-weight: 600; font-size: 15px; }
.vib-ov-m i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.vib-ov-f { font-size: 22px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.vib-ov-d { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.vib-none { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-size: 13.5px; color: var(--ink); }
.vib-none[hidden] { display: none; }
.vib-none span { background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 7px; padding: 7px 14px; box-shadow: var(--shadow); }
.vib-sbar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px 16px; font-family: var(--font-num); font-size: 12px; }
.vib-sbar b { font-weight: 600; margin-right: 6px; }
.vib-grad { display: inline-block; width: 340px; height: 12px; border-radius: 2px;
  background: linear-gradient(90deg, rgb(59,76,192), rgb(98,130,234), rgb(141,176,254), rgb(184,208,249), rgb(221,221,221), rgb(245,196,173), rgb(244,154,123), rgb(222,96,77), rgb(180,4,38)); }
.vib-details { border-top: 1px solid var(--line-soft, #edf1f4); }
.vib-details > summary { list-style: none; cursor: pointer; padding: 13px 18px; font-weight: 600; font-size: 13.5px; color: var(--brand); display: flex; align-items: center; gap: 8px; }
.vib-details > summary::-webkit-details-marker { display: none; }
.vib-details > summary::before { content: "\25B8"; font-size: 11px; }
.vib-details[open] > summary::before { content: "\25BE"; }
.vib-sec { padding: 4px 18px 18px; }
.vib-secbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12.5px; }
.vib-check { display: flex; align-items: center; gap: 6px; margin-left: 10px; }
.vib-macrow { display: flex; gap: 26px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.vib-macrow svg text, .vib-svg text { font-family: var(--font-num); }
.vib-svg { display: block; width: 100%; height: auto; }
.vib-legend { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; font-size: 13px; padding: 2px 0 6px; }
.vib-legend span { display: flex; align-items: center; gap: 6px; }
.vib-plies { padding-top: 8px; font-size: 12.5px; }
.vib-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.vib-table { width: 100%; border-collapse: collapse; font-family: var(--font-num); font-size: 13px; }
.vib-table th { font-family: var(--font); font-weight: 500; font-size: 12px; color: var(--muted); text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.vib-table td { text-align: right; padding: 7px 12px; border-bottom: 1px solid var(--line-soft, #edf1f4); }
.vib-table th:nth-child(-n+3), .vib-table td:nth-child(-n+3) { text-align: left; }
.vib-table tbody tr { cursor: pointer; }
.vib-table tr.sel td { background: var(--accent-soft, #fff3e8); }
.vib-table td.muted { color: var(--muted); }
.vib-tag { font-family: var(--font); font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: var(--brand-soft, #eef3f6); color: var(--brand); }
.vib-tag.ip { background: #eaf6f4; color: #00695c; }
.vib-tag.ts { background: var(--accent-soft, #fff3e8); color: #a85600; }
.vib-tag.tz { background: #f3ecf7; color: #5e2d7a; }
.custom-material-grid .vibration-only input { width: 100%; }
@media (max-width: 1100px) {
  .vib-views, .vib-grid3 { grid-template-columns: minmax(0, 1fr); }
  .vib-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vib-right { margin-left: 0; flex-wrap: wrap; }
}
.vib-check { white-space: nowrap; font-size: 12.5px; color: var(--ink); }
.vib-check input { width: auto; height: auto; margin: 0; accent-color: var(--brand); }
.vib-table th { text-transform: none; letter-spacing: 0; }
body[data-analysis-mode="vibration"] .results-bar .btn { margin-left: auto; }
