/* Spring Designer — layout and components. */

/* ── header ──────────────────────────────────────────────────
 *
 * Laid out to match the thread.html header: 3px red rule, 38px logo,
 * 19px title over a muted subtitle, meta pushed right, and the type
 * tabs sitting underneath with a red underline on the active one.
 */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: #fff; border-bottom: 1px solid var(--line-soft);
}
.hbar { height: 3px; background: var(--red); }
.hin {
  /* No width cap: this is a workspace, not an article. The three-column
     layout below runs full width, so the header has to line up with it. */
  padding: 16px 20px 0;
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
}

.logo-link {
  flex: none; display: block; line-height: 0;
  border-radius: 3px; transition: opacity .15s ease;
}
.logo-link:hover { opacity: .78; }
.logo-link:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.logo { width: 38px; height: 38px; display: block; }

.htitle h1 {
  font-size: 19px; font-weight: 600; margin: 0; letter-spacing: -.01em;
  color: var(--ink);
}
.htitle .sub { color: var(--ink-dim); font-size: 12px; margin-top: 1px; }
.spacer { flex: 1; }

.hmeta {
  font-size: 11px; color: var(--ink-dim); text-align: right; line-height: 1.6;
  /* Allowed to shrink so the unit badge and language switch stay on the
     title row; without this the whole right-hand group wraps below. */
  flex: 0 1 auto; min-width: 0; max-width: 300px;
}
.hmeta b { color: var(--ink); font-weight: 500; }

/* Type tabs, underlined rather than pilled, as in thread.html. */
.type-tabs {
  padding: 12px 20px 0;
  display: flex; gap: 2px; overflow-x: auto;
}
.type-tab {
  appearance: none; border: 0; background: none; font: inherit;
  font-size: 13px; font-weight: 500; color: var(--ink-dim);
  padding: 9px 14px 11px; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; border-radius: 4px 4px 0 0;
}
.type-tab:hover:not(:disabled) { color: var(--ink); background: var(--paper-raise); }
.type-tab.is-active { color: var(--red); border-bottom-color: var(--red); background: none; }
.type-tab:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.type-tab:disabled { opacity: .34; cursor: not-allowed; }

.unit-badge {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-dim);
  padding: 5px 10px; background: var(--paper-raise);
  border: 1px solid var(--line-soft); --notch: 6px;
}

/* ── layout ──────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 340px;
  gap: var(--gap);
  padding: var(--gap) 20px var(--gap);
  align-items: start;
  min-height: calc(100vh - var(--header-h));
}

.panel {
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-card);
  padding: 18px;
  position: sticky; top: calc(var(--header-h) + var(--gap));
  max-height: calc(100vh - var(--header-h) - var(--gap) * 2);
  overflow-y: auto;
}
.panel-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
  margin: 0 0 12px;
}
.panel-title:not(:first-child) { margin-top: 24px; }

/* ── fields ──────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 6px;
}
.field label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--ink);
  margin-bottom: 6px;
}
.field-head label { margin-bottom: 0; }
.sym {
  font-weight: 500; color: var(--ink-faint);
  font-family: var(--mono); font-size: 11.5px; margin-left: 3px;
}

.mode-toggle { display: flex; border: 1px solid var(--line); background: var(--paper-raise); }
.mode-toggle button {
  border: 0; background: transparent; cursor: pointer;
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; padding: 3px 8px; color: var(--ink-dim);
}
.mode-toggle button.is-active { background: var(--ink); color: var(--paper); }

.exact-row, .range-row { display: flex; align-items: center; gap: 6px; }
.range-row { gap: 5px; }
.range-sep { font-size: 11px; color: var(--ink-faint); }
.hidden { display: none !important; }

input[type=number], input[type=text], select, .blueprint-meta input {
  width: 100%; min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  outline: none;
}
input[type=number]:focus, select:focus, .blueprint-meta input:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px var(--red-tint);
}
input.is-bad { border-color: var(--red); background: var(--red-tint); }
.unit { font-size: 11px; color: var(--ink-faint); white-space: nowrap; min-width: 30px; }

.field-note { margin: 5px 0 0; font-size: 11px; color: var(--ink-dim); }
.field-note b { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.rule { border: 0; border-top: 1px solid var(--line-soft); margin: 20px 0 0; }

.seg { display: flex; border: 1px solid var(--line); }
.seg button {
  flex: 1; border: 0; background: var(--paper); cursor: pointer;
  padding: 8px; font-size: 12px; font-weight: 600; color: var(--ink-dim);
}
.seg button.is-active { background: var(--ink); color: var(--paper); }

/* ── buttons ─────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; padding: 9px 14px;
  font-weight: 600; font-size: 12.5px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; --notch: 8px;
}
.btn:hover { border-color: var(--ink-faint); background: var(--paper-raise); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-ghost { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── workspace ───────────────────────────────────────────────── */
.workspace { min-width: 0; display: flex; flex-direction: column; gap: var(--gap-s); }
.view-tabs { display: flex; gap: 2px; }
.view-tab {
  border: 1px solid var(--line-soft); border-bottom: 0;
  background: var(--paper-raise); cursor: pointer;
  padding: 9px 18px; font-weight: 600; font-size: 12.5px; color: var(--ink-dim);
  clip-path: polygon(9px 0, 100% 0, 100% 100%, 0 100%, 0 9px);
}
.view-tab.is-active { background: var(--card); color: var(--ink); }
.view-tab .count {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  background: var(--red); color: #fff; font-size: 10px; border-radius: 8px;
}
.view-tab .count:empty { display: none; }

.view { display: none; flex-direction: column; gap: var(--gap-s); }
.view.is-active { display: flex; }

.stage {
  background: var(--paper-raise);
  border: 1px solid var(--line-soft);
  height: clamp(360px, calc(100vh - 300px), 720px);
  overflow: hidden; position: relative;
}
.stage canvas { display: block; width: 100%; height: 100%; }
.stage-paper { background: #fff; display: grid; place-items: center; padding: 10px; }
.stage-paper svg { max-width: 100%; max-height: 100%; }

.stage-controls {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap); align-items: center;
  background: var(--card); border: 1px solid var(--line-soft); padding: 12px 14px;
}
.slider-head, .slider-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; color: var(--ink-dim);
}
.slider-head b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.slider-foot { margin-top: 4px; }
.slider-foot b { color: var(--ink); font-variant-numeric: tabular-nums; }
.slider-foot .mid { color: var(--red); font-weight: 700; font-variant-numeric: tabular-nums; }

input[type=range] {
  width: 100%; margin: 8px 0 0; accent-color: var(--red);
}
.stage-buttons { display: flex; gap: 6px; }
.stage-buttons .btn { width: auto; white-space: nowrap; }

.blueprint-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

/* ── spec panel ──────────────────────────────────────────────── */
.verdict {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; margin-bottom: 18px;
  background: var(--steel-tint); border-left: 3px solid var(--ink-faint);
}
.verdict-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--ink-faint);
  flex: none;
}
.verdict b { display: block; font-size: 13.5px; }
.verdict small { display: block; font-size: 11.5px; color: var(--ink-dim); margin-top: 1px; }
.verdict.is-ok   { background: var(--positive-tint); border-left-color: var(--positive); }
.verdict.is-ok   .verdict-dot { background: var(--positive); }
.verdict.is-warn { background: var(--amber-tint);   border-left-color: var(--amber); }
.verdict.is-warn .verdict-dot { background: var(--amber); }
.verdict.is-bad  { background: var(--red-tint);     border-left-color: var(--red); }
.verdict.is-bad  .verdict-dot { background: var(--red); }

.spec { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 0; }
.spec dt, .spec dd {
  margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.spec dt { color: var(--ink-dim); }
.spec dd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.spec dd .u { font-weight: 400; color: var(--ink-faint); font-size: 11px; margin-left: 3px; }
.spec .group dt, .spec .group dd { padding-top: 14px; }
.spec dt.hdr {
  grid-column: 1 / -1; border: 0; padding: 16px 0 4px;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 700;
}

.checks { list-style: none; margin: 0; padding: 0; }
.checks li {
  display: flex; gap: 9px; padding: 8px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 12px;
}
.checks .ico { flex: none; width: 14px; height: 14px; border-radius: 50%; margin-top: 2px; }
.checks .ok   .ico { background: var(--positive); }
.checks .warn .ico { background: var(--amber); }
.checks .bad  .ico { background: var(--red); }
.checks b { display: block; font-size: 12.5px; margin-bottom: 1px; }
.checks span { color: var(--ink-dim); }

.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.downloads .btn { flex-direction: column; gap: 1px; padding: 11px 8px; text-align: center; }
.downloads .btn span { font-size: 13px; font-weight: 700; letter-spacing: .03em; }
.downloads .btn small { font-size: 9.5px; opacity: .8; font-weight: 500; }
.dl-note { font-size: 11px; color: var(--ink-dim); margin: 9px 0 0; min-height: 1em; }
.dl-note.is-error { color: var(--red); }

/* ── responsive ──────────────────────────────────────────────── */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 280px minmax(0, 1fr); }
  .panel-spec { grid-column: 1 / -1; position: static; max-height: none; }
  .downloads { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; max-height: none; }
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .unit-badge { margin-left: 0; }
  .stage-controls { grid-template-columns: 1fr; }
  .blueprint-meta { grid-template-columns: 1fr 1fr; }
}

/* ── input rows (icon · value+tolerance · stepper) ───────────── */
.abbr { font-weight: 500; color: var(--ink-faint); font-size: 11.5px; }

.num-row, .sel-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 8px; align-items: stretch;
}
.sel-row { grid-template-columns: 40px minmax(0, 1fr); }

.ico-cell {
  border: 1px solid var(--line-soft); background: var(--paper-raise);
  display: grid; place-items: center; min-height: 38px;
}
.ico-cell::before {
  content: ''; width: 24px; height: 24px;
  background: var(--ink-dim);
  -webkit-mask: var(--m) center / contain no-repeat;
          mask: var(--m) center / contain no-repeat;
}
/* Small line glyphs, inlined so the panel has no external asset deps. */
.ico-cell[data-ico=wd] { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><ellipse cx="7" cy="12" rx="3" ry="6"/><path d="M7 6h10M7 18h10"/><ellipse cx="17" cy="12" rx="3" ry="6"/><path d="M15 9l4 6"/></svg>'); }
.ico-cell[data-ico=od] { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="4.5"/><path d="M5.5 18.5L18.5 5.5"/></svg>'); }
.ico-cell[data-ico=id] { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="4.5"/><path d="M8.8 15.2l6.4-6.4"/></svg>'); }
.ico-cell[data-ico=fl] { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><path d="M3 4v16M3 4h2M3 20h2"/><path d="M9 6c10 0 10 3 0 3s-10 3 0 3-10 3 0 3"/></svg>'); }
.ico-cell[data-ico=tc] { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><path d="M7 6c10 0 10 3.2 0 3.2s-10 3.2 0 3.2-10 3.2 0 3.2 10 3.2 0 3.2"/><path d="M3.5 6.5v11"/></svg>'); }
.ico-cell[data-ico=et] { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><ellipse cx="12" cy="7" rx="8" ry="2.6"/><ellipse cx="12" cy="12" rx="8" ry="2.6"/><ellipse cx="12" cy="17" rx="8" ry="2.6"/></svg>'); }
.ico-cell[data-ico=dw] { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><circle cx="12" cy="12" r="8"/><path d="M12 4a8 8 0 018 8"/><path d="M18 4.5l2.5 2.2-3.2 1.4z" fill="black" stroke="none"/></svg>'); }
.ico-cell[data-ico=mt] { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><rect x="3" y="9" width="18" height="6" rx="3"/><path d="M7 9v6"/></svg>'); }

.num-box { position: relative; display: flex; }
.num-box input { padding-right: 76px; }
.tol {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--amber); font-variant-numeric: tabular-nums;
  pointer-events: none; white-space: nowrap;
}

.stepper { display: flex; flex-direction: column; width: 26px; }
.stepper button {
  flex: 1; border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; font-size: 7px; line-height: 1; color: var(--ink-dim);
  padding: 0;
}
.stepper button:first-child { border-bottom: 0; }
.stepper button:hover { background: var(--paper-raise); color: var(--ink); }

.field-note.align-right { text-align: right; color: var(--ink-faint); letter-spacing: .04em; }

/* ── live force HUD over the 3D stage ────────────────────────── */
.hud {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line-soft);
  padding: 10px 12px; min-width: 176px;
  backdrop-filter: blur(6px);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.hud-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 14px; font-size: 11.5px; color: var(--ink-dim); padding: 2px 0;
}
.hud-row b { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.hud-bar {
  height: 4px; background: var(--line-soft); margin: 8px 0 6px; overflow: hidden;
}
.hud-bar i { display: block; height: 100%; width: 0; background: var(--positive); transition: width .08s linear; }
.hud-bar i.is-warn { background: var(--amber); }
.hud-bar i.is-bad  { background: var(--red); }
.hud-foot { font-size: 10.5px; color: var(--ink-dim); }
.hud-foot.is-warn { color: var(--amber); font-weight: 600; }
.hud-foot.is-bad  { color: var(--red); font-weight: 600; }

/* ── operating points ────────────────────────────────────────── */
.oppanel {
  background: var(--card); border: 1px solid var(--line-soft);
  padding: 12px 14px;
}
.oppanel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.oppanel-head h3 {
  margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
}
.oppanel-head .btn { padding: 7px 12px; font-size: 12px; }
.oppanel-head .btn b { font-variant-numeric: tabular-nums; font-weight: 700; }

.optable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.optable:empty { display: none; }
.optable th {
  text-align: right; padding: 4px 8px; font-size: 9.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.optable th:first-child, .optable td:first-child { text-align: left; }
.optable th:last-child, .optable td:last-child { width: 26px; }
.optable td {
  padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
.optable td i { font-style: normal; color: var(--ink-faint); font-size: 10px; margin-left: 2px; }
.optable td b { font-weight: 700; }

.op-label {
  font-weight: 700; color: #fff; text-align: center !important;
}
.optable td.op-label::before {
  content: attr(data-x);
}
.optable .op-label {
  background: var(--red); width: 30px;
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
.optable tr.is-warn td { background: var(--amber-tint); }
.optable tr.is-bad  td { background: var(--red-tint); }
.optable tr.op-warn td {
  background: var(--red-tint); color: var(--red); font-size: 11px;
  text-align: left; font-weight: 600;
}

.op-del {
  border: 1px solid var(--line); background: var(--paper); cursor: pointer;
  width: 22px; height: 22px; line-height: 1; color: var(--ink-dim);
  font-size: 14px; padding: 0;
}
.op-del:hover { border-color: var(--red); color: var(--red); background: var(--red-tint); }

.op-hint { margin: 9px 0 0; font-size: 11px; color: var(--ink-dim); }
.op-hint b { color: var(--ink); font-weight: 700; }
.op-hint.is-error { color: var(--red); font-weight: 600; }

/* ── per-type field sets ─────────────────────────────────────── */
.type-fields { display: none; }
.type-fields.is-active { display: block; }
.range-note { display: flex; justify-content: space-between; color: var(--ink-faint); }

.bp-todo {
  max-width: 460px; text-align: center; padding: 30px; color: var(--ink-dim);
}
.bp-todo b { display: block; font-size: 14px; color: var(--ink); margin-bottom: 8px; }
.bp-todo span { font-size: 12.5px; line-height: 1.6; }

/* ── language toggle ─────────────────────────────────────────
 *
 * Real flag artwork rather than emoji or CSS approximations: emoji flags
 * do not render at all on Windows, which is where this is used.
 */
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }

.lang-toggle {
  position: relative; display: inline-flex; align-items: stretch;
  border: 1px solid var(--line); background: var(--paper-raise);
  cursor: pointer; padding: 0; overflow: hidden; user-select: none;
  border-radius: 5px;
}
.lang-toggle:hover { border-color: var(--ink-faint); }
.lang-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.lang-opt {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: var(--ink-dim); transition: color .18s ease;
}
.lang-toggle:not(.is-tr) .lang-opt[data-lang="en"],
.lang-toggle.is-tr      .lang-opt[data-lang="tr"] { color: #fff; }

.lang-knob {
  position: absolute; z-index: 1; top: 0; bottom: 0; left: 0; width: 50%;
  background: var(--red); transition: transform .2s cubic-bezier(.4,0,.2,1);
}
.lang-toggle.is-tr .lang-knob { transform: translateX(100%); }

.flag {
  width: 18px; height: 12px; display: block; flex: none;
  border-radius: 1.5px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0,0,0,.16);
}

@media (max-width: 860px) {
  .hin { padding: 12px 14px 0; }
  .hmeta { display: none; }
  .type-tabs { padding: 10px 14px 0; }
}

/* ── per-type field sets ─────────────────────────────────────── */
.type-fields { display: none; }
.type-fields.is-active { display: block; }
.range-note { display: flex; justify-content: space-between; color: var(--ink-faint); }

.bp-todo {
  max-width: 460px; text-align: center; padding: 30px; color: var(--ink-dim);
}
.bp-todo b { display: block; font-size: 14px; color: var(--ink); margin-bottom: 8px; }
.bp-todo span { font-size: 12.5px; line-height: 1.6; }

