:root {
  color-scheme: light;
  --ink: #182322;
  --muted: #60706d;
  --line: #cfd9d7;
  --panel: #ffffff;
  --field: #f5f8f7;
  --accent: #15543f;
  --accent-2: #b4873e;
  --accent-3: #384f7c;
  --shadow: 0 18px 44px rgba(28, 43, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #eef3f2;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding: 14px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-brand-link {
  color: inherit;
  text-decoration: none;
}

.topbar-logo {
  flex: 0 0 auto;
  width: 46px;
  height: 54px;
  object-fit: contain;
  object-position: center;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.home-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3.5vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  font-size: 0.96rem;
  margin-bottom: 14px;
}

h3 {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.content-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(340px, 390px) minmax(360px, 1fr) minmax(240px, 300px);
  grid-template-rows: minmax(520px, calc(100vh - 174px));
  align-items: stretch;
  gap: 16px;
  min-height: 0;
}

.control-panel,
.spec-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
  overflow: auto;
  min-height: 0;
}

.control-panel {
  position: relative;
  z-index: 6;
}

.panel-section + .panel-section {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 18px;
}

label,
.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px auto;
  gap: 8px 10px;
  align-items: center;
  min-height: 44px;
  color: #273936;
  font-size: 0.92rem;
}

.control-group {
  --group-accent: var(--accent);
  --group-bg: #f8faf9;
  --group-open-bg: #fff;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--group-accent);
  border-radius: 18px;
  background: var(--group-bg);
  overflow: hidden;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.control-group[open] {
  background: var(--group-open-bg);
  border-color: #c7d5d2;
  box-shadow: 0 10px 26px rgba(20, 40, 36, 0.07);
}

.control-group:nth-of-type(1) {
  --group-accent: var(--accent);
  --group-bg: #eef8f5;
  --group-open-bg: linear-gradient(90deg, #f2faf8 0%, #ffffff 34%);
}

.control-group:nth-of-type(2) {
  --group-accent: #384f7c;
  --group-bg: #f0f4fb;
  --group-open-bg: linear-gradient(90deg, #f4f7fd 0%, #ffffff 34%);
}

.control-group:nth-of-type(3) {
  --group-accent: var(--accent-2);
  --group-bg: #fff4ee;
  --group-open-bg: linear-gradient(90deg, #fff6f1 0%, #ffffff 34%);
}

.control-group:nth-of-type(4) {
  --group-accent: #8d6a2c;
  --group-bg: #fbf7e8;
  --group-open-bg: linear-gradient(90deg, #fdf9ec 0%, #ffffff 34%);
}

.control-group:nth-of-type(5) {
  --group-accent: #53605d;
  --group-bg: #f1f4f3;
  --group-open-bg: linear-gradient(90deg, #f5f7f6 0%, #ffffff 34%);
}

.control-group summary {
  min-height: 42px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  list-style: none;
}

.control-group summary::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--group-accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.68);
}

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

.control-group summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 1rem;
}

.control-group[open] summary::after {
  content: "-";
}

.control-group-body {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  padding: 0 14px;
  transition: grid-template-rows 180ms ease, opacity 140ms ease, padding 180ms ease;
}

.control-group[open] .control-group-body {
  grid-template-rows: 1fr;
  opacity: 1;
  padding: 2px 14px 14px;
}

.control-group-body > * {
  min-height: 0;
  overflow: hidden;
}

.control-group-body label:first-child {
  margin-top: 0;
}

.label-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.info-bubble {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--field);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: help;
}

.tooltip {
  position: absolute;
  left: 24px;
  top: 50%;
  z-index: 20;
  width: 250px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.info-bubble:hover .tooltip,
.info-bubble:focus .tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.unit {
  color: var(--muted);
}

.range-text {
  grid-column: 2 / 4;
  justify-self: start;
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.74rem;
}

label + label,
.field + label {
  margin-top: 10px;
}

input[type="number"],
select {
  width: 92px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 6px;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

select {
  width: 148px;
  grid-column: 2 / 4;
}

input[type="range"] {
  width: 118px;
  accent-color: var(--accent);
}

.range-field input[type="range"] {
  grid-column: 2;
  width: 100%;
  min-width: 0;
}

.range-field strong {
  min-width: 72px;
  color: var(--accent);
  font-size: 0.82rem;
  text-align: right;
}

.field.range-field {
  grid-template-columns: minmax(0, 1fr) minmax(132px, 168px) 78px;
  column-gap: 14px;
}

.segmented {
  grid-column: 2 / 4;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segmented button,
.icon-button {
  border: 0;
  min-height: 38px;
  background: var(--field);
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.segmented button.active,
.icon-button.active {
  background: var(--accent);
  color: #fff;
}

.check {
  grid-template-columns: auto 1fr;
  justify-content: start;
}

.check input {
  accent-color: var(--accent);
}

.model-stage {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #f8faf9;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.canvas-toolbar {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

#braceViewport {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  background:
    linear-gradient(#dfe7e5 1px, transparent 1px),
    linear-gradient(90deg, #dfe7e5 1px, transparent 1px),
    #f8faf9;
  background-size: 32px 32px;
}

.home-preview-inputs {
  display: none;
}

.site-disclaimer {
  padding: 10px 18px 14px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
}

#braceViewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.viewport-status {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 2;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 0.82rem;
  pointer-events: none;
}

.spec-panel dl {
  margin: 0;
}

.spec-panel dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.landing-page {
  background: #eaf0ee;
}

.landing-shell {
  min-height: 100vh;
  display: grid;
  align-content: start;
  gap: 24px;
  padding: 24px 28px 28px;
}

.brand-link,
.nav-config-link {
  pointer-events: auto;
  text-decoration: none;
  font-weight: 900;
}

.nav-links {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links a {
  font-weight: 850;
  text-decoration: none;
}

.compact-link {
  min-height: 42px;
  padding: 0 16px;
}

.brand-link {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.82rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 36px;
  height: 42px;
  object-fit: contain;
  object-position: center;
  flex: 0 0 auto;
}

.nav-config-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff !important;
  border: 1px solid #0f3d2e;
  box-shadow: var(--shadow);
}

.landing-hero {
  min-height: min(720px, calc(100vh - 112px));
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(320px, 1.08fr);
  gap: 34px;
  align-items: center;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.landing-copy {
  max-width: 620px;
}

.hero-logo {
  display: block;
  width: clamp(112px, 16vw, 176px);
  height: auto;
  margin-bottom: 22px;
  object-fit: contain;
  object-position: center;
}

.landing-copy h1 {
  max-width: 650px;
  font-size: clamp(2.4rem, 5.4vw, 5.25rem);
  line-height: 0.96;
  margin-bottom: 22px;
}

.landing-lede {
  max-width: 560px;
  color: #425350;
  font-size: clamp(1rem, 1.5vw, 1.24rem);
  line-height: 1.55;
  margin-bottom: 28px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 6px;
  font-weight: 850;
  text-decoration: none;
}

.primary-link {
  background: var(--accent);
  color: #fff;
  border: 1px solid #0f3d2e;
}

.secondary-link {
  color: var(--ink);
  border: 1px solid rgba(180, 135, 62, 0.62);
  background: rgba(255, 255, 255, 0.68);
}

.landing-visual {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
  overflow: visible;
  background: transparent;
}

.landing-visual #braceViewport {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 520px;
  background: transparent;
}

.landing-visual #braceViewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.preview-status {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 2;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 0.82rem;
  pointer-events: none;
}

.landing-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  max-width: 1180px;
  width: 100%;
  margin: -82px auto 0;
  border: 1px solid var(--line);
  background: var(--line);
  box-shadow: var(--shadow);
}

.landing-band div {
  min-height: 142px;
  padding: 20px;
  background: #fff;
}

.landing-band span {
  display: block;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 900;
  margin-bottom: 12px;
}

.landing-band h2 {
  margin-bottom: 8px;
}

.landing-band p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.export-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid #0f3d2e;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.export-button.secondary {
  background: #f8faf9;
  color: var(--accent);
  border-color: rgba(180, 135, 62, 0.72);
}

.export-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.export-note a {
  color: var(--accent);
  font-weight: 850;
}

.spec-panel select {
  width: min(100%, 170px);
  min-height: 38px;
  grid-column: auto;
}

.material-row dt {
  display: grid;
  align-content: center;
}

.info-page {
  background: #eaf0ee;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #fff;
  border-bottom: 1px solid #bfcfcb;
  box-shadow: 0 12px 30px rgba(28, 43, 42, 0.12);
}

.site-header-inner {
  max-width: 1180px;
  min-height: 72px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.info-shell {
  min-height: 100vh;
  padding: 24px 28px 36px;
}

.info-content {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.info-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  align-items: stretch;
  gap: 16px;
}

.info-hero > div {
  padding: 24px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  align-content: center;
}

.info-hero h1 {
  max-width: 680px;
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 1.04;
  margin-bottom: 14px;
}

.info-hero p {
  max-width: 720px;
  color: #425350;
  font-size: 1.02rem;
  line-height: 1.55;
  margin-bottom: 0;
}

.info-summary {
  border: 1px solid var(--line);
  background: var(--line);
  box-shadow: var(--shadow);
  display: flex;
}

.info-summary dl {
  margin: 0;
  width: 100%;
  display: grid;
  gap: 1px;
}

.info-summary div {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px 16px;
  border: 0;
  background: #f8faf9;
}

.info-summary dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.info-summary dd {
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
  text-align: left;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.info-grid article {
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.info-grid h2 {
  font-size: 0.96rem;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.info-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.info-grid li + li {
  margin-top: 7px;
}

@media (max-width: 1050px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .content-grid {
    grid-template-columns: minmax(260px, 340px) 1fr;
  }

  .spec-panel {
    grid-column: 1 / -1;
  }
}

@media (max-height: 760px) and (min-width: 761px) {
  .landing-shell {
    align-content: start;
  }

  .landing-hero {
    min-height: auto;
    padding-top: 18px;
  }

  .landing-copy h1 {
    font-size: clamp(2.2rem, 4.7vw, 4.35rem);
  }

  .landing-band {
    margin-top: 0;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .workspace {
    min-height: calc(100vh - 24px);
  }

  .content-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .model-stage,
  #braceViewport {
    min-height: 430px;
    height: auto;
  }

  .landing-shell {
    padding: 16px 16px 16px;
    align-content: start;
  }

  .landing-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .landing-visual,
  .landing-visual #braceViewport {
    min-height: 360px;
  }

  .landing-band {
    grid-template-columns: 1fr;
    margin-top: 0;
  }

  .nav-links {
    width: 100%;
    justify-content: stretch;
  }

  .nav-links a {
    flex: 1;
  }

  .info-shell {
    padding: 16px 16px 20px;
  }

  .site-header-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
  }

  .info-hero {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}
