:root {
  --ink: #0d1718;
  --ink-soft: #172526;
  --paper: #f4f1e8;
  --surface: #fffdf7;
  --line: rgba(13, 23, 24, .16);
  --lime: #c9f269;
  --teal: #52d6c7;
  --red: #d54c3f;
  --muted: #61706d;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
code { font-family: var(--mono); }
[hidden] { display: none !important; }

main { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 70px 0 110px; }
.intro { max-width: 900px; }
.eyebrow, .tool-heading > div > p { margin: 0 0 14px; color: #3a615c; font-family: var(--mono); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.intro h1 { margin: 0 0 20px; font-size: clamp(45px, 6vw, 82px); line-height: 1.02; letter-spacing: -.058em; }
.intro > p:last-child { color: var(--muted); font-size: 18px; }

.tool-tabs { margin: 62px 0 70px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.tool-tabs button { min-height: 86px; padding: 18px 22px; display: flex; align-items: center; gap: 16px; color: var(--ink); background: transparent; border: 0; border-right: 1px solid var(--line); font-weight: 850; text-align: left; }
.tool-tabs button:last-child { border-right: 0; }
.tool-tabs button span { color: #698079; font-family: var(--mono); font-size: 11px; }
.tool-tabs button.active { color: var(--paper); background: var(--ink); }
.tool-tabs button.active span { color: var(--lime); }

.tool-heading { margin-bottom: 34px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 50px; align-items: end; }
.tool-heading h2 { max-width: 740px; margin: 0; font-size: clamp(34px, 4vw, 56px); line-height: 1.08; letter-spacing: -.045em; }
.tool-heading > p { margin: 0; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr); gap: 18px; }
.input-card, .result-card, .split-form, .table-card, .overlap-form, .overlap-result { border: 1px solid var(--line); border-radius: 18px; }
.input-card { min-height: 410px; padding: 28px; background: var(--ink-soft); color: var(--paper); }
.input-card label, .split-form label, .overlap-form label { display: flex; flex-direction: column; gap: 9px; font-size: 13px; font-weight: 800; }
.input-row { display: flex; gap: 8px; }
input { width: 100%; min-height: 52px; padding: 12px 14px; color: var(--ink); background: var(--surface); border: 1px solid #98a09b; border-radius: 9px; font-family: var(--mono); font-size: 16px; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.input-row button, .split-form > button, .overlap-form > button { min-height: 52px; padding: 12px 19px; color: var(--ink); background: var(--lime); border: 0; border-radius: 9px; font-weight: 900; white-space: nowrap; }
.hint { color: #8e9b98; font-size: 12px; }
.form-error { min-height: 24px; margin: 14px 0 0; color: #ff9d91; font-size: 13px; }

.result-card { padding: 28px; background: var(--surface); }
.result-head, .table-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 12px; }
.copy-button { min-height: 44px; padding: 9px 14px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; font-weight: 800; }
.hero-result { margin: 28px 0 32px; display: block; overflow-wrap: anywhere; font-family: var(--mono); font-size: clamp(30px, 5vw, 58px); line-height: 1; letter-spacing: -.05em; }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); }
.result-grid div { min-width: 0; padding: 18px 12px 18px 0; border-bottom: 1px solid var(--line); }
.result-grid span { display: block; color: var(--muted); font-size: 11px; }
.result-grid b { display: block; overflow-wrap: anywhere; font-family: var(--mono); font-size: 14px; }
.result-note { margin: 22px 0 0; padding: 14px; color: #294844; background: #e5f4e7; border-radius: 9px; font-size: 13px; }

.guide { margin-top: 30px; padding: 34px; display: grid; grid-template-columns: .65fr 1.35fr; gap: 50px; background: #e6e1d4; border-radius: 18px; }
.guide h3 { margin: 0; font-size: 23px; }
.guide > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.guide p { margin: 0; color: var(--muted); font-size: 14px; }
.guide strong { display: block; color: var(--ink); }

.split-form, .overlap-form { padding: 24px; display: grid; grid-template-columns: 1.3fr .7fr auto; gap: 16px; align-items: end; background: var(--ink-soft); color: var(--paper); }
.prefix-input { display: flex; align-items: center; color: var(--lime); font-family: var(--mono); font-size: 22px; }
.prefix-input input { margin-left: 8px; }
.split-form .form-error, .overlap-form .form-error { grid-column: 1 / -1; margin: 0; }
.table-card { margin-top: 18px; overflow: hidden; background: var(--surface); }
.table-head { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.table-head div { display: flex; flex-direction: column; }
.table-head strong { color: var(--ink); font-size: 18px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { color: var(--muted); background: #f0ede4; font-size: 11px; }
td code { padding: 5px 8px; color: #075d58; background: #e0f2e9; border-radius: 5px; font-weight: 800; }

.overlap-form { grid-template-columns: 1fr auto 1fr auto; }
.overlap-form > span { padding-bottom: 12px; color: var(--teal); font-size: 24px; }
.overlap-result { margin-top: 18px; padding: clamp(28px, 5vw, 60px); display: flex; align-items: center; gap: 28px; background: var(--surface); }
.status-mark { width: 74px; height: 74px; flex: 0 0 auto; display: grid; place-items: center; background: #dfe6df; border-radius: 50%; font-size: 38px; font-weight: 900; }
.overlap-result p { margin: 0; color: var(--muted); font-size: 13px; }
.overlap-result h3 { margin: 5px 0 11px; font-size: clamp(22px, 3vw, 36px); letter-spacing: -.03em; }
.overlap-result code { overflow-wrap: anywhere; color: var(--muted); }
.overlap-result.is-overlap .status-mark { color: #7b1e19; background: #ffd9d3; }
.overlap-result.is-clear .status-mark { color: #0b625a; background: #d3f4e6; }

.toast { position: fixed; right: 22px; bottom: 22px; padding: 13px 18px; color: var(--paper); background: var(--ink); border-radius: 9px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: 160ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
footer { padding: 28px clamp(18px, 4vw, 64px); display: flex; justify-content: space-between; gap: 30px; color: #899693; background: var(--ink); font-size: 12px; }
footer p { margin: 0; }
footer nav { display: flex; gap: 20px; }

@media (max-width: 850px) {
  .tool-heading, .workspace, .guide { grid-template-columns: 1fr; }
  .guide > div { grid-template-columns: 1fr; }
  .split-form, .overlap-form { grid-template-columns: 1fr; }
  .overlap-form > span { display: none; }
  .split-form .form-error, .overlap-form .form-error { grid-column: auto; }
}

@media (max-width: 600px) {
  main { width: min(100% - 28px, 1240px); padding-top: 48px; }
  .tool-tabs { margin: 44px 0 54px; }
  .tool-tabs button { min-height: 74px; padding: 12px 9px; align-items: flex-start; flex-direction: column; gap: 2px; font-size: 12px; }
  .tool-heading { gap: 18px; }
  .input-card, .result-card { padding: 20px; }
  .input-card { min-height: auto; }
  .input-row { flex-direction: column; }
  .result-grid { grid-template-columns: 1fr; }
  .overlap-result { align-items: flex-start; flex-direction: column; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
