:root {
  --bg: #efe9dd;
  --paper: #fff;
  --paper-warm: #fbf7ee;
  --ink: #16242f;
  --text: #1b2733;
  --muted: #5d6b78;
  --soft: #8a93a0;
  --line: #e6ddc9;
  --line-strong: #d6cdb8;
  --navy: #0e2a44;
  --teal: #15607a;
  --sky: #86d2ff;
  --gold: #ffd083;
  --ochre: #b07a2e;
  --green: #2e8b6b;
  --shadow: 0 10px 30px rgba(40, 30, 10, .06);
  --small-shadow: 0 6px 18px rgba(40, 30, 10, .05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #c4892f;
  color: #fff;
}

button,
input,
summary {
  font: inherit;
}

button {
  border: 0;
}

input[type="range"] {
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 0;
  border-radius: 6px;
  background: #ded6c3;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .28);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .28);
  cursor: pointer;
}

input[type="number"] {
  font-family: "IBM Plex Mono", monospace;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  opacity: .4;
}

.page-shell {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 70% -10%, #f6f1e6 0%, var(--bg) 55%);
}

.topbar {
  display: flex;
  max-width: 1320px;
  margin: 0 auto;
  padding: 30px 24px 18px;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand-mark {
  display: flex;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--navy);
  box-shadow: 0 6px 18px rgba(14, 42, 68, .28);
}

.title-block {
  flex: 1 1 260px;
  min-width: 240px;
}

.title-block h1 {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0;
}

.title-block p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  padding: 8px 14px;
  border: 1px solid #e3dac6;
  border-radius: 10px;
  background: var(--paper);
}

.status-pill div {
  color: var(--soft);
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.status-pill strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  font-weight: 600;
}

.app-grid {
  display: flex;
  max-width: 1320px;
  margin: 0 auto;
  padding: 8px 24px 72px;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.controls-panel {
  position: sticky;
  top: 16px;
  flex: 1 1 320px;
  max-width: 384px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  margin-bottom: 18px;
  align-items: center;
  gap: 9px;
}

.section-title span,
.bar {
  display: inline-block;
  width: 7px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 3px;
}

.section-title h2,
.card-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
}

.section-title h2 {
  font-size: 16px;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.section-title-teal span {
  background: var(--teal);
}

.section-title-gold span {
  background: var(--gold);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #3a4753;
  font-size: 13px;
  font-weight: 600;
}

.shape-grid {
  display: grid;
  margin-bottom: 22px;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.shape-button {
  display: flex;
  padding: 13px 6px;
  align-items: center;
  flex-direction: column;
  gap: 7px;
  border: 1.5px solid #e0d7c2;
  border-radius: 11px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  transition: transform .12s, border-color .12s, background .12s, color .12s;
}

.shape-button:hover,
.shape-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--teal);
}

.shape-button.active {
  border-color: var(--teal);
  background: #eaf3f7;
  color: var(--teal);
}

.shape-button span {
  font-size: 13px;
  font-weight: 600;
}

.control-group {
  margin-bottom: 20px;
}

.control-head {
  display: flex;
  margin-bottom: 9px;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.control-head label {
  color: #3a4753;
  font-size: 14px;
  font-weight: 600;
}

.number-field {
  display: flex;
  align-items: center;
  gap: 5px;
}

.number-field input {
  width: 66px;
  padding: 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.number-field span,
.control-group p {
  color: #7a8590;
  font-size: 12px;
}

.control-group p {
  margin: 7px 0 0;
}

.advanced {
  padding-top: 14px;
  border-top: 1px dashed #e0d7c2;
}

.advanced summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced .control-group {
  margin-top: 14px;
  margin-bottom: 0;
}

.results-column {
  display: flex;
  min-width: 320px;
  flex: 3 1 560px;
  flex-direction: column;
  gap: 26px;
}

.results-head {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.results-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.measure-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.measure-pills span {
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--navy);
  color: #cfe6f5;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.measure-pills span + span {
  background: var(--teal);
  color: #dff0f7;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.material-card {
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--small-shadow);
}

.material-card header {
  display: flex;
  margin-bottom: 12px;
  align-items: center;
  gap: 9px;
}

.material-card header span {
  color: #46535f;
  font-size: 13px;
  font-weight: 600;
}

.material-card .value-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.material-card .value {
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.material-card .unit {
  color: #7a8590;
  font-size: 14px;
  font-weight: 600;
}

.material-card p {
  margin: 9px 0 0;
  color: #7a8590;
  font-size: 12px;
  line-height: 1.45;
}

.drawing-card,
.guide-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  padding: 16px 20px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #eee4d2;
}

.card-head h2 {
  font-size: 17px;
}

.bar-navy {
  background: var(--navy);
}

.bar-gold {
  background: var(--ochre);
}

.bar-green {
  background: var(--green);
}

.svg-wrap {
  padding: 14px 14px 6px;
}

.svg-wrap.padded {
  padding: 14px;
}

.svg-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.spec-grid {
  display: grid;
  border-top: 1px solid #eee4d2;
  background: #eee4d2;
  gap: 1px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.spec {
  padding: 11px 16px;
  background: var(--paper);
}

.spec span {
  color: var(--soft);
  font-size: 11px;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.spec strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  font-weight: 600;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.guide-card {
  padding: 22px 24px;
}

.guide-card .section-title h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.steps {
  display: flex;
  margin: 0;
  padding: 0;
  flex-direction: column;
  gap: 2px;
  list-style: none;
}

.steps li {
  display: flex;
  padding: 14px 0;
  gap: 16px;
  border-bottom: 1px solid #f1ead9;
}

.steps li:last-child {
  border-bottom: 0;
}

.steps li > span {
  display: flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--navy);
  color: var(--sky);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.steps h3 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.assumptions {
  padding: 22px 24px;
  border-radius: 18px;
  background: var(--navy);
  color: #cfe0ee;
}

.assumptions .section-title h2 {
  color: #eaf4ff;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
}

.assumption-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  font-size: 13px;
  line-height: 1.55;
}

.assumption-grid b {
  color: var(--gold);
}

footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px 40px;
  color: #9aa2ad;
  font-size: 12px;
}

@media (max-width: 760px) {
  .topbar {
    padding: 22px 16px 14px;
  }

  .app-grid {
    padding: 8px 16px 46px;
  }

  .controls-panel {
    position: static;
    max-width: none;
  }

  .title-block h1 {
    font-size: 25px;
  }

  .control-head {
    align-items: flex-start;
  }

  .shape-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-card,
  .assumptions {
    padding: 20px 18px;
  }
}

@media (max-width: 440px) {
  .status-pill {
    flex: 1 1 140px;
  }

  .shape-grid,
  .material-grid,
  .detail-grid,
  .assumption-grid {
    grid-template-columns: 1fr;
  }
}
