/* 스프링 하중 계산기 — 화면 스타일. 색은 전부 토큰(:root)에서 가져오고, 어두운 테마는 토큰만 다시 정의한다.
 * 종류 그림(SVG)은 <img> 로 쓰므로 밝은 「제도지」 판(--plate) 위에 올린다 — 어두운 테마에서도 같은 판을 써서 그림이 항상 읽힌다. */
:root {
  --bg: #EEF2F7; --surface: #FFFFFF; --panel: #F5F8FC; --line: #D2DBE6; --line-strong: #AEBBCB;
  --ink: #13202F; --ink2: #52627A; --ink3: #5A6A7F;
  --accent: #1B4F8F; --accent-ink: #FFFFFF; --accent-soft: #DDE7F6;
  --cta: #B24A08; --cta-ink: #FFFFFF; --cta-soft: #FBEBDD;
  --warn-bg: #FBEACA; --warn-fg: #7A4707; --err-bg: #FBE3E0; --err-fg: #9A2418; --ok-fg: #17694B;
  --plate: #EDF1F6; --plate-line: #D2DBE6;
  --row-mark: #E6EFFB; --row-solid: #FBEFE3;
  --shadow: 0 1px 2px rgba(19, 32, 47, .06);
  --sans: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, Consolas, 'Malgun Gothic', monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C131C; --surface: #141E2B; --panel: #101926; --line: #27384C; --line-strong: #3A506A;
    --ink: #E4ECF6; --ink2: #93A5BB; --ink3: #7E91A8;
    --accent: #7DB1F2; --accent-ink: #0C131C; --accent-soft: #1B2D4A;
    --cta: #F0914A; --cta-ink: #1A0E04; --cta-soft: #33200F;
    --warn-bg: #3A2A0C; --warn-fg: #F0C06A; --err-bg: #3E1A16; --err-fg: #F4A49A; --ok-fg: #7FD6AE;
    --row-mark: #1B2D4A; --row-solid: #33200F;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C131C; --surface: #141E2B; --panel: #101926; --line: #27384C; --line-strong: #3A506A;
  --ink: #E4ECF6; --ink2: #93A5BB; --ink3: #7E91A8;
  --accent: #7DB1F2; --accent-ink: #0C131C; --accent-soft: #1B2D4A;
  --cta: #F0914A; --cta-ink: #1A0E04; --cta-soft: #33200F;
  --warn-bg: #3A2A0C; --warn-fg: #F0C06A; --err-bg: #3E1A16; --err-fg: #F4A49A; --ok-fg: #7FD6AE;
  --row-mark: #1B2D4A; --row-solid: #33200F;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); word-break: keep-all; overflow-wrap: break-word; }
input, select, textarea { word-break: normal; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 920px; margin-inline: auto; padding-inline: 16px; }
main.wrap { padding-block: 20px 40px; display: grid; gap: 18px; }

/* 상단 띠 — 글자만, 링크 없음 */
.brand { background: var(--surface); border-bottom: 1px solid var(--line); }
.brand .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding-block: 9px; font-size: 13px; color: var(--ink2); }
.brand .logo { font-weight: 800; color: var(--accent); letter-spacing: .02em; font-size: 15px; }

h1 { font-size: 26px; line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; }
.lead { color: var(--ink2); margin-top: 6px; max-width: 62ch; }
h2 { font-size: 17px; line-height: 1.3; display: flex; align-items: baseline; gap: 8px; }
h2 .n { font: 700 12px var(--mono); color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 99px; }

.card > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 14px; box-shadow: var(--shadow); min-width: 0; }
.note { color: var(--ink2); font-size: 13px; }
.hint { color: var(--ink3); font-size: 12.5px; line-height: 1.45; }

/* 메뉴(탭) — 네 칸을 같은 너비로 나눈다. 좁은 폰에서도 가로로 밀리지 않도록 글자는 줄바꿈을 허용한다. */
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.tab { min-height: 46px; padding: 4px 6px; border: 0; border-radius: 7px; background: transparent; color: var(--ink2); font-weight: 700; font-size: 14px; line-height: 1.25; text-align: center; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent), var(--shadow); }
.panel { display: grid; gap: 18px; min-width: 0; }
@media (min-width: 640px) { .panel { gap: 22px; } .tab { font-size: 15px; } }

/* 종류 고르기 */
.types { display: grid; gap: 18px; min-width: 0; }
.tgroup { display: grid; gap: 8px; min-width: 0; }
.tglabel { font-size: 13px; font-weight: 700; color: var(--ink2); letter-spacing: .01em; }
.tgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
@media (min-width: 640px) { .tgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
.picked { background: var(--accent-soft); border-radius: 8px; padding: 6px 12px; font-size: 14px; color: var(--ink); }
.dynform { display: grid; gap: 14px; min-width: 0; }
.dynform .fields { margin: 0; }
.dh { font-size: 15px; line-height: 1.3; padding-top: 4px; }
.tcard { display: grid; gap: 6px; align-content: start; text-align: left; background: var(--panel); border: 2px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; min-width: 0; }
.tcard:hover { border-color: var(--line-strong); }
.tcard[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.plate { background: var(--plate); border: 1px solid var(--plate-line); border-radius: 8px; padding: 4px; display: block; }
.plate img { display: block; width: 100%; height: auto; aspect-ratio: 200 / 140; }
.tname { font-weight: 700; }
.tsub { color: var(--ink2); font-size: 12.5px; line-height: 1.45; }
.soon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 10px; margin-top: 8px; }
.scard { display: grid; gap: 6px; align-content: start; font-size: 13px; color: var(--ink2); min-width: 0; }
.scard .plate { opacity: .88; }
.scard.on .plate { opacity: 1; }
.badge { display: inline-block; justify-self: start; font-size: 11.5px; font-weight: 700; color: var(--ink2); background: var(--panel); border: 1px solid var(--line); padding: 0 7px; border-radius: 99px; }
.badge.ok { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.gal-grid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); margin-top: 0; gap: 14px 12px; }
.gal-grid .scard .btn { justify-self: stretch; }
ul.plain { margin: 4px 0 0; padding-left: 1.2em; display: grid; gap: 4px; }

/* 입력 */
.fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px 14px; }
@media (min-width: 340px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .field.span2 { grid-column: span 2; } }
@media (min-width: 640px) { .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.field > label, .lab { font-weight: 600; font-size: 13.5px; }
.field .u { color: var(--ink3); font-weight: 400; margin-left: 4px; }
input[type="text"], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; font-size: 16px;
}
input[readonly] { background: var(--panel); color: var(--ink2); }
textarea { resize: vertical; line-height: 1.5; }
input.num { font-variant-numeric: tabular-nums; }
.xs-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: center; }
.xsec { width: 100%; max-width: 15rem; height: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.xsec .fill { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.6; }
.xsec .dim { stroke: var(--cta); stroke-width: 1.2; fill: none; }
.xsec .ax { stroke: var(--ink3); stroke-width: 1; stroke-dasharray: 4 4; }
.xsec text { fill: var(--ink2); font: 11px var(--sans); }
.xsec text.k { fill: var(--cta); font: 700 13px var(--mono); }
/* 가변 피치 구간 · 겹 스프링 입력 */
.zones, .nest { display: grid; gap: 10px; min-width: 0; }
.zones h3, .nest h3 { font-size: 15px; line-height: 1.3; }
.zones h3 .u { color: var(--ink3); font-weight: 400; font-size: 12.5px; }
.zrow { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.zhead { font-size: 12.5px; color: var(--ink2); font-weight: 600; }
.zl { font-weight: 600; font-size: 13.5px; }
.nest { gap: 12px; }
.nest .sub { display: grid; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; }
details.adv > summary { cursor: pointer; font-weight: 600; color: var(--ink2); padding: 4px 0; }
details.adv .fields { margin-top: 10px; }
.exnote { background: var(--accent-soft); color: var(--ink); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }

/* 결과 */
.kbig { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.kbig .lbl { color: var(--ink2); font-weight: 600; }
.kbig .val { font: 800 34px/1.1 var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.kbig .unit { font-weight: 700; color: var(--ink2); }
.kbig .alt { color: var(--ink2); font: 14px var(--mono); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 0 18px; margin: 0; }
.stats > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; padding: 7px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.stats dt { color: var(--ink2); }
.stats dd { margin: 0 0 0 auto; font: 600 14px var(--mono); font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.stats dd small { font: 12px var(--sans); color: var(--ink3); font-weight: 400; }
.stats .hl dd { color: var(--cta); }
.notice { border-radius: 8px; padding: 10px 12px; font-size: 14px; display: grid; gap: 4px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-fg); }
.notice.err { background: var(--err-bg); color: var(--err-fg); font-weight: 600; }
.notice.info { background: var(--accent-soft); color: var(--ink); }
.notice ul { margin: 0; padding-left: 1.2em; }
.disclaimer { font-size: 13px; color: var(--ink2); border-left: 3px solid var(--line-strong); padding-left: 10px; }

/* 하중표 */
.tabletop { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.tablewrap { overflow: auto; max-height: 24rem; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel); font-size: 12.5px; color: var(--ink2); z-index: 1; }
td { font: 14px var(--mono); }
th:last-child, td:last-child { text-align: left; font-family: var(--sans); }
tr.mk td { background: var(--row-mark); font-weight: 700; }
tr.solid td { background: var(--row-solid); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.sec { background: var(--surface); color: var(--accent); }
.btn.cta { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* 문의 카드 */
.cta-card { border-color: var(--cta); border-width: 1px 1px 1px 5px; }
.cta-card h2 .n { color: var(--cta); background: var(--cta-soft); }
.spec { font: 13.5px/1.55 var(--mono); background: var(--panel); }
.contact { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 10px; margin: 0; }
.contact > div { display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.contact dt { color: var(--ink2); font-size: 12.5px; }
.contact dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.contact .sel { font: 700 17px var(--mono); user-select: all; overflow-wrap: anywhere; }

/* 설치 안내(install.js 가 채움) */
.install { position: relative; padding-right: 52px; }
.install .ix { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--ink2); font-size: 24px; line-height: 1; cursor: pointer; border-radius: 8px; }
.install .it { display: block; }
.install .note { margin: 6px 0 0; }
.install .btn { justify-self: start; }

.basis-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 8px; font-size: 14px; color: var(--ink2); }
.basis-body code, .basis-body .eq { font: 13.5px var(--mono); color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.basis-body .eq { display: block; padding: 6px 10px; overflow-x: auto; }
.mat { width: auto; max-width: 100%; font-size: 13.5px; }
.mat td, .mat th { padding: 4px 10px; }
.mat td:first-child, .mat th:first-child { text-align: left; white-space: normal; }
.mat td:last-child, .mat th:last-child { text-align: right; font-family: var(--mono); }

footer { color: var(--ink3); font-size: 12.5px; padding-top: 4px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 600; font-size: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); z-index: 50; text-align: center; }

@media (min-width: 640px) {
  main.wrap { padding-block: 28px 56px; gap: 22px; }
  .card { padding: 20px 22px; }
  h1 { font-size: 32px; }
  .xs-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .tcard { transition: border-color .12s, background-color .12s; }
}
