:root {
  color-scheme: light;
  font-family:
    Pretendard,
    "Noto Sans KR",
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #17221d;
  background: #edf2ed;
  font-synthesis: none;
  --green-950: #10251b;
  --green-800: #1e4934;
  --green-700: #286446;
  --green-600: #347c58;
  --green-100: #dfede4;
  --green-50: #f1f7f3;
  --line: #d7dfd9;
  --muted: #66746b;
  --paper: #fbfcfa;
  --warning: #a94b31;
  --shadow: 0 12px 36px rgb(27 51 38 / 8%);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 50% -10%, rgb(255 255 255 / 95%), transparent 38rem), #edf2ed;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #8ccba7;
  outline-offset: 2px;
}

.app-header {
  min-height: 72px;
  padding: 12px clamp(16px, 2.6vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgb(30 73 52 / 10%);
  background: rgb(251 252 250 / 88%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: var(--green-800);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 20px rgb(30 73 52 / 24%);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green-800);
  font-size: 0.76rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #49a871;
  box-shadow: 0 0 0 5px rgb(73 168 113 / 12%);
}

.workspace {
  max-width: 1920px;
  min-height: calc(100vh - 112px);
  margin: 0 auto;
  padding: clamp(14px, 1.6vw, 26px);
  display: grid;
  grid-template-columns: minmax(276px, 0.82fr) minmax(520px, 2fr) minmax(270px, 0.78fr);
  gap: clamp(12px, 1.25vw, 20px);
}

.panel {
  border: 1px solid rgb(30 73 52 / 11%);
  border-radius: 22px;
  background: rgb(251 252 250 / 94%);
  box-shadow: var(--shadow);
}

.input-panel,
.output-panel {
  padding: clamp(18px, 1.5vw, 26px);
  align-self: start;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green-600);
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.14em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  color: var(--green-950);
  font-size: clamp(1.14rem, 1.3vw, 1.35rem);
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 12px;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
}

.text-button {
  padding: 6px 2px;
  border: 0;
  color: var(--green-700);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 750;
  cursor: pointer;
}

.panel-intro {
  margin: 16px 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.preset-row {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}

.chip,
.icon-button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
}

.chip:hover,
.icon-button:hover,
.chip.is-active,
.icon-button.is-active {
  border-color: #82ad93;
  color: var(--green-800);
  background: var(--green-100);
}

fieldset {
  margin: 0;
  padding: 17px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

fieldset:last-child {
  padding-bottom: 0;
}

legend {
  width: 100%;
  margin-bottom: 12px;
  color: var(--green-950);
  font-size: 0.78rem;
  font-weight: 800;
}

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 10px;
  margin-top: 13px;
}

.field:first-of-type {
  margin-top: 0;
}

.field label span,
.field label small {
  display: block;
}

.field label span {
  font-size: 0.8rem;
  font-weight: 700;
}

.field label small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.64rem;
}

.number-control {
  width: 112px;
  height: 38px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.number-control:focus-within {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgb(52 124 88 / 10%);
}

.number-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--green-950);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 750;
}

.number-control span {
  color: #879289;
  font-size: 0.61rem;
}

.range-control {
  grid-column: 1 / -1;
  width: 100%;
  height: 4px;
  margin: 2px 0 0;
  accent-color: var(--green-600);
  cursor: pointer;
}

.compact-field {
  margin-top: 10px;
}

.model-column {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: clamp(12px, 1.25vw, 20px);
}

.model-panel,
.section-panel {
  min-width: 0;
  overflow: hidden;
}

.model-heading,
.section-panel > .panel-heading {
  min-height: 70px;
  padding: 18px 22px 14px;
}

.view-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.icon-button {
  min-height: 31px;
  padding: 6px 10px;
}

.canvas-host {
  position: relative;
  min-height: 320px;
  height: clamp(360px, calc(56vh - 70px), 620px);
  overflow: hidden;
  border-top: 1px solid var(--line);
  background:
    radial-gradient(circle at 62% 28%, rgb(255 255 255 / 94%), transparent 22rem),
    linear-gradient(155deg, #f0f4ef 0%, #dfe9e1 100%);
}

#model-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.axis-guide {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  gap: 5px;
  pointer-events: none;
}

.axis-guide span {
  padding: 5px 7px;
  border: 1px solid rgb(30 73 52 / 10%);
  border-radius: 7px;
  background: rgb(255 255 255 / 78%);
  font-size: 0.61rem;
  font-weight: 750;
}

.axis-x {
  color: #b14e3d;
}

.axis-y {
  color: #31764f;
}

.axis-z {
  color: #3c6098;
}

.mouse-help {
  position: absolute;
  right: 16px;
  bottom: 14px;
  margin: 0;
  color: #607068;
  font-size: 0.64rem;
  pointer-events: none;
}

.section-panel > .panel-heading {
  align-items: center;
}

.section-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.69rem;
}

.section-canvas {
  min-height: 250px;
  height: clamp(280px, 38vh, 420px);
  padding: 4px 14px 14px;
  border-top: 1px solid var(--line);
  background-color: #f7faf7;
  background-image:
    linear-gradient(rgb(40 100 70 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(40 100 70 / 4%) 1px, transparent 1px);
  background-size: 20px 20px;
}

#section-svg {
  width: 100%;
  height: 100%;
  min-height: 250px;
  display: block;
}

.section-shape {
  fill: #bdc8c0;
  fill-rule: evenodd;
  stroke: #1e4934;
  stroke-linejoin: round;
  stroke-width: 3;
}

.section-centerline {
  stroke: #789081;
  stroke-dasharray: 8 7;
  stroke-width: 1;
}

.dimension-line,
.extension-line {
  fill: none;
  stroke: #347c58;
  stroke-width: 1.35;
}

.extension-line {
  stroke: #8ba697;
  stroke-dasharray: 3 3;
}

.dimension-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid #7da48d;
  border-radius: 6px;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 2px 7px rgb(23 34 29 / 12%);
}

.dimension-box input {
  width: 54px;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: #173d2a;
  background: transparent;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
}

.dimension-box span {
  color: #708078;
  font-size: 8px;
}

.dimension-label {
  fill: #315b43;
  font-size: 11px;
  font-weight: 750;
}

.output-panel {
  position: sticky;
  top: 16px;
}

.summary-card {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f5f8f5;
}

.summary-card dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.summary-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.summary-card dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.summary-card dd {
  margin: 0;
  color: var(--green-950);
  font-size: 0.73rem;
  font-weight: 800;
}

.validation-box {
  margin-top: 14px;
  padding: 14px 15px;
  border: 1px solid #b9d5c4;
  border-radius: 13px;
  color: #285d41;
  background: #edf7f0;
  font-size: 0.74rem;
  line-height: 1.5;
}

.validation-box.is-error {
  border-color: #e3b9ac;
  color: #883923;
  background: #fff3ef;
}

.validation-box ul {
  margin: 5px 0 0;
  padding-left: 17px;
}

.validation-box ul:empty {
  display: none;
}

.export-section {
  margin-top: 22px;
}

.export-coordinate-list {
  margin: 10px 0 12px;
  display: grid;
  gap: 7px;
}

.export-coordinate-list div {
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--green-50);
}

.export-coordinate-list dt {
  color: var(--green-800);
  font-size: 0.66rem;
  font-weight: 900;
}

.export-coordinate-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 700;
  text-align: right;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 54px;
  margin-top: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 12px;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--green-800);
  color: white;
  background: var(--green-800);
  box-shadow: 0 8px 20px rgb(30 73 52 / 18%);
}

.primary-button:hover {
  background: var(--green-700);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--green-950);
  background: white;
}

.secondary-button:hover {
  border-color: #8fb09b;
  background: var(--green-50);
}

.primary-button span,
.secondary-button span {
  font-size: 0.79rem;
  font-weight: 800;
}

.primary-button small,
.secondary-button small {
  color: inherit;
  font-size: 0.59rem;
  opacity: 0.72;
  text-align: right;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.scope-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.55;
}

.scope-note strong {
  display: block;
  margin-bottom: 5px;
  color: var(--green-950);
  font-size: 0.72rem;
}

.scope-note p {
  margin-bottom: 0;
}

footer {
  min-height: 40px;
  padding: 0 clamp(16px, 2.6vw, 40px) 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.65rem;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(250px, 0.75fr) minmax(480px, 1.6fr);
  }

  .output-panel {
    position: static;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  .output-panel > .panel-heading {
    grid-column: 1 / -1;
  }

  .summary-card,
  .validation-box,
  .export-section,
  .scope-note {
    margin-top: 0;
  }
}

@media (max-width: 820px) {
  .app-header {
    min-height: 64px;
  }

  .header-status {
    display: none;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .model-column {
    grid-row: 1;
  }

  .input-panel {
    grid-row: 2;
  }

  .output-panel {
    grid-row: 3;
    grid-column: auto;
  }

  .section-panel {
    min-height: 390px;
  }

  .section-canvas {
    height: 320px;
    overflow-x: auto;
  }

  #section-svg {
    min-width: 590px;
  }
}

@media (max-width: 580px) {
  .workspace {
    padding: 10px;
  }

  .panel {
    border-radius: 17px;
  }

  .model-column {
    grid-template-rows: auto auto;
  }

  .model-heading {
    min-height: 105px;
    flex-direction: column;
  }

  .canvas-host {
    height: 325px;
  }

  .section-panel > .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-hint,
  .mouse-help {
    display: none;
  }

  .output-panel {
    display: block;
  }

  .output-panel > * + * {
    margin-top: 16px;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
