/* 사각형 인쇄소 — 세 가지 색판(C·M·Y)이 겹쳐 찍히고, 판정은 먹(K)으로 찍는다 */
:root {
  --paper: #F2F1EC;
  --paper2: #E8E6DE;
  --k: #121316;
  --k2: #4A4B50;
  --k3: #8C8C90;
  --c: #00A3E0;
  --m: #E5007D;
  --y: #FFD100;
  --line: rgba(18, 19, 22, .14);
  --ok: #0A7D4F;
  --bad: #E5007D;
  --font: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--k); font-family: var(--font);
  overflow: hidden; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1;
}
button { font: inherit; color: inherit; cursor: pointer; }
#app { height: 100dvh; display: flex; flex-direction: column; position: relative; }

/* 재단선·맞춤표 */
.crop { position: absolute; width: 22px; height: 22px; pointer-events: none; }
.crop::before, .crop::after { content: ""; position: absolute; background: var(--k); }
.crop::before { width: 22px; height: 1px; top: 11px; }
.crop::after { width: 1px; height: 22px; left: 11px; }
.reg { position: absolute; width: 18px; height: 18px; border: 1px solid var(--k); border-radius: 50%; pointer-events: none; }
.reg::before, .reg::after { content: ""; position: absolute; background: var(--k); }
.reg::before { left: -5px; right: -5px; top: 8px; height: 1px; }
.reg::after { top: -5px; bottom: -5px; left: 8px; width: 1px; }

/* 윗줄 */
.top {
  flex: 0 0 auto; height: 60px; display: flex; align-items: center; gap: 18px;
  padding: 0 24px; border-bottom: 1.5px solid var(--k); background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; background: none; border: 0; padding: 0; }
.brand svg { width: 30px; height: 30px; }
.bar { display: flex; height: 14px; margin-left: 6px; }
.bar i { width: 14px; height: 14px; display: block; }
.top .gtitle { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.top .gno { font-weight: 800; font-size: 15px; color: var(--k3); }
.top .gname { font-weight: 800; font-size: 22px; letter-spacing: -.02em; white-space: nowrap; }
.top .by { font-size: 15px; color: var(--k2); white-space: nowrap; }
.top .sp { flex: 1; }
.tbtn {
  height: 40px; padding: 0 16px; border: 1.5px solid var(--k); background: var(--paper);
  font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; gap: 8px; position: relative;
}
.tbtn:hover { background: var(--k); color: var(--paper); }
.tbtn .dot { width: 8px; height: 8px; background: var(--m); border-radius: 50%; position: absolute; top: -4px; right: -4px; }
kbd {
  font-family: inherit; font-size: 12px; font-weight: 700; padding: 1px 6px; border: 1px solid currentColor; opacity: .7;
}

/* 버튼 */
.btn {
  height: 52px; padding: 0 26px; border: 0; background: var(--k); color: var(--paper);
  font-weight: 800; font-size: 19px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .08s, background .15s;
}
.btn:hover { background: var(--m); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--k); border: 1.5px solid var(--k); }
.btn.ghost:hover { background: var(--k); color: var(--paper); }
.btn:disabled { opacity: .35; pointer-events: none; }

/* 홈 */
.home { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: 22px 28px 26px; gap: 18px; position: relative; }
.hero { position: relative; display: flex; align-items: center; min-height: 0; overflow: hidden; }
.hero h1 { position: relative; z-index: 2; margin: 0; font-size: clamp(64px, 11.5vh, 132px); line-height: .92; font-weight: 900; letter-spacing: -.055em; }
.hero h1 span { display: block; }
.hero .sub { position: relative; z-index: 2; margin-left: 36px; font-size: clamp(17px, 2.2vh, 22px); line-height: 1.55; color: var(--k2); max-width: 520px; font-weight: 600; }
.hero .art { position: absolute; right: 0; top: 0; bottom: 0; width: 46%; z-index: 1; }
.hero .art svg { width: 100%; height: 100%; }
.ov { mix-blend-mode: multiply; }
.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.card {
  position: relative; text-align: left; border: 1.5px solid var(--k); background: var(--paper); padding: 16px 16px 14px;
  display: grid; grid-template-rows: auto 1fr auto; gap: 8px; height: clamp(196px, 31vh, 300px); overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.card:hover, .card:focus-visible { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--k); outline: none; }
.card .no { display: flex; justify-content: space-between; font-weight: 800; font-size: 15px; }
.card .thumb { min-height: 0; }
.card .thumb svg { width: 100%; height: 100%; }
.card .t { font-weight: 800; font-size: clamp(19px, 2.6vh, 24px); letter-spacing: -.03em; line-height: 1.2; }
.card .b { font-size: 15px; color: var(--k2); margin-top: 2px; }
.card .mk { opacity: 0; transition: opacity .25s; }
.card:hover .mk, .card:focus-visible .mk { opacity: 1; }

/* 게임 공통 */
.game { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.stage { flex: 1; min-height: 0; position: relative; }
.hud { display: flex; flex-direction: column; gap: 2px; }
.hud .l { font-size: 14px; font-weight: 700; color: var(--k2); letter-spacing: .02em; }
.hud .v { font-size: 34px; font-weight: 900; letter-spacing: -.03em; line-height: 1.05; }
.hud .v small { font-size: .5em; font-weight: 700; color: var(--k2); margin-left: 2px; }
.hearts { display: flex; gap: 6px; }
.hearts svg { width: 30px; height: 30px; }
.panel { border: 1.5px solid var(--k); background: var(--paper); position: relative; }
.ask {
  font-size: clamp(24px, 3.6vh, 34px); font-weight: 900; letter-spacing: -.035em;
}
.ask b { background: linear-gradient(transparent 58%, var(--y) 58%); }
.shake { animation: shake .32s; }
@keyframes shake { 20% { transform: translateX(-7px) } 40% { transform: translateX(6px) } 60% { transform: translateX(-4px) } 80% { transform: translateX(3px) } }
.mk { stroke-dasharray: 60; stroke-dashoffset: 60; animation: ink .45s .05s forwards; }
@keyframes ink { to { stroke-dashoffset: 0; } }
.shape { cursor: pointer; transition: transform .12s; transform-box: fill-box; transform-origin: center; }
.shape:hover { transform: scale(1.04); }
.shape .edge { fill: none; stroke: var(--k); stroke-width: 2; }
.shape.ok .edge { stroke-width: 3.2; }
.shape.no .edge { stroke: var(--bad); stroke-dasharray: 7 6; stroke-width: 2.5; }
.stamp { font-weight: 900; letter-spacing: -.03em; pointer-events: none; }

/* 결과 막 */
.overlay {
  position: absolute; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center;
  background: rgba(242, 241, 236, .82); backdrop-filter: blur(3px);
}
.overlay.on { display: flex; }
.overlay .box { position: relative; background: var(--paper); border: 2px solid var(--k); padding: 36px 48px 32px; min-width: 440px; max-width: 640px; text-align: center; box-shadow: 10px 10px 0 var(--k); }
.overlay h2 { margin: 0 0 6px; font-size: 64px; font-weight: 900; letter-spacing: -.05em; line-height: 1; }
.overlay .msg { font-size: 21px; color: var(--k2); margin: 12px 0 24px; line-height: 1.5; font-weight: 600; }
.overlay .acts { display: flex; gap: 12px; justify-content: center; }
.overlay .chip { position: absolute; top: -14px; left: 24px; display: flex; }
.overlay .chip i { width: 28px; height: 28px; display: block; mix-blend-mode: multiply; }
.overlay .chip i + i { margin-left: -10px; }

/* 시작 막 */
.intro .rules { text-align: left; font-size: 19px; line-height: 1.6; margin: 10px 0 24px; padding: 0; list-style: none; font-weight: 600; }
.intro .rules li { padding-left: 22px; position: relative; }
.intro .rules li::before { content: ""; position: absolute; left: 0; top: 11px; width: 10px; height: 10px; background: var(--k); }

/* 편지 */
.modal { position: absolute; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; background: rgba(18, 19, 22, .55); }
.modal.on { display: flex; }
.letter {
  position: relative; width: min(860px, 92vw); max-height: 88dvh; overflow: auto; background: #FBFAF6; color: #1A1B1E;
  padding: 40px 52px 34px; font-size: 19px; line-height: 1.75; box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.letter .to { font-weight: 800; font-size: 22px; margin: 0 0 10px; }
.letter p { margin: 0 0 12px; }
.letter .mine, .letter .hint { border-top: 1.5px solid #1A1B1E; padding-top: 12px; margin: 18px 0; }
.letter .mine ul { margin: 0; padding-left: 22px; }
.letter .hint .h { padding-left: 16px; border-left: 4px solid var(--m); }
.letter .from { text-align: right; font-weight: 700; margin-top: 18px; }
.letter .x { position: absolute; top: 14px; right: 16px; width: 40px; height: 40px; border: 1.5px solid #1A1B1E; background: none; font-size: 22px; line-height: 1; }
.letter .bar { position: absolute; top: 0; left: 0; right: 0; height: 8px; margin: 0; }
.letter .bar i { flex: 1; height: 8px; }

/* 크롬북 가로 화면 조정 */
@media (max-height: 700px) {
  .top { height: 54px; }
  .hud .v { font-size: 28px; }
  .btn { height: 46px; font-size: 17px; }
}

/* 인쇄판 맞춤: 처음에는 C·M·Y 판이 어긋나 있다가 제자리로 */
.plate { animation: plate 1.1s cubic-bezier(.2, .9, .25, 1) both; transform-box: fill-box; }
.plate.p1 { --dx: -38px; --dy: 14px; }
.plate.p2 { --dx: 30px; --dy: -22px; animation-delay: .08s; }
.plate.p3 { --dx: 12px; --dy: 30px; animation-delay: .16s; }
.plate.p4 { --dx: -14px; --dy: -18px; animation-delay: .24s; }
@keyframes plate { from { transform: translate(var(--dx), var(--dy)); opacity: .2; } to { transform: none; opacity: 1; } }
.hero h1 { animation: mis 1.2s cubic-bezier(.2, .9, .25, 1) both; }
@keyframes mis {
  from { text-shadow: -14px 6px 0 var(--c), 12px -5px 0 var(--m), 4px 12px 0 var(--y); }
  70% { text-shadow: -2px 1px 0 var(--c), 2px -1px 0 var(--m), 1px 2px 0 var(--y); }
  to { text-shadow: -3px 0 0 var(--c), 3px 0 0 var(--m), 0 3px 0 var(--y); }
}
.card .thumb .ov { transition: transform .3s; transform-box: fill-box; transform-origin: center; }
.card:hover .thumb .ov { transform: translate(-6px, 4px); }

/* 정답 도장 */
.stampg { animation: stamp .9s cubic-bezier(.2, 1.4, .4, 1) both; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.stampg rect { fill: rgba(242, 241, 236, .9); stroke: var(--k); stroke-width: 3; }
.stampg text { font-weight: 900; font-size: 22px; fill: var(--k); letter-spacing: -.03em; }
.stampg.no rect { stroke: var(--m); }
.stampg.no text { fill: var(--m); }
@keyframes stamp { 0% { transform: scale(2.2); opacity: 0; } 35% { transform: scale(.94); opacity: 1; } 55% { transform: scale(1); } 100% { opacity: 1; } }
