/* Shared presentation only. Calculation and persistence remain in each page. */
:root {
  color-scheme: light;
  --bg: #fbfcfe; --panel: #fff; --panel2: #f5f7fb;
  --text: #151e32; --muted: #60708a; --line: #dde4ef;
  --accent: #1260e8; --accent-hover: #094fc8; --accent-soft: #eef5ff;
  --good: #22724c; --good-bg: #e7f5ec; --bad: #b44343; --bad-bg: #fbecec;
  --r: 8px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131a25; --panel: #1a2331; --panel2: #202b3c;
  --text: #eef2fa; --muted: #a7b5cb; --line: #334157;
  --accent: #8bb5ff; --accent-hover: #b4cfff; --accent-soft: #203452;
  --good: #96d9b0; --good-bg: #223e33; --bad: #ffaaaa; --bad-bg: #452e37;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; line-height: 1.5; }
button, input, select { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent-hover); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
main { max-width: 1160px; margin: 52px auto 0; padding: 0 24px 38px; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.title h1 { margin: 0; font-size: clamp(28px, 3.7vw, 42px); font-weight: 750; letter-spacing: -.045em; line-height: 1.2; }
.title-sub { max-width: 720px; margin: 12px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.panel { min-width: 0; padding: 28px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.input-panel, .result-panel { display: flex; flex-direction: column; }
.card-heading { margin-bottom: 26px; }
.card-heading h2 { margin: 0; font-size: 21px; line-height: 1.3; letter-spacing: -.025em; font-weight: 750; }
.card-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.field { min-width: 0; }
label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.control { display: flex; min-width: 0; }
input, select { width: 100%; min-width: 0; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--text); font-size: 17px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; position: relative; z-index: 1; }
.control input { border-radius: 5px 0 0 5px; }
.unit { flex: 0 0 65px; display: flex; align-items: center; justify-content: center; margin-left: -1px; border: 1px solid var(--line); border-radius: 0 5px 5px 0; background: var(--panel2); color: var(--muted); font-size: 12px; font-weight: 500; }
.seg { display: grid; grid-template-columns: 1fr 1fr; min-height: 48px; border: 1px solid var(--line); border-radius: 5px; padding: 3px; gap: 3px; background: var(--panel2); }
.seg button { min-height: 42px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); font-size: 16px; font-weight: 600; }
.seg button.active { background: var(--accent); color: #fff; }
[data-theme="dark"] .seg button.active { background: #306dcc; color: #fff; }
.error { display: none; color: var(--bad); margin-top: 6px; font-size: 12px; line-height: 1.5; }
.field.invalid input { border-color: var(--bad); }
.field.invalid .error { display: block; }
.order-hint { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.quantity-surface { padding: 23px 22px; background: var(--accent-soft); border-radius: 6px; }
.kicker { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .045em; text-transform: uppercase; }
.quantity-line { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 9px; }
.qty { min-width: 0; max-width: 100%; flex: 1 1 auto; color: var(--accent); font-size: clamp(36px, 4.6vw, 58px); line-height: 1.15; font-weight: 750; letter-spacing: -.05em; overflow-wrap: anywhere; }
.qty:empty::before { content: '—'; }
.copy, .feedback-copy { min-height: 44px; border: 1px solid var(--line); border-radius: 5px; padding: 0 14px; background: var(--panel); color: var(--text); font-size: 13px; font-weight: 600; }
.copy { flex-shrink: 0; margin-left: auto; }
.copy:not(:disabled):hover, .feedback-copy:hover { border-color: var(--accent); }
.copy:disabled { opacity: .45; cursor: default; }
.qty-warning { display: none; margin-top: 14px; color: var(--bad); font-size: 12px; }
.qty-warning.show { display: block; }
.direction-row { margin: 22px 0 12px; min-height: 29px; }
.side { display: inline-flex; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; letter-spacing: .025em; }
.side:empty { display: none; }
.side.long { color: var(--good); background: var(--good-bg); }
.side.short { color: var(--bad); background: var(--bad-bg); }
.stats, .tp-stats { display: grid; grid-template-columns: minmax(0, 1fr); }
.stat, .tp-stat, .row { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; padding: 13px 0; font-size: 14px; }
.stat span, .tp-stat span, .row span { color: var(--muted); }
.stat strong, .tp-stat strong, .row strong { min-width: 0; max-width: 100%; margin-left: auto; text-align: right; overflow-wrap: anywhere; font-weight: 600; }
.tp-stats { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.tp-stats.show { display: grid; }
.tp-result-note { display: none; margin: 6px 0 24px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.tp-result-note.show { display: block; }
.accordion { margin-top: 28px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel2); }
.calculation-details { margin-top: auto; }
summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 15px 17px; list-style: none; font-size: 14px; font-weight: 600; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ''; flex-shrink: 0; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); }
details[open] > summary::after { transform: rotate(225deg); }
.detail-body { padding: 0 17px 18px; }
.adv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
.adv .field:last-child { grid-column: 1 / -1; }
.adv label { font-size: 12px; }
.adv input, .adv select { font-size: 16px; padding: 0 10px; }
.adv .unit { flex-basis: 34px; }
.rows { display: grid; grid-template-columns: minmax(0, 1fr); }
.row { padding: 10px 0; font-size: 12px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.note { margin: 15px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.fee-link { display: inline-block; padding: 10px 0 0; font-size: 12px; }
.learn-link { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 28px 0; font-size: 13px; color: var(--muted); }
.learn-link a { font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.learn-link a:hover { text-decoration: underline; }
.notice { display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; padding: 0 2px; }
.notice-mark { width: 20px; height: 20px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 12px; text-align: center; }
.notice-text { max-width: 900px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.notice-text strong { font-weight: 600; }
footer { max-width: 1160px; margin: 14px auto 0; padding: 0 24px 30px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 24px; padding-top: 28px; border-top: 1px solid var(--line); }
.footer-brand strong { font-size: 18px; letter-spacing: -.04em; }
.footer-brand p { font-size: 11px; color: var(--muted); margin: 6px 0 0; }
.feedback-contact { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; min-width: 0; font-size: 12px; }
.feedback-title { color: var(--muted); }
.feedback-email { grid-column: 1; overflow-wrap: anywhere; }
.feedback-copy { grid-column: 2; grid-row: 1 / 3; font-size: 12px; background: transparent; }
html[lang="ko"] .title, html[lang="ko"] .card-heading, html[lang="ko"] .notice-text { word-break: keep-all; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  main { margin-top: 30px; padding: 0 20px 30px; }
  .title-row { display: block; margin-bottom: 22px; }
  .title h1 { font-size: 32px; }
  .title-sub { font-size: 14px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .panel { padding: 22px; }
  .card-heading { margin-bottom: 22px; }
  .qty { font-size: clamp(36px, 9vw, 54px); }
  .quantity-surface { padding: 20px; }
  .calculation-details { margin-top: 24px; }
  .learn-link { margin: 18px 0; }
  footer { padding: 0 20px 28px; }
}
@media (max-width: 380px) {
  main { padding: 0 14px 28px; }
  .title h1 { font-size: 29px; }
  .panel { padding: 18px; }
  .quantity-surface { padding: 17px; }
  .qty { font-size: 36px; }
  .stat, .tp-stat { font-size: 13px; }
  .adv { grid-template-columns: minmax(0, 1fr); }
  footer { padding: 0 14px 28px; }
  .feedback-contact { column-gap: 8px; font-size: 11px; }
}
/* Reserve bottom space for hosting badges; do not cover them with a higher z-index. */
footer { padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px)); }
