:root {
  --ink: #17211a;
  --muted: #6d746e;
  --paper: #f4f1ea;
  --surface: #fffefa;
  --line: #d9d7cf;
  --green: #276447;
  --green-dark: #143b2a;
  --green-soft: #dce9df;
  --acid: #cadd88;
  --red: #a73e32;
  --red-soft: #f8e6e2;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.site-header { height: 76px; border-bottom: 1px solid var(--line); background: rgba(244, 241, 234, .92); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 20; }
.header-inner { max-width: 1440px; height: 100%; margin: 0 auto; padding: 0 42px; display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--ink); display: inline-flex; gap: 12px; align-items: center; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; color: var(--surface); background: var(--green); border-radius: 2px; }
.brand-mark svg { width: 22px; height: 22px; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1; gap: 4px; }
.brand strong { letter-spacing: -.04em; font-size: 18px; }
.brand small, .header-meta { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; }
.header-meta { display: flex; align-items: center; gap: 24px; }
.live-dot { display: inline-flex; align-items: center; gap: 8px; color: var(--green); }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(39,100,71,.1); }
.version-chip { border: 1px solid var(--line); padding: 8px 12px; background: rgba(255,255,255,.35); }

main { max-width: 1440px; margin: 0 auto; padding: 0 42px 72px; }
.hero { min-height: 330px; padding: 66px 0 52px; display: grid; grid-template-columns: 1.35fr .65fr; align-items: end; gap: 80px; }
.eyebrow, .panel-heading p, .result-top p, .rule-title small { margin: 0 0 13px; color: var(--green); font: 500 10px/1.2 var(--mono); letter-spacing: .11em; }
.hero h1 { margin: 0; font-size: clamp(40px, 4.4vw, 68px); letter-spacing: -.065em; line-height: 1.09; }
.hero h1 em { color: var(--green); font-style: normal; }
.hero-copy > p { margin: 0 0 32px; max-width: 490px; color: #525b54; font-size: 16px; line-height: 1.8; word-break: keep-all; }
.hero-stats { border-top: 1px solid var(--line); padding-top: 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hero-stats span { color: var(--muted); font-size: 10px; display: flex; flex-direction: column; gap: 3px; }
.hero-stats strong { color: var(--ink); font: 500 22px var(--mono); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(400px, .98fr); min-height: 870px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 60px rgba(32,42,34,.07); scroll-margin-top: 96px; }
.config-panel, .result-panel { padding: 38px 42px; }
.config-panel { border-right: 1px solid var(--line); }
.panel-heading, .result-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 40px; }
.panel-heading > div, .result-top { display: flex; gap: 15px; }
.panel-heading h2, .result-top h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.panel-heading p, .result-top p { margin-bottom: 5px; color: var(--muted); }
.step { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: white; display: grid; place-items: center; font: 500 11px var(--mono); }
.step.muted { background: #e4e3dc; color: #8b908b; }
.error-step { background: var(--red); }
.text-button { color: var(--muted); background: none; border: 0; padding: 5px 0; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; }
.text-button:hover { color: var(--green); }
.text-button svg { width: 14px; }

fieldset { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
.form-section { margin-bottom: 31px; }
.form-section legend, .form-section label > span:first-child { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 700; }
.form-section legend span, .form-section label > span small { color: #8d928d; font: 400 10px var(--mono); margin-left: 6px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-card { position: relative; min-height: 92px; padding: 17px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); background: #fbfaf6; cursor: pointer; transition: .18s ease; }
.choice-card:hover { border-color: #9fa8a1; transform: translateY(-1px); }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card:has(input:checked) { border-color: var(--green); background: #f6faf6; box-shadow: inset 0 0 0 1px var(--green); }
.choice-card > i { position: absolute; right: 10px; top: 10px; width: 17px; height: 17px; border-radius: 50%; color: white; background: var(--green); display: none; place-items: center; }
.choice-card > i svg { width: 11px; }
.choice-card:has(input:checked) > i { display: grid; }
.choice-card > span:nth-of-type(2) { display: flex; flex-direction: column; gap: 5px; }
.choice-card strong { font-size: 13px; }
.choice-card small { color: var(--muted); font: 400 10px var(--mono); }
.choice-visual { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--green); background: var(--green-soft); }
.choice-visual svg { width: 24px; }
.folding-shape { color: #806936; background: #eee8d7; }
.choice-grid.has-error .choice-card { border-color: var(--red); }

.dimension-grid { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 9px; }
.dimension-grid > span { color: #adb0ac; font: 400 15px var(--mono); padding-top: 20px; }
.dimension-grid label { color: var(--muted); font: 500 10px var(--mono); }
.dimension-grid input, .quantity-field input { width: 100%; margin-top: 8px; border: 1px solid var(--line); background: white; color: var(--ink); padding: 14px 12px; outline: none; font: 500 17px var(--mono); }
.dimension-grid input:focus, .quantity-field input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(39,100,71,.1); }
.dimension-grid label small { display: block; color: #9ca09c; margin-top: 5px; font-size: 8px; }
.split-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.select-field, .quantity-field { min-width: 0; }
.select-field select { width: 100%; appearance: none; border: 1px solid var(--line); padding: 14px 38px 14px 13px; color: var(--ink); background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%235a625c'%3E%3Cpath d='m2 4 4 4 4-4'/request-101/%3E%3C/svg%3E") no-repeat right 14px center; outline: none; font-size: 13px; }
.quantity-field > div { position: relative; }
.quantity-field input { margin: 0; padding-right: 42px; font-size: 14px; }
.quantity-field b { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 11px; }
.has-error input, .has-error select { border-color: var(--red) !important; }

.form-errors { margin-bottom: 14px; }
.form-errors:empty { display: none; }
.form-errors { border: 1px solid #e0ada5; background: var(--red-soft); padding: 13px 15px; }
.error-title { display: flex; justify-content: space-between; align-items: center; color: var(--red); font-size: 12px; font-weight: 700; }
.error-title b { font: 500 9px var(--mono); }
.form-errors ul { margin: 10px 0 0; padding: 10px 0 0; list-style: none; border-top: 1px solid #ecc8c2; }
.form-errors li { display: grid; grid-template-columns: auto 1fr; gap: 8px; font-size: 11px; line-height: 1.5; }
.form-errors li + li { margin-top: 6px; }
.form-errors code { color: var(--red); font: 500 9px var(--mono); }
.primary-button { width: 100%; border: 0; padding: 18px 20px; color: white; background: var(--green); display: flex; align-items: center; justify-content: space-between; font-weight: 700; transition: .18s ease; }
.primary-button:hover { background: var(--green-dark); }
.primary-button svg { width: 19px; }
.draft-status { margin: 10px 0 0; color: #929792; display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 9px; }
.draft-status svg { width: 12px; }
.draft-status.saved { color: var(--green); }

.result-panel { background: #f8f7f2; position: relative; }
.result-top { width: 100%; gap: 15px; align-items: flex-start; }
.result-top > div { flex: 1; }
.verified-badge { display: inline-flex; align-items: center; gap: 5px; color: var(--green); background: var(--green-soft); padding: 7px 9px; font: 500 9px var(--mono); }
.verified-badge svg { width: 12px; }
.empty-result { min-height: 630px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-box { position: relative; color: #b3b8b3; }
.empty-box > svg { width: 92px; height: 92px; stroke-width: .75; }
.empty-box i { position: absolute; border-radius: 50%; width: 6px; height: 6px; background: var(--acid); }
.empty-box i:first-of-type { top: 3px; left: 0; }.empty-box i:last-child { bottom: 8px; right: -10px; }
.empty-result h3 { margin: 24px 0 7px; font-size: 16px; }
.empty-result p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.result-foot { border-top: 1px solid var(--line); padding-top: 20px; display: flex; gap: 20px; color: #898e89; font: 400 9px var(--mono); }
.result-foot span { display: inline-flex; align-items: center; gap: 5px; }
.result-foot svg { width: 12px; }
.result-spec { margin: -8px 0 22px 48px; display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.result-spec strong { font-size: 13px; }
.result-spec span { color: var(--muted); border-left: 1px solid var(--line); padding-left: 11px; font: 400 10px var(--mono); }
.total-block { padding: 25px 27px; margin-bottom: 18px; color: white; background: var(--green-dark); position: relative; overflow: hidden; }
.total-block::after { content: ""; position: absolute; width: 170px; height: 170px; border: 1px solid rgba(202,221,136,.16); border-radius: 50%; right: -60px; top: -90px; box-shadow: 0 0 0 35px rgba(202,221,136,.04); }
.total-block small { display: block; color: #b8c5bc; margin-bottom: 7px; font-size: 11px; }
.total-block strong { display: block; color: white; font: 500 clamp(30px, 3vw, 42px) var(--mono); letter-spacing: -.07em; }
.total-block p { margin: 8px 0 0; color: var(--acid); font: 400 10px var(--mono); }
.calculation-list { border-top: 1px solid var(--line); }
.calc-row { min-height: 54px; padding: 10px 3px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.calc-row > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.calc-row span { font-size: 11px; font-weight: 600; }
.calc-row small { color: #878d88; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 8px var(--mono); }
.calc-row strong { flex: 0 0 auto; font: 500 12px var(--mono); }
.calc-row.discount strong { color: var(--green); }
.proof-details { border-bottom: 1px solid var(--line); }
.proof-details summary { list-style: none; padding: 16px 3px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 11px; font-weight: 700; }
.proof-details summary::-webkit-details-marker { display: none; }
.proof-details summary svg { width: 13px; transition: transform .2s; }
.proof-details[open] summary svg { transform: rotate(90deg); }
.proof-details > div { padding: 0 3px 12px; }
.proof-details p { margin: 0 0 7px; display: grid; grid-template-columns: 100px 1fr; color: var(--muted); font: 400 9px/1.5 var(--mono); }
.proof-details b { color: var(--ink); }
.result-notice { margin-top: 16px; padding: 13px; display: flex; gap: 9px; color: var(--muted); background: #edede7; }
.result-notice svg { flex: 0 0 auto; width: 14px; margin-top: 2px; }
.result-notice p { margin: 0; font-size: 9px; line-height: 1.6; }
.result-notice b { display: block; color: var(--ink); font: 500 9px var(--mono); }
.invalid-result { min-height: 450px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.invalid-result > span { width: 58px; height: 58px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: grid; place-items: center; }
.invalid-result svg { width: 25px; }
.invalid-result h3 { margin: 20px 0 8px; font-size: 16px; }
.invalid-result p { max-width: 360px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.blocked-proof { padding: 16px; display: flex; align-items: center; gap: 13px; background: #eee9e4; }
.blocked-proof small { margin-right: auto; color: var(--red); font: 500 9px var(--mono); }
.blocked-proof code { color: #656a66; font: 400 10px var(--mono); }

.rules-section { padding: 100px 0 40px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 32px; }
.section-heading h2 { margin: 0; font-size: clamp(27px, 3vw, 39px); letter-spacing: -.05em; }
.secondary-button { border: 1px solid var(--ink); padding: 12px 15px; display: inline-flex; align-items: center; gap: 10px; background: transparent; font-size: 11px; font-weight: 700; }
.secondary-button:hover { color: white; background: var(--ink); }
.secondary-button svg { width: 14px; }
.secondary-button.running svg { animation: spin .45s ease; }
@keyframes spin { to { transform: rotate(360deg); } }
.rules-layout { display: grid; grid-template-columns: .75fr 1.25fr; border: 1px solid var(--line); background: var(--surface); }
.rule-summary { padding: 30px; border-right: 1px solid var(--line); }
.rule-title { display: flex; gap: 12px; align-items: center; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.rule-title > span { width: 38px; height: 38px; display: grid; place-items: center; color: var(--green); background: var(--green-soft); }
.rule-title > span svg { width: 19px; }
.rule-title div { display: flex; flex-direction: column; }
.rule-title small { margin: 0 0 3px; }
.rule-title strong { font: 500 13px var(--mono); }
.rule-summary dl { margin: 10px 0 20px; }
.rule-summary dl div { padding: 12px 0; display: grid; grid-template-columns: 92px 1fr; border-bottom: 1px solid #e7e5de; font-size: 10px; }
.rule-summary dt { color: var(--muted); }.rule-summary dd { margin: 0; font-weight: 600; }
.rule-summary > p { margin: 0; display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 9px; line-height: 1.6; }
.rule-summary > p svg { flex: 0 0 auto; width: 13px; }
.fixture-board { min-width: 0; }
.fixture-head, .fixture-row { display: grid; grid-template-columns: 130px 1fr 115px 90px; gap: 15px; align-items: center; }
.fixture-head { height: 45px; padding: 0 20px; border-bottom: 1px solid var(--line); color: #8d918d; font: 400 8px var(--mono); letter-spacing: .08em; }
.fixture-row { width: 100%; min-height: 71px; padding: 11px 20px; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line); text-align: left; transition: background .15s; }
.fixture-row:hover { background: #f5f6f0; }
.fixture-row:last-child { border-bottom: 0; }
.fixture-row code { color: var(--green); font: 500 9px var(--mono); }
.fixture-row > span { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fixture-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.fixture-row small { color: var(--muted); font-size: 9px; }
.fixture-row > strong { font: 500 10px var(--mono); }
.fixture-row em { justify-self: end; display: inline-flex; align-items: center; gap: 4px; font: normal 500 9px var(--mono); }
.fixture-row em svg { width: 11px; }
.fixture-row em.pass { color: var(--green); }.fixture-row em.fail { color: var(--red); }

footer { max-width: 1440px; margin: 0 auto; padding: 25px 42px 38px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: #898e89; font: 400 9px var(--mono); }

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; gap: 34px; }
  .hero-copy > p { max-width: 680px; }
  .workspace { grid-template-columns: 1fr; }
  .config-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .empty-result { min-height: 420px; }
  .rules-layout { grid-template-columns: 1fr; }
  .rule-summary { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 700px) {
  .site-header { height: 64px; }
  .header-inner, main { padding-left: 18px; padding-right: 18px; }
  .header-meta .live-dot { display: none; }
  .version-chip { padding: 7px; font-size: 8px; }
  .hero { min-height: 0; padding: 47px 0 38px; }
  .hero h1 { font-size: 39px; }
  .workspace { margin-left: -18px; margin-right: -18px; border-left: 0; border-right: 0; }
  .config-panel, .result-panel { padding: 30px 20px; }
  .choice-grid, .split-fields { grid-template-columns: 1fr; }
  .dimension-grid { gap: 5px; }
  .panel-heading, .result-top { margin-bottom: 30px; }
  .result-spec { margin-left: 0; }
  .rules-section { padding-top: 70px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .fixture-head { display: none; }
  .fixture-row { grid-template-columns: 1fr auto; gap: 5px 15px; padding: 15px; }
  .fixture-row code { grid-column: 1; }
  .fixture-row > span { grid-column: 1; }
  .fixture-row > strong { grid-column: 2; grid-row: 1; }
  .fixture-row em { grid-column: 2; grid-row: 2; }
  footer { padding-left: 18px; padding-right: 18px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
