:root {
  --paper: #f6f3ec;
  --ink: #1d1b17;
  --mute: #5b574e;
  --line: #1d1b17;
  --safelight: #c8321e;
  --amber: #b8780a;
  --sheet: #ffffff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  word-break: keep-all; overflow-wrap: break-word;
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.65 "IBM Plex Sans KR", sans-serif; letter-spacing: -0.005em;
}
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--safelight); }
h1, h2, h3 { word-break: keep-all; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
h2 { font-size: 1.35rem; margin: 2.2rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .4rem; }
p { margin: .6rem 0; }

.top { border-bottom: 2px solid var(--ink); }
.top-in { max-width: 1120px; margin: 0 auto; padding: .7rem 1.2rem; display: flex; align-items: baseline; gap: 1.6rem; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.03em; }
.brand i { font-style: normal; color: var(--safelight); }
.top nav { display: flex; gap: 1.2rem; font-size: .92rem; }
.top nav a { text-decoration: none; }
.top nav a[aria-current] { border-bottom: 2px solid var(--safelight); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.2rem; }

/* 첫 화면: 왼쪽 설명·도해, 오른쪽 사진 놓는 틀 */
.first { display: grid; grid-template-columns: 1.15fr 1fr; grid-template-areas: "intro right" "more right"; column-gap: 3rem; padding: 2.6rem 0 2rem; align-items: start; }
.intro { grid-area: intro; }
.more { grid-area: more; }
.first .right { grid-area: right; }
.lede { font-size: 1.08rem; color: var(--ink); max-width: 34rem; }
.fact { margin: 1.4rem 0 0; padding: .7rem 0 .7rem 1rem; border-left: 4px solid var(--ink); font-weight: 700; max-width: 34rem; }
.fact small { display: block; font-weight: 400; color: var(--mute); font-size: .88rem; margin-top: .2rem; }
.diagram { margin: 1.6rem 0 0; max-width: 30rem; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram figcaption { font-size: .85rem; color: var(--mute); margin-top: .4rem; }

.drop {
  display: block; position: relative; border: 2px solid var(--ink); background: var(--sheet);
  padding: 1.4rem 1.2rem 1.2rem; cursor: pointer;
}
.drop.over { outline: 3px solid var(--safelight); outline-offset: 2px; }
.drop .frame { aspect-ratio: 35 / 45; max-width: 15rem; margin: 0 auto .9rem; border: 1px dashed var(--ink); display: flex; align-items: center; justify-content: center; text-align: center; font-size: .9rem; color: var(--mute); padding: 1rem; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pick { display: block; background: var(--ink); color: var(--paper); text-align: center; font-weight: 700; padding: .8rem 1rem; }
.drop:focus-within .pick { outline: 3px solid var(--safelight); outline-offset: 3px; }
.drop.has .frame, .drop.has .pick { display: none; }
.drop.has { padding: .6rem 1rem; }
.drop .again-txt { display: none; }
.drop.has .again-txt { display: block; font-size: .88rem; color: var(--mute); }
.tips { margin: .9rem 0 0; padding-left: 1.1rem; font-size: .88rem; color: var(--mute); }
.tips li { margin: .15rem 0; }
.dl-note { margin: .6rem 0 0; font-size: .85rem; color: var(--mute); }

#msg { min-height: 1.4rem; font-weight: 700; color: var(--safelight); margin: .6rem 0 0; }

/* 작업대 */
.work { border-top: 2px solid var(--ink); padding: 1.6rem 0 2.4rem; display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 2.4rem; }
.work[hidden] { display: none; }
.stage-box { position: sticky; top: .8rem; align-self: start; }
.stage-box canvas#stage { display: block; width: 100%; height: auto; background: #d9d5cc; border: 2px solid var(--ink); touch-action: none; cursor: grab; }
.stage-box canvas#stage:focus-visible { outline: 3px solid var(--safelight); outline-offset: 3px; }
.stage-note { font-size: .82rem; color: var(--mute); margin: .4rem 0 0; }
.pad { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .7rem; }
.pad button, .btn-s { font: inherit; font-size: .88rem; background: transparent; color: var(--ink); border: 1px solid var(--ink); padding: .35rem .7rem; cursor: pointer; border-radius: 0; }
.pad button:hover, .btn-s:hover { background: var(--ink); color: var(--paper); }

.panel h2:first-child { margin-top: 0; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin: .5rem 0; }
label { font-size: .9rem; font-weight: 700; }
select, input[type=number] { font: inherit; padding: .4rem .5rem; border: 1px solid var(--ink); background: var(--sheet); color: var(--ink); border-radius: 0; }
input[type=number] { width: 5.5rem; }
.custom[hidden] { display: none; }

.checks { list-style: none; padding: 0; margin: .5rem 0 0; }
.checks li { padding: .45rem .8rem; border-left: 5px solid var(--ink); background: var(--sheet); margin: .35rem 0; font-size: .92rem; }
.checks li b { margin-right: .3rem; }
.checks li.c-warn { border-left-color: var(--amber); }
.checks li.c-bad { border-left-color: var(--safelight); border-left-width: 9px; }
.checks li.c-wait { border-left-color: #b9b4a8; }

.save { margin-top: 1.2rem; display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.btn-main { font: inherit; font-weight: 700; background: var(--safelight); color: #fff; border: 0; padding: .85rem 1.3rem; cursor: pointer; border-radius: 0; font-size: 1.02rem; }
.btn-main:disabled { background: #b9b4a8; cursor: not-allowed; }
.btn-main:focus-visible, .btn-s:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.btn-alt { font: inherit; font-weight: 700; background: transparent; color: var(--ink); border: 2px solid var(--ink); padding: .75rem 1.1rem; cursor: pointer; border-radius: 0; }
.btn-alt:disabled { color: #8b877d; border-color: #b9b4a8; cursor: not-allowed; }
#save-note { font-size: .86rem; color: var(--safelight); margin: .4rem 0 0; }

.sheet-box { margin-top: 1.4rem; }
.sheet-box canvas { display: block; width: 100%; max-width: 560px; height: auto; background: #fff; border: 1px solid var(--ink); }
.sheet-box p { font-size: .82rem; color: var(--mute); margin: .35rem 0 0; }

/* 글 쪽 */
.doc { max-width: 46rem; padding: 2rem 0 3rem; }
.doc table { border-collapse: collapse; width: 100%; font-size: .93rem; margin: .8rem 0; }
.doc th, .doc td { border: 1px solid var(--ink); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.doc th { background: var(--ink); color: var(--paper); font-weight: 700; }
.doc th a { color: var(--paper); }
.doc th a:hover { color: #f0a090; }
.doc blockquote { margin: .6rem 0; padding: .3rem 0 .3rem 1rem; border-left: 4px solid var(--safelight); }
.doc .src { font-size: .85rem; color: var(--mute); }
.doc code { font-size: .88em; background: var(--sheet); padding: 0 .25em; border: 1px solid #d9d5cc; }

.foot { border-top: 2px solid var(--ink); margin-top: 2rem; font-size: .85rem; color: var(--mute); }
.foot .wrap { padding-top: 1rem; padding-bottom: 1.4rem; display: flex; gap: 1.2rem; flex-wrap: wrap; }
.notice { font-size: .85rem; color: var(--mute); max-width: 46rem; }

@media (max-width: 640px) {
  .doc table.spec, .doc table.spec tbody, .doc table.spec tr, .doc table.spec th, .doc table.spec td { display: block; width: 100%; }
  .doc table.spec tr:first-child { display: none; }
  .doc table.spec tr { border: 1px solid var(--ink); margin: .8rem 0; }
  .doc table.spec th { border: 0; }
  .doc table.spec td { border: 0; border-top: 1px solid #d9d5cc; }
  .doc table.spec td::before { content: attr(data-l); display: block; font-size: .8rem; font-weight: 700; color: var(--safelight); }
}
@media (max-width: 860px) {
  .first { grid-template-columns: 1fr; grid-template-areas: "intro" "right" "more"; row-gap: 1.4rem; padding-top: 1.6rem; }
  .work { grid-template-columns: 1fr; gap: 1.4rem; }
  .stage-box { position: static; }
  .stage-box canvas#stage { max-width: 340px; }
  .drop .frame { max-width: 9rem; }
}
