:root {
  --desk: #e6e2d8;
  --desk-2: #d8d3c6;
  --paper: #f4f0e6;
  --ink: #23302d;
  --label: #5d7a72;
  --cover: #123631;
  --pw: min(420px, calc((100vw - 96px) / 2), calc((100svh - 150px) / 1.42));
  --ph: calc(var(--pw) * 1.42);
  --sans: "Pretendard Variable", Pretendard, system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --serif: "Noto Serif KR", serif;
  --foil: linear-gradient(100deg, #6f6316 0%, #beaf2e 25%, #e9de8a 45%, #fbf5cf 50%, #c9ba3c 58%, #857818 80%, #beaf2e 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --desk: #1a1c1b; --desk-2: #101211; }
}
:root[data-theme="dark"] { --desk: #1a1c1b; --desk-2: #101211; }

* { box-sizing: border-box; }
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
body {
  margin: 0; min-height: 100svh; font-family: var(--sans); color: var(--ink);
  background: radial-gradient(ellipse at 50% 40%, var(--desk), var(--desk-2)) fixed, var(--desk);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow-x: hidden; -webkit-font-smoothing: antialiased; transition: background .4s;
}
body.uv-on { background: radial-gradient(ellipse at 50% 40%, #1c1233, #07040f) fixed, #07040f; }
button { font: inherit; }

/* ── 책 ───────────────────────────────────────────── */
.stage { display: grid; place-items: center; padding: 32px 16px 12px; }
.book {
  position: relative; width: calc(var(--pw) * 2); height: var(--ph);
  perspective: 2600px; transition: transform .9s cubic-bezier(.3,.7,.2,1);
}
.book[data-state="closed"] { transform: translateX(calc(var(--pw) * -.5)); }
.book[data-state="back"]   { transform: translateX(calc(var(--pw) * .5)); }
.leaf {
  position: absolute; top: 0; left: var(--pw); width: var(--pw); height: var(--ph);
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.3,.7,.2,1);
}
.leaf.flipped { transform: rotateY(-180deg); }
.face {
  position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  container-type: inline-size; cursor: pointer;
}
.front { border-radius: 2px 12px 12px 2px; box-shadow: 0 18px 40px rgba(0,0,0,.22), 0 2px 4px rgba(0,0,0,.12); }
.back  { border-radius: 12px 2px 2px 12px; transform: rotateY(180deg); box-shadow: 0 18px 40px rgba(0,0,0,.22), 0 2px 4px rgba(0,0,0,.12); }
/* 제본 쪽 그늘 */
.front .page:not(.cover)::after, .back .page:not(.cover)::after { content: ""; position: absolute; top: 0; bottom: 0; width: 9cqw; pointer-events: none; }
.front .page:not(.cover)::after { left: 0; background: linear-gradient(90deg, rgba(60,50,30,.22), transparent); }
.back .page:not(.cover)::after  { right: 0; background: linear-gradient(-90deg, rgba(60,50,30,.22), transparent); }

.book.flat { width: min(440px, calc(100vw - 32px)); height: auto; perspective: none; transform: none; display: grid; gap: 18px; }
.flat .face { position: relative; aspect-ratio: 1 / 1.42; border-radius: 12px; cursor: default; box-shadow: 0 12px 30px rgba(0,0,0,.2); }

/* ── 종이 ─────────────────────────────────────────── */
.page {
  position: absolute; inset: 0; padding: 8cqw 8cqw 10cqw;
  background: var(--g-page) center / 100% 100%, var(--paper);
  font-size: 3.4cqw; line-height: 1.55;
}
.page::before { /* 아래 가장자리 마이크로 문자 */
  content: var(--micro); position: absolute; left: 0; right: 0; bottom: 4.5cqw; overflow: hidden; white-space: nowrap;
  font: 700 1.2cqw/1 var(--mono); letter-spacing: .1em; color: #9ab3aa; opacity: .8;
}
.page.cover::before { display: none; }
.pno { position: absolute; bottom: 6cqw; font: 700 2.4cqw/1 var(--mono); color: var(--label); }
.front .pno { right: 7cqw; }
.data .pno { display: none; }
.back .pno, .flat .pno { left: 7cqw; }
.flat .pno { left: auto; right: 7cqw; }

.ph { margin: 0 0 6cqw; font: 700 4.6cqw/1.2 var(--serif); letter-spacing: .04em; }
.ph span { display: block; margin-top: 1.4cqw; font: 700 2.4cqw/1 var(--mono); letter-spacing: .2em; color: var(--label); }

/* 표지 */
.cover {
  display: flex; flex-direction: column; align-items: center; padding: 12cqw 8cqw;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.08), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--cover);
}
.foil, .foil-m { background: var(--foil); background-size: 260% 100%; background-position: calc(var(--hx, .5) * 100%) 0; }
.foil { color: transparent; -webkit-background-clip: text; background-clip: text; margin: 0; }
.foil-m { -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.cv-title { margin-top: 2cqw; font: 700 8cqw/1 var(--serif); letter-spacing: .32em; padding-left: .32em; }
.cv-ko  { margin-top: 3.4cqw; font: 700 8.4cqw/1.1 var(--serif); letter-spacing: .12em; padding-left: .12em; }
.emb  { --m: var(--emblem); width: 54cqw; aspect-ratio: 1; margin: auto 0; }
.cv-name { font: 700 4.2cqw/1 var(--serif); letter-spacing: .34em; padding-left: .34em; }
.chip { --m: var(--chip); width: 13cqw; aspect-ratio: 60 / 36; margin-top: 6cqw; }
.backc { justify-content: flex-end; gap: 6cqw; padding-bottom: 14cqw; }
.backc .chip { margin: 0; opacity: .7; }
.bc { font: 500 3cqw/1.7 var(--sans); text-align: center; }

/* 안쪽 표지와 추가 기재란 */
.req { margin: 0 0 4cqw; font: 500 3.7cqw/1.8 var(--serif); word-break: keep-all; }
.req.en { font: italic 400 3cqw/1.7 Georgia, serif; color: #4e605b; }
.howto { margin-top: 7cqw; padding: 4cqw 5cqw; border: 1px solid #b7c8c0; border-radius: 2cqw; background: rgba(255,255,255,.4); }
.howto b { font: 700 2.4cqw/1 var(--mono); letter-spacing: .2em; color: var(--label); }
.howto ul { margin: 2.4cqw 0 0; padding-left: 4cqw; font-size: 3.1cqw; }
.sign { position: absolute; left: 8cqw; right: 8cqw; bottom: 15cqw; border-top: 1px solid #9fb3ab; padding-top: 1.6cqw; }
.sign i { font: normal 2.2cqw/1 var(--sans); color: var(--label); }
.sign span { position: absolute; left: 10cqw; bottom: 3cqw; font: 11cqw/1 "Nanum Pen Script", cursive; color: #1d3f8c; transform: rotate(-6deg); }
.en-b { margin-bottom: 5cqw; padding-bottom: 4cqw; border-bottom: 1px dashed #b7c8c0; }
.en-b b { display: block; margin-bottom: 1.4cqw; font-size: 3.2cqw; }
.en-b p { margin: 0; font-size: 3.1cqw; color: #3d4e4a; word-break: keep-all; }
.en-b a { color: #1d4f9c; text-underline-offset: .3em; }
.seal {
  position: absolute; right: 9cqw; bottom: 15cqw; display: grid; place-items: center; width: 34cqw; padding: 3cqw 0;
  border: 2px solid #1d4f9c; border-radius: 2cqw; outline: 1px solid #1d4f9c; outline-offset: -2.4cqw;
  color: #1d4f9c; font-family: var(--mono); transform: rotate(-9deg); mix-blend-mode: multiply; filter: url(#ink); opacity: .85;
}
.seal span { font-size: 2.2cqw; letter-spacing: .2em; }
.seal b { font-size: 3.6cqw; letter-spacing: .08em; }

/* 인적사항 면 */
.data { background: var(--g-data) center / 100% 100%, #f6efe9; padding: 7cqw 7cqw 9cqw; }
.dh { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 2.4cqw; border-bottom: 1px solid #c7aab3; }
.dh b { font: 700 3.8cqw/1 var(--serif); letter-spacing: .1em; }
.dh span { font: 700 2.4cqw/1 var(--mono); letter-spacing: .24em; color: #8a6570; }
.data i { display: block; font: normal 1.9cqw/1.3 var(--sans); color: #7c6169; }
.data i em { font-style: normal; margin-left: .5em; opacity: .8; }
.data b { display: block; font: 700 3.1cqw/1.25 var(--mono); color: #1f2422; word-break: keep-all; }
.data b small { display: block; font: 500 2.4cqw/1.3 var(--sans); color: #5a4b4f; }
.d1 { display: grid; grid-template-columns: .6fr .8fr 1.6fr; gap: 3cqw; margin: 3cqw 0 3.4cqw; }
.dm { display: grid; grid-template-columns: 31cqw 1fr; gap: 4.4cqw; position: relative; }
.photo {
  position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 1cqw;
  background: #ddd6d0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 40'%3E%3Cg fill='%23a89f99'%3E%3Ccircle cx='15' cy='15' r='7'/%3E%3Cpath d='M1 40c0-9 6-14 14-14s14 5 14 14z'/%3E%3C/g%3E%3C/svg%3E") center bottom / 100% no-repeat;
}
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1) sepia(.15); }
/* 홀로그램: 보는 각도(마우스)에 따라 무지개가 흘러간다 */
.holo {
  position: absolute; inset: 0; mix-blend-mode: color-dodge; opacity: .55;
  background:
    repeating-linear-gradient(calc(100deg + var(--hx, .5) * 50deg), transparent 0 6%, rgba(255,120,220,.5) 9%, rgba(120,255,230,.5) 12%, rgba(255,245,140,.5) 15%, transparent 18% 24%);
  background-size: 200% 200%; background-position: calc(var(--hx, .5) * 100%) calc(var(--hy, .5) * 100%);
  -webkit-mask: var(--emblem) 0 0 / 46% repeat; mask: var(--emblem) 0 0 / 46% repeat;
}
.fields { margin: 0; display: grid; gap: 1.5cqw; }
.fields .two { display: grid; grid-template-columns: 1fr 1fr; gap: 2cqw; }
.fields .ko b { font-family: var(--serif); font-size: 3.4cqw; }
.ghost {
  position: absolute; right: 0; bottom: 0; width: 13cqw; aspect-ratio: 3 / 4; opacity: .16; filter: grayscale(1);
  background: inherit; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 40'%3E%3Cg fill='%23000'%3E%3Ccircle cx='15' cy='15' r='7'/%3E%3Cpath d='M1 40c0-9 6-14 14-14s14 5 14 14z'/%3E%3C/g%3E%3C/svg%3E") center bottom / 100% no-repeat;
}
.mrz {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3.6cqw 5cqw 5cqw;
  background: rgba(255,255,255,.55); border-top: 1px solid #e2d6d0;
  font: 400 3.25cqw/1.55 var(--mono); letter-spacing: 0; color: #1d1d1d; white-space: nowrap; overflow: hidden;
}

/* 사증 면 */
.visa { background: var(--g-visa) center / 100% 100%, #f1efe8; }
.vh { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 2cqw; border-bottom: 1px solid #c3bfd8; }
.vh b { font: 700 2.8cqw/1 var(--mono); letter-spacing: .18em; color: #6e6a92; }
.vh span { font: 700 2.4cqw/1 var(--mono); color: #6e6a92; }
.stamp {
  position: absolute; padding: 0; border: 0; background: none; cursor: pointer;
  transform: translate(-50%, -50%) rotate(var(--rot)); mix-blend-mode: multiply; opacity: .88;
  transition: transform .25s cubic-bezier(.3,1.6,.5,1), opacity .2s;
}
.stamp svg { display: block; width: 100%; height: auto; overflow: visible; }
.stamp:hover { transform: translate(-50%, -50%) rotate(calc(var(--rot) * .5)) scale(1.07); opacity: 1; }
.stamp:focus-visible { outline: 2px dashed #6e6a92; outline-offset: 4px; border-radius: 8px; }
.wip .stamp { opacity: .75; }

/* ── UV 램프 ───────────────────────────────────────── */
.uvl { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 4; transition: opacity .25s; }
body.uv-on .uvl { opacity: 1; }
/* 램프가 안 닿는 곳은 어둡게 */
.uvl::before {
  content: ""; position: absolute; inset: 0; background: rgba(8, 4, 20, .62);
  -webkit-mask: radial-gradient(circle 30cqw at var(--mx, -999px) var(--my, -999px), transparent 70%, #000 100%);
          mask: radial-gradient(circle 30cqw at var(--mx, -999px) var(--my, -999px), transparent 70%, #000 100%);
}
/* 램프가 닿는 곳만 보랏빛, 형광 잉크가 떠오른다 */
.uvc {
  position: absolute; inset: 0; background: radial-gradient(circle 30cqw at var(--mx, -999px) var(--my, -999px), rgba(46, 14, 96, .9), rgba(24, 8, 56, .94));
  -webkit-mask: radial-gradient(circle 30cqw at var(--mx, -999px) var(--my, -999px), #000 82%, transparent 100%);
          mask: radial-gradient(circle 30cqw at var(--mx, -999px) var(--my, -999px), #000 82%, transparent 100%);
}
body.uv-on .face { cursor: crosshair; }
@media (hover: none) { .uvl::before { display: none; } .uvc { -webkit-mask: none; mask: none; background: rgba(24, 8, 56, .9); } }
.fib { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 2px currentColor); }
.uvtag {
  position: absolute; width: 34cqw; transform: translate(-50%, -50%) rotate(var(--rot)); text-align: center;
  font: 700 3cqw/1.35 var(--sans); color: #7dffd4; text-shadow: 0 0 1.2cqw #2bffb8, 0 0 .3cqw #b5ffe9; word-break: keep-all;
}
.uvemb {
  position: absolute; left: 50%; top: 44%; width: 70cqw; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: #ff6ad5; opacity: .75; filter: drop-shadow(0 0 1cqw #ff6ad5);
  -webkit-mask: var(--emblem) center / contain no-repeat; mask: var(--emblem) center / contain no-repeat;
}
.uvnote { position: absolute; left: 0; right: 0; bottom: 18cqw; margin: 0; text-align: center; font: 700 2.6cqw/1 var(--mono); letter-spacing: .2em; color: #fff36b; text-shadow: 0 0 1cqw #fff36b; }

/* ── 아래 막대 ─────────────────────────────────────── */
.bar {
  display: flex; align-items: center; gap: 10px; margin-top: 22px; padding: 6px 8px; border-radius: 999px;
  background: rgba(255,255,255,.55); box-shadow: 0 4px 16px rgba(0,0,0,.08), inset 0 0 0 1px rgba(0,0,0,.06);
  backdrop-filter: blur(8px); transition: background .4s;
}
.bar button {
  border: 0; background: none; color: var(--ink); height: 34px; min-width: 34px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  font-size: 15px; font-weight: 600;
}
.bar button:hover:not(:disabled) { background: rgba(0,0,0,.06); }
.bar button:disabled { opacity: .3; cursor: default; }
.bar button:focus-visible { outline: 2px solid #5b3a9a; outline-offset: 1px; }
.pg { min-width: 92px; text-align: center; font: 700 13px/1 var(--mono); color: var(--label); }
.sep { width: 1px; height: 18px; background: rgba(0,0,0,.12); }
.uvbtn { display: inline-flex; align-items: center; gap: 8px; }
.uvbtn i { width: 10px; height: 10px; border-radius: 50%; background: #9a93b3; transition: .25s; }
.uvbtn[aria-pressed="true"] i { background: #b77dff; box-shadow: 0 0 10px 3px #8f4dff; }
body.uv-on .bar { background: rgba(40,24,80,.6); box-shadow: inset 0 0 0 1px rgba(183,125,255,.3); }
body.uv-on .bar button, body.uv-on .pg { color: #e3d6ff; }
.hint { margin: 12px 0 28px; font-size: 13px; color: #7d8a86; min-height: 1.4em; }
body.uv-on .hint { color: #b9a6e6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bar { background: rgba(40,44,42,.7); }
  :root:not([data-theme="light"]) .bar button, :root:not([data-theme="light"]) .pg { color: #d9e2de; }
}

/* ── 사증(상세) 창 ─────────────────────────────────── */
dialog.vdlg {
  width: min(780px, calc(100vw - 32px)); max-height: calc(100svh - 32px); padding: 0; border: 0; border-radius: 16px; overflow: auto;
  background: var(--g-visa) center / 100% 100%, #f4f1ea; color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.4);
  scrollbar-width: none;
}
dialog.vdlg::backdrop { background: rgba(12,14,13,.5); backdrop-filter: blur(3px); }
dialog.vdlg[open] { animation: pop .35s cubic-bezier(.2,1.3,.4,1); }
@keyframes pop { from { transform: translateY(14px) scale(.97); opacity: 0; } }
.vdlg .x { position: absolute; top: 10px; right: 12px; z-index: 2; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.8); font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink); }
.visa-in { display: grid; grid-template-columns: 1.15fr 1fr; }
.v-shot { padding: 18px; }
.v-shot img, .v-none { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 8px; background: #222; box-shadow: 0 0 0 6px #fff, 0 6px 18px rgba(0,0,0,.2); transform: rotate(-1.2deg); }
.v-none { display: grid; place-items: center; background: repeating-linear-gradient(45deg, #e5e1d6 0 10px, #ddd8cc 10px 20px); color: #8d8a80; font-weight: 700; }
.v-body { position: relative; padding: 26px 26px 22px 6px; }
.v-body header { display: flex; justify-content: space-between; font: 700 12px/1 var(--mono); letter-spacing: .18em; color: #6e6a92; padding-right: 36px; }
.v-body h2 { margin: 14px 0 8px; font: 700 28px/1.2 var(--serif); }
.v-desc { margin: 0 0 16px; font-size: 15px; line-height: 1.6; color: #3d4744; word-break: keep-all; }
.v-body dl { margin: 0 0 18px; display: grid; gap: 8px; }
.v-body dl div { display: grid; grid-template-columns: 64px 1fr; font-size: 14px; }
.v-body dt { color: var(--label); }
.v-body dd { margin: 0; font-weight: 600; }
.mono { font-family: var(--mono); letter-spacing: .1em; }
.go { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px; background: var(--cover); color: #ecdf8e; text-decoration: none; font-weight: 700; font-size: 15px; transition: transform .15s; }
.go span { font: 400 12px/1 var(--mono); opacity: .7; }
.go:hover { transform: translateY(-1px); }
.go.off { background: #c9c4b8; color: #6d6a62; }
.v-mrz { margin: 22px 0 0; font: 12px/1 var(--mono); color: #8b879f; white-space: nowrap; overflow: hidden; }

@media (max-width: 860px) {
  .stage { padding-top: 20px; }
  .bar #prev, .bar #next, .bar .pg, .bar .sep { display: none; }
  .bar { position: fixed; bottom: 16px; z-index: 10; margin: 0; }
  .hint { margin-bottom: 80px; }
  .visa-in { grid-template-columns: 1fr; }
  .v-body { padding: 4px 20px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .book, .leaf { transition-duration: .01s; }
}
.wm { position: absolute; inset: 0; display: grid; place-items: center; font: 700 16cqw/1 var(--mono); color: rgba(110,106,146,.08); letter-spacing: .1em; transform: rotate(-30deg); pointer-events: none; }

/* 이름이 곧 색: #BEAF2E 견본 */
.sw { display: inline-block; width: 2.6cqw; height: 2.6cqw; margin-right: 1.2cqw; vertical-align: -.3cqw; border-radius: .5cqw; background: #beaf2e; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
