/* 노션 템플릿 무료 만들기. 쿨 뉴트럴 바탕 + 코발트 한 색. 상태는 선(왼쪽 굵은 선·밑줄)과 배경으로 읽힌다 */
:root {
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "D2Coding", "Noto Sans Mono", "Noto Sans KR", monospace;
  --bg: #f2f3f5; --paper: #fcfcfd; --sunk: #e9ebef; --ink: #1c1f24; --ink-2: #555b65; --line: #d8dce3; --line-2: #c3c8d1;
  --accent: #2550b8; --accent-ink: #f7f9ff; --accent-soft: #e5ecfb; --ok: #1f7a4d; --ok-soft: #e1f3e9; --warn: #a3471c;
  --r: 10px; color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #131519; --paper: #1b1e23; --sunk: #23272e; --ink: #e8eaee; --ink-2: #a7adb8; --line: #31353d; --line-2: #444a54;
    --accent: #7ea2ff; --accent-ink: #0d1530; --accent-soft: #1f2a47; --ok: #5fcf95; --ok-soft: #173326; --warn: #f0a07a; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.6; overflow-x: hidden; word-break: keep-all; overflow-wrap: anywhere; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--paper); padding: 8px; z-index: 9; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.hero { padding-top: 28px; padding-bottom: 6px; }
h1 { font-size: clamp(26px, 6.4vw, 40px); line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.02em; }
.lede { margin: 0; color: var(--ink-2); max-width: 44em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
code { font-family: var(--mono); font-size: .92em; background: var(--sunk); padding: 1px 5px; border-radius: 5px; }

.work { display: grid; gap: 16px; margin: 16px 0; }
.editor, .result, .guide { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.editor { padding: 4px 16px 16px; }
.block { border: 0; margin: 0; padding: 14px 0 0; min-width: 0; }
.block + .block { border-top: 1px solid var(--line); margin-top: 14px; }
legend, .legend { font-weight: 700; font-size: 15px; padding: 0; margin: 0 0 10px; }
.hint { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; min-width: 0; }
.field .sub { font-size: 12px; }
input, select, textarea, button { font: inherit; font-size: 16px; }
input, select, textarea { min-height: 44px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); color: var(--ink); width: 100%; min-width: 0; }
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible, .view:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 용도: 고른 칸은 왼쪽 굵은 선 + 옅은 코발트 바탕 */
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.preset { min-height: 48px; text-align: left; padding: 8px 10px 8px 12px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); cursor: pointer; line-height: 1.3; transition: background-color .15s, border-color .15s; }
.preset small { display: block; color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.preset:hover { border-left-color: var(--line-2); }
.preset[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); border-left-color: var(--accent); font-weight: 700; }

/* 칸 편집 줄: 이름 / 유형 / 지우기 */
.cols { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; counter-reset: col; }
.col { display: grid; grid-template-columns: 1.6em minmax(0, 1fr) 7.2em 44px; gap: 6px; align-items: center; counter-increment: col; }
.col::before { content: counter(col); color: var(--ink-2); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.col input.empty { border-color: var(--warn); border-style: dashed; }
.col select { padding-right: 4px; }
.icon-btn { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; font-size: 18px; line-height: 1; }
.icon-btn:hover:not(:disabled) { color: var(--warn); border-color: var(--warn); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

.btn { min-height: 48px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); font-weight: 700; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.line { border-style: dashed; width: 100%; color: var(--accent); }
.btn.done { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }

/* 결과: 위쪽 굵은 코발트 선이 「여기가 결과」 표시 */
.result { padding: 14px 16px 16px; border-top: 4px solid var(--accent); min-width: 0; }
.result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.result-head h2 { margin: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; padding: 8px 12px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; font-weight: 600; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.view { min-width: 0; }
.raw { font-family: var(--mono); font-size: 13px; white-space: pre; overflow: auto; background: var(--sunk); border-color: var(--line); }

/* 페이지 미리보기: 노션 페이지처럼 */
.page { padding: 6px 2px 4px; }
.pv-title { font-size: 26px; font-weight: 800; line-height: 1.25; margin: 4px 0 6px; letter-spacing: -0.01em; }
.pv-desc { color: var(--ink-2); margin: 0 0 14px; }
.pv-h { font-size: 17px; font-weight: 700; margin: 16px 0 6px; }
.pv-check { list-style: none; margin: 0; padding: 0; }
.pv-check li { display: flex; gap: 8px; align-items: flex-start; padding: 2px 0; }
.pv-check li::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 4px; border: 1.5px solid var(--ink-2); border-radius: 3px; }
.pv-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; -webkit-overflow-scrolling: touch; }
.pv-table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 14px; }
.pv-table th, .pv-table td { padding: 7px 10px; border-right: 1px solid var(--line); text-align: left; vertical-align: top; max-width: 16em; }
.pv-table th:last-child, .pv-table td:last-child { border-right: 0; }
.pv-table thead th { background: var(--sunk); font-weight: 700; border-bottom: 1px solid var(--line-2); }
.pv-table th span { display: block; font-weight: 400; font-size: 12px; color: var(--ink-2); }
.pv-table tbody tr + tr td { border-top: 1px solid var(--line); }
.pv-table td.blank { color: var(--ink-2); }
.pv-note { font-size: 12px; color: var(--ink-2); margin: 6px 0 0; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.actions .primary { grid-column: 1 / -1; }
.msg { min-height: 1.6em; margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.msg.ok { color: var(--ok); }
.msg.warn { color: var(--warn); }

.guide { padding: 16px; margin: 16px 0; }
.note { margin: 0 0 14px; padding: 10px 12px; background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; }
.route { padding: 12px 0 4px 14px; border-left: 2px solid var(--line-2); margin: 0 0 14px; }
.route ol { padding-left: 1.3em; margin: 0 0 8px; } .route li { margin: 4px 0; }
.route p { margin: 0 0 8px; }
.sub-note { font-size: 14px; color: var(--ink-2); }
.source { font-size: 13px; color: var(--ink-2); margin: 4px 0 22px; }
.source p { margin: 0; }
.source ul { list-style: none; margin: 0; padding: 0; }
.source a, .foot a { color: var(--accent); }
/* 링크 터치 높이 44px: 음수 margin 으로 면만 키우면 위아래 링크 면이 겹쳐 다른 링크가 열린다(바름 r2).
   출처 링크는 한 줄에 하나(목록), 푸터 링크는 줄 높이 자체를 44px 로 — 면이 서로 겹치지 않는다. */
.source a { display: flex; align-items: center; width: fit-content; max-width: 100%; min-height: 44px; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; }
details { border-top: 1px solid var(--line); padding: 4px 0; }
summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
details p { margin: 0 0 10px; color: var(--ink-2); }
.foot { padding-bottom: 32px; color: var(--ink-2); font-size: 14px; }

@media (min-width: 520px) {
  .actions { grid-template-columns: 1.3fr 1fr 1fr; }
  .actions .primary { grid-column: auto; }
}
@media (min-width: 600px) and (max-width: 1279px) {
  .presets { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .work, .guide { max-width: 860px; }
  .hero { max-width: 892px; }
  .work { margin-left: auto; margin-right: auto; }
  .guide { margin-left: auto; margin-right: auto; }
  .foot { max-width: 892px; }
}
@media (max-width: 1279px) {
  .guide { margin-left: auto; margin-right: auto; }
}
@media (min-width: 1280px) {
  .work { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .result { position: sticky; top: 16px; }
  .presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .raw { min-height: 420px; }
}
@media (max-width: 380px) {
  .col { grid-template-columns: 1.2em minmax(0, 1fr) 6.4em 44px; gap: 4px; }
  .btn { padding: 10px 10px; }
}
/* 좁은 화면 전용 아래 고정 링크(결과 칸이 보이면 숨김) */
.jump { display: none; }
@media (max-width: 1279px) {
  .jump { display: flex; align-items: center; justify-content: center; position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); min-height: 48px; max-width: 420px; margin: 0 auto;
    background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; border-radius: 8px; box-shadow: 0 6px 20px rgb(20 30 60 / .22); z-index: 5; transition: opacity .2s, transform .2s; }
  .jump.off { opacity: 0; transform: translateY(12px); pointer-events: none; }
  body { padding-bottom: 76px; }
  /* 포커스·앵커 스크롤이 고정 버튼(bottom 12 + 높이 48) 위에서 멈추게: 버튼 높이 + 위아래 여백 */
  html { scroll-padding-bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
