/* ==========================================================================
   canvas.css — 디자인 캔버스 (명세서 껍데기)
   헤더 · 범례 · 섹션 · 아트보드 · 기기 프레임 · 줌 툴바 · 프로토타입 뷰어
   화면 자체의 스타일은 screens.css (교체 대상 디자인) 에 있다
   ========================================================================== */

:root {
  --dc-bg: #e4e4e9;
  --dc-label: #1c1c1e;
  --dc-label-2: #6e6e73;
  --dc-fill: #eeeef0;
  --dc-fill-2: #e3e3e8;
  --dc-sep: #e5e5ea;
  --dc-blue: #0a7cff;
  --dc-blue-soft: #e6f1ff;
  --dc-font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.dc {
  font-family: var(--dc-font);
  color: var(--dc-label);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  background: var(--dc-bg);
}
:where(.dc) :where(button) { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
:where(.dc) :where(svg) { display: block; }

/* 캔버스용 아이콘 크기 (화면 내부 아이콘은 screens.css) */
.dc .ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dc .ic--sm { width: 14px; height: 14px; }
.dc .ic--md { width: 18px; height: 18px; }
.dc .ic--lg { width: 26px; height: 26px; }
.dc .ic--fill { fill: currentColor; stroke: none; }

/* ---------- 헤더 ---------- */
.dc-header {
  position: relative;
  z-index: 10;
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  background: rgba(228, 228, 233, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.dc-header__logo {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: #111; color: #fff;
  font-size: 12px; font-weight: 900; letter-spacing: -0.04em;
}
.dc-header__title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.dc-header__sub { font-size: 13px; color: var(--dc-label-2); }
.dc-header__nav { margin-left: auto; display: flex; gap: 6px; white-space: nowrap; }
.dc-header > div:nth-child(2) { min-width: 0; }
.dc-header__sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-header__nav a {
  padding: 7px 12px; border-radius: 999px;
  background: #fff; color: var(--dc-label);
  font-size: 13px; font-weight: 600; text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 1px 6px rgba(0,0,0,.06);
}
.dc-header__nav a:hover { background: #111; color: #fff; }
.dc-proto-btn {
  display: inline-flex; align-items: center; gap: 6px;
  flex: none; height: 34px; margin-left: 8px; padding: 0 16px 0 13px; white-space: nowrap;
  border-radius: 999px; background: var(--dc-blue); color: #fff !important;
  font-size: 13.5px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(10, 124, 255, 0.35);
}
.dc-proto-btn:hover { background: #0066d6; }

/* ---------- 범례 ---------- */
.dc-legend { display: flex; flex-wrap: wrap; gap: 18px; padding: 0 48px; font-size: 13px; color: var(--dc-label-2); }
.dc-legend__item { display: flex; align-items: center; gap: 6px; }

/* 노트 태그 : 근거 표시 */
.tag { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; margin-right: 3px; border-radius: 999px; font-size: 11px; font-weight: 700; vertical-align: 1px; white-space: nowrap; }
.tag--figma { background: #ede7ff; color: #6a3fe0; }
.tag--add { background: #e3f5e8; color: #1f8a46; }
.tag--ask { background: #fff0d6; color: #b86a00; }
.tag--req { background: #e6f1ff; color: #0a64d6; }

/* ---------- 섹션 · 아트보드 ---------- */
.dc-section { padding: 40px 0 24px; }
.dc-section__head { padding: 0 48px 20px; max-width: 1400px; }
.dc-section__title { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.dc-section__subtitle { margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: var(--dc-label-2); }
.dc-section__subtitle code, .dc-artboard__note code { padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,.85); font-size: 12px; color: var(--dc-label); }
.dc-section__row { display: flex; align-items: flex-start; gap: 24px; padding: 8px 48px 24px; }

.dc-artboard { flex: none; width: 413px; }
.dc-artboard__label { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.dc-artboard__num {
  display: grid; place-items: center; flex: none;
  min-width: 24px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: #111; color: #fff; font-size: 11.5px; font-weight: 700;
}
.dc-artboard__size { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.7); font-size: 11.5px; font-weight: 600; color: var(--dc-label-2); }
.dc-artboard__note {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12.5px; line-height: 1.6; color: var(--dc-label-2);
  max-width: 560px;
}
.dc-artboard__note b { color: var(--dc-label); }
.dc-artboard__note ul { margin: 6px 0 0; padding-left: 16px; }
.dc-artboard__note li + li { margin-top: 2px; }

.dc-flow { flex: none; align-self: center; margin-top: -80px; color: #9a9aa2; }

/* ---------- 기기 프레임 ---------- */
.device {
  position: relative;
  width: calc(var(--dw) + var(--bz) * 2);
  padding: var(--bz);
  background: #d9d9de;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 20px 50px rgba(0, 0, 0, 0.12);
}
.device__screen {
  position: relative;
  width: var(--dw);
  height: var(--dh);
  overflow: hidden;
  isolation: isolate;
  background: #fff;
  container: screen / size; /* 화면 내부 반응형 기준 (screens.css 의 @container screen) */
}
.device--phone { border-radius: 58px; }
.device--phone .device__screen { border-radius: 48px; --safe-t: 54px; --safe-b: 30px; }
.device--tablet { border-radius: 40px; background: #cfcfd5; }
.device--tablet .device__screen { border-radius: 22px; --safe-t: 24px; --safe-b: 18px; }
.device--monitor { border-radius: 14px; background: #1d1d20; }
.device--monitor .device__screen { border-radius: 4px; }
.device__stand { position: absolute; left: 50%; top: 100%; width: 22%; height: calc(var(--dh) * 0.12); transform: translateX(-50%); background: linear-gradient(#b9b9bf, #d4d4d9); clip-path: polygon(30% 0, 70% 0, 82% 88%, 100% 88%, 100% 100%, 0 100%, 0 88%, 18% 88%); }
.device--monitor { margin-bottom: calc(var(--dh) * 0.12); }

.device__status {
  position: absolute; top: 0; left: 0; right: 0; z-index: 50;
  height: 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 6px 30px 0 44px; font-size: 16px; font-weight: 600; color: #111;
  pointer-events: none;
}
.device__status-icons { display: flex; align-items: center; gap: 6px; }
.device__status .ic { width: 18px; height: 18px; }
.device__island { position: absolute; top: 11px; left: 50%; z-index: 60; width: 124px; height: 36px; margin-left: -62px; border-radius: 20px; background: #000; }
.device__home { position: absolute; bottom: 8px; left: 50%; z-index: 60; width: 140px; height: 5px; margin-left: -70px; border-radius: 3px; background: #111; }
.device__camera { position: absolute; top: 8px; left: 50%; z-index: 60; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: #2a2a2e; }
/* 어두운 화면 위 상태바 */
.device__screen:has(.scr--dark) .device__status { color: #fff; }
.device__screen:has(.scr--dark) .device__home { background: #fff; }
.theme-dark .device__screen:not(:has(.scr--soft)) .device__status { color: #fff; }
.theme-dark .device__screen:not(:has(.scr--soft)) .device__home { background: #fff; }

/* ---------- 줌 · 팬 캔버스 ---------- */
body.dc--canvas { height: 100vh; overflow: hidden; display: flex; flex-direction: column; user-select: none; }
.dc-viewport {
  position: relative; flex: 1; min-height: 0; overflow: hidden; cursor: grab; touch-action: none;
  background-color: var(--dc-bg);
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.13) 1px, transparent 1.2px);
  background-size: 24px 24px;
}
.dc-viewport.is-panning { cursor: grabbing; }
.dc-world { position: absolute; top: 0; left: 0; width: max-content; padding: 40px 0 80px; transform-origin: 0 0; }

.dc-zoom {
  position: absolute; right: 20px; bottom: 20px; z-index: 20;
  display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0,0,0,.12); font-size: 13px; font-weight: 600;
}
.dc-zoom button { display: grid; place-items: center; min-width: 34px; height: 32px; padding: 0 10px; border-radius: 8px; white-space: nowrap; }
.dc-zoom button:hover { background: var(--dc-fill); }
.dc-zoom__value { min-width: 58px !important; font-variant-numeric: tabular-nums; }
.dc-zoom__sep { width: 1px; height: 18px; margin: 0 4px; background: var(--dc-sep); }
.dc-help {
  position: absolute; left: 20px; bottom: 20px; z-index: 20;
  display: flex; gap: 14px; padding: 9px 14px; border-radius: 12px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(12px);
  box-shadow: 0 1px 6px rgba(0,0,0,.08); font-size: 12px; color: var(--dc-label-2);
}
.dc-help kbd, .proto__hint kbd {
  padding: 1px 6px; margin-right: 3px; border-radius: 5px; border: 1px solid var(--dc-sep);
  background: #fff; font-family: inherit; font-size: 11px; font-weight: 700; color: var(--dc-label);
}

/* ---------- 출력물 규격 (종이) ---------- */
.paper { position: relative; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.14); }
.paper__cell { position: absolute; top: 0; bottom: 0; overflow: hidden; }
.paper__cell svg { width: 100%; height: 100%; }
.paper__cut { position: absolute; top: -14px; bottom: -14px; left: 50%; border-left: 2px dashed #e0245e; }
.paper__safe { position: absolute; border: 1.5px dashed #0a7cff; pointer-events: none; }
.paper__dim { position: absolute; font-size: 12px; font-weight: 700; color: var(--dc-label-2); white-space: nowrap; }
.spec-table { border-collapse: collapse; font-size: 13px; background: rgba(255,255,255,.8); border-radius: 12px; overflow: hidden; }
.spec-table th, .spec-table td { padding: 9px 14px; border-bottom: 1px solid var(--dc-sep); text-align: left; vertical-align: top; }
.spec-table th { background: rgba(255,255,255,.9); font-weight: 700; white-space: nowrap; }

/* ==========================================================================
   프로토타입 뷰어 (prototype.js)
   ========================================================================== */
.proto {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; gap: 32px; padding: 24px;
  background: rgba(20, 22, 28, 0.84); backdrop-filter: blur(10px);
  font-family: var(--dc-font);
}
.proto[hidden] { display: none; }
.proto__device { position: relative; flex: none; }
.proto__device > .device { position: absolute; top: 0; left: 0; transform-origin: 0 0; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.proto__layer { position: absolute; inset: 0; }
.proto [data-go] { cursor: pointer; }
.proto--hotspots .proto__layer [data-go],
.proto--flash .proto__layer [data-go] {
  outline: 2.5px solid rgba(10, 124, 255, 0.9); outline-offset: 2px;
  box-shadow: inset 0 0 0 999px rgba(10, 124, 255, 0.12);
}
.proto--flash .proto__layer [data-go] { animation: proto-flash 0.7s ease-out; }
@keyframes proto-flash { 0% { outline-color: rgba(10,124,255,1); } 100% { outline-color: rgba(10,124,255,0); } }

.proto__panel {
  flex: none; width: 300px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; border-radius: 20px; background: #fff;
  box-shadow: 0 10px 40px rgba(0,0,0,.18); overflow: hidden; color: var(--dc-label);
}
.proto__panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px 18px; }
.proto__title { font-size: 17px; font-weight: 800; }
.proto__current { margin-top: 2px; font-size: 13px; color: var(--dc-label-2); }
.proto__close { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--dc-fill); }
.proto__controls { display: flex; gap: 6px; padding: 0 16px 10px; }
.proto__controls button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 34px; border-radius: 9px; background: var(--dc-fill); font-size: 13px; font-weight: 600; }
.proto__controls button:hover { background: var(--dc-fill-2); }
.proto__controls button.is-on { background: var(--dc-blue-soft); color: var(--dc-blue); }
.proto__controls button:disabled { opacity: .4; cursor: default; }
.proto__devices { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 16px 12px; }
.proto__devices button { height: 28px; padding: 0 9px; border-radius: 8px; background: var(--dc-fill); font-size: 12px; font-weight: 600; }
.proto__devices button.is-on { background: #111; color: #fff; }
.proto__section-title { padding: 8px 18px 4px; font-size: 11.5px; font-weight: 700; color: var(--dc-label-2); }
.proto__steps { flex: 1; overflow-y: auto; padding: 4px 10px 10px; border-top: 1px solid var(--dc-sep); }
.proto__group { padding: 10px 8px 4px; font-size: 11.5px; font-weight: 800; color: var(--dc-label-2); }
.proto__step { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 10px; font-size: 13.5px; text-align: left; }
.proto__step:hover { background: var(--dc-fill); }
.proto__step-num { display: grid; place-items: center; flex: none; min-width: 26px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--dc-fill-2); font-size: 11px; font-weight: 700; color: var(--dc-label-2); }
.proto__step.is-visited .proto__step-num { background: #c9ddf7; color: var(--dc-blue); }
.proto__step.is-current { background: var(--dc-blue-soft); font-weight: 700; color: var(--dc-blue); }
.proto__step.is-current .proto__step-num { background: var(--dc-blue); color: #fff; }
.proto__hint { padding: 12px 16px 14px; border-top: 1px solid var(--dc-sep); font-size: 12px; line-height: 1.6; color: var(--dc-label-2); }
body.is-proto-open { overflow: hidden; }

/* ---------- 기기 구역 (PC → iPad → iPhone) ---------- */
.dc-band { margin-top: 40px; padding-top: 48px; border-top: 3px solid rgba(0, 0, 0, 0.08); }
.dc-band__head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; padding: 0 48px 4px; }
.dc-band__name { font-size: 64px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.dc-band__badge { padding: 6px 14px; border-radius: 999px; background: #111; color: #fff; font-size: 15px; font-weight: 600; }
.dc-band__desc { flex-basis: 100%; margin: 6px 0 0; font-size: 16px; color: var(--dc-label-2); }
.dc-band .dc-section { padding-top: 32px; }
.dc-band .dc-section__title { font-size: 30px; }

/* ---------- 화면 테마 전환 (흑 = E 출력 PC · 백 = D 업로드 웹) ---------- */
.dc-theme { flex: none; display: inline-flex; padding: 3px; margin-left: 8px; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 1px 6px rgba(0,0,0,.06); }
.dc-theme button { height: 28px; min-width: 40px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--dc-label-2); }
.dc-theme button[aria-checked="true"] { background: #111; color: #fff; }
/* 출력 방식 전환 (헤더 · print.mode) */
html:not(.print-qr) .if-qr, html.print-qr .if-direct { display: none !important; }
html:not(.print-qr) .dc-section.is-qr-mode { opacity: .45; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
/* 3D 라벨은 캔버스에서 눌러도 이동하지 않음 (프로토타입에서만) */
.dc-world .f3l { cursor: default; }
/* 성능 : 캔버스(정지 화면)는 깜빡임 애니메이션 없음 · 프로토타입이 열리면 뒤 캔버스는 그리지 않음 (흐림 효과가 큰 캔버스를 매 프레임 다시 그림) */
.dc-world .f3l.is-pulse::after { animation: none; display: none; }
body.is-proto-open .dc-viewport { visibility: hidden; }
.proto { backdrop-filter: none; background: #15171c; }
