/* Last Ten — 챕터 전용 퍼즐 스타일 */

/* 격자 겹쳐 보기 */
.modal-box.mask-puzzle { max-width: 900px; padding: 20px 22px 16px; }
.mask-stage { position: relative; margin: 0 auto; overflow: hidden; border-radius: 6px; background: #000; touch-action: none; }
.mask-content { position: absolute; left: 0; top: 0; }
.mask-content > img { position: absolute; left: 0; top: 0; }
.mask-content.monitor { background: linear-gradient(180deg, #121a3d, #0b1230); box-shadow: inset 0 0 80px rgba(0, 0, 0, .8); }
.mask-content.monitor::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 2px, transparent 2px 4px); pointer-events: none; }
.mask-text { position: absolute; left: 70px; top: 46px; color: #e9ecff; font-size: 17px; line-height: 1; text-align: left; }
.mask-text p { margin: 0 0 20px; white-space: nowrap; }
.mask-text p:first-child { margin-bottom: 30px; font-weight: 700; }
.mask-text .w { display: inline-block; }
.mask-sheet { position: absolute; cursor: grab; transform-origin: center center; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .6)); transition: filter .2s; }
.mask-sheet.dragging { cursor: grabbing; transition: none; filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .8)); }
.mask-cell { position: absolute; background: #050507; outline: 1px solid #2828c8; }
.mask-cell.hole { background: transparent; outline: 2px solid #ffe98a; box-shadow: inset 0 0 0 1px rgba(255, 233, 138, .3); }
.mask-sheet.aligned .mask-cell.hole { background: rgba(255, 233, 138, .12); box-shadow: 0 0 14px rgba(255, 233, 138, .8); animation: holeGlow 1.6s ease-in-out infinite; }
@keyframes holeGlow { 50% { box-shadow: 0 0 22px rgba(255, 233, 138, 1); } }
.mask-sheet.red .mask-cell { background: #6e0505; outline: 3px solid #111; }
.mask-sheet.red .mask-cell.hole { background: transparent; outline: 3px solid #111; box-shadow: inset 0 0 0 2px rgba(255, 120, 120, .5); }
.mask-sheet.red.aligned .mask-cell.hole { box-shadow: inset 0 0 0 3px rgba(255, 233, 138, .9), 0 0 16px rgba(255, 233, 138, .6); }
.mask-bar { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.mask-status { flex: 1; text-align: left; font-size: 13.5px; color: var(--muted); }

/* 토글 자물쇠 */
.tg-lock { display: inline-block; padding: 18px 22px; border-radius: 14px; background: linear-gradient(180deg, #5a4630, #3b2c1e); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .12), 0 10px 30px rgba(0, 0, 0, .5); }
.tg-grid { display: grid; gap: 10px; align-items: center; }
.tg-label { font: 700 15px var(--mono); color: #e9d6b0; text-align: center; }
.tg-cell { width: 64px; height: 50px; border-radius: 8px; background: linear-gradient(180deg, #f2efe8, #cfc9bd); box-shadow: 0 4px 0 #8c8475, inset 0 -2px 0 rgba(0, 0, 0, .1); transition: transform .08s, background .15s, box-shadow .08s; }
.tg-cell.on { background: linear-gradient(180deg, #6b6658, #4c483d); box-shadow: 0 1px 0 #2e2b24, inset 0 2px 6px rgba(0, 0, 0, .5); transform: translateY(3px); }

/* 방향 자물쇠 */
.modal-box.arrows { width: 460px; }
.ar-display { min-height: 52px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; padding: 8px 12px; margin-bottom: 16px; border-radius: 8px; background: #e9e7ef; color: #16141c; }
.ar-step { font: 700 26px var(--mono); }
.ar-empty { font-size: 13px; color: #77738a; }
.ar-body { display: flex; justify-content: center; align-items: center; gap: 36px; }
.ar-pad { position: relative; width: 130px; height: 130px; }
.ar-ring { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, #2a2838 0%, #17161f 70%); box-shadow: inset 0 4px 14px rgba(0, 0, 0, .7), 0 0 0 1px var(--line-2); }
.ar-knob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #c9c6d4, #6d6a7c 70%); box-shadow: 0 6px 14px rgba(0, 0, 0, .6); cursor: grab; touch-action: none; transition: transform .18s cubic-bezier(.3, 1.6, .5, 1); }
.ar-knob.hold { cursor: grabbing; transition: none; }
.ar-keys { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(2, 40px); gap: 4px; }
.ar-btn { border-radius: 8px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line-2); font-size: 18px; }
.ar-btn:hover { background: rgba(185, 168, 255, .2); }
.ar-btn.u { grid-column: 2; grid-row: 1; }
.ar-btn.l { grid-column: 1; grid-row: 2; }
.ar-btn.d { grid-column: 2; grid-row: 2; }
.ar-btn.r { grid-column: 3; grid-row: 2; }
.ar-clue { margin: 14px 0 0; font-size: 13px; color: var(--accent-2); }
.ar-clue::before { content: "단서  "; color: var(--dim); }

/* 격자 회전 연출 */
.mask-sheet.rotating { transition: transform .55s cubic-bezier(.3, 1.35, .45, 1), filter .2s; filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .85)); }

/* 그림 고리 자물쇠 (2장 옷장) */
.modal-box.ringlock { width: 520px; }
.rl-stage { display: flex; justify-content: center; padding: 40px 0 2px; }
.rl-lock { position: relative; width: 340px; padding-top: 74px; }
.rl-shackle { position: absolute; left: 50%; top: 4px; width: 168px; height: 124px; margin-left: -84px; border: 19px solid #c4c8ce; border-bottom: 0; border-radius: 84px 84px 0 0; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .55), 0 4px 8px rgba(0, 0, 0, .45); transform-origin: 9px 100%; transition: transform .5s cubic-bezier(.2, 1.5, .4, 1); }
.rl-lock.open .rl-shackle { transform: translateY(-40px) rotate(-14deg); }
.rl-lock.jam .rl-shackle { animation: rlJam .42s ease; }
@keyframes rlJam { 30% { transform: translateY(-7px); } 55% { transform: translateY(0); } 75% { transform: translateY(-3px); } }
.rl-body { position: relative; z-index: 1; padding: 30px 0 26px; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: linear-gradient(180deg, #ecca72 0%, #cf9f40 42%, #a8782a 100%); box-shadow: inset 0 3px 0 rgba(255, 244, 205, .65), inset 0 -7px 14px rgba(80, 48, 8, .5), 0 16px 34px rgba(0, 0, 0, .6); }
.rl-rivet { position: absolute; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4c8, #8a6220 70%); }
.rl-rivet.l { left: 18px; } .rl-rivet.r { right: 18px; }
.rl-wheels { display: flex; align-items: flex-start; gap: 6px; }
.rl-col { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 7px 7px 0; border-radius: 10px; background: #2a1d0c; box-shadow: inset 0 3px 9px rgba(0, 0, 0, .75), 0 1px 0 rgba(255, 240, 200, .45); }
.rl-arrow { width: 22px; height: 106px; display: grid; place-items: center; font: 700 22px var(--font); color: #6b4a16; text-shadow: 0 1px 0 rgba(255, 240, 200, .55); }
.rl-next { width: 64px; height: 26px; margin-bottom: 7px; border-radius: 6px; border: 0; font-size: 11px; color: #3a2a12; background: linear-gradient(180deg, #f0d07c, #c3923a); box-shadow: inset 0 1px 0 rgba(255, 248, 220, .8), 0 2px 0 #6e4e1a; }
.rl-next:hover { filter: brightness(1.08); }
.rl-next:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 248, 220, .8), 0 0 0 #6e4e1a; }
.rl-wheel { position: relative; width: 64px; height: 92px; overflow: hidden; border-radius: 6px; background: linear-gradient(180deg, #120c05 0%, #5e4420 50%, #120c05 100%); }
.rl-wheel::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0, 0, 0, .7), transparent 32%, transparent 68%, rgba(0, 0, 0, .7)), linear-gradient(90deg, rgba(0, 0, 0, .35), transparent 20%, transparent 80%, rgba(0, 0, 0, .35)); }
.rl-wheel.cursor { box-shadow: 0 0 0 2px rgba(255, 217, 138, .75); }
.rl-strip { position: absolute; left: 0; right: 0; top: -100%; height: 300%; display: flex; flex-direction: column; transition: transform .24s cubic-bezier(.2, .8, .3, 1); }
.rl-sym { flex: 1; display: grid; place-items: center; }
.rl-sym svg { width: 40px; height: 40px; fill: none; stroke: #f2d388; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .4; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .9)); }
.rl-sym.cur svg { opacity: 1; }

/* 4장 벽 포스터 — 성공을 위한 습관 4가지 */
.habit-poster { position: relative; width: 540px; height: 560px; margin: 0 auto; padding: 30px 32px 28px; background: radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, .5), transparent 60%), repeating-linear-gradient(0deg, rgba(120, 100, 70, .035) 0 2px, transparent 2px 5px), #f1e9d8; color: #3b342c; border-radius: 3px; box-shadow: 0 20px 50px rgba(0, 0, 0, .65); transform: rotate(-1deg); }
.hp-tape { position: absolute; top: -12px; width: 96px; height: 28px; background: rgba(236, 224, 196, .78); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.hp-tape.l { left: 26px; transform: rotate(-8deg); }
.hp-tape.r { right: 26px; transform: rotate(7deg); }
.hp-title { margin: 0 0 20px; text-align: center; font: 600 26px var(--serif); letter-spacing: .04em; }
.hp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hp-card { position: relative; height: 210px; padding: 16px 12px 12px; display: flex; flex-direction: column; align-items: center; background: #fbf7ee; border-radius: 6px; box-shadow: 0 2px 6px rgba(60, 40, 10, .18); border-top: 7px solid var(--c); }
.hp-no { position: absolute; left: 10px; top: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font: 700 15px var(--font); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.hp-art { width: 168px; height: 104px; }
.hp-art svg { width: 100%; height: 100%; }
.hp-text { margin: 8px 0 0; text-align: center; font-size: 15.5px; font-weight: 500; line-height: 1.45; white-space: pre-line; word-break: keep-all; }

/* 4장 옷장 — 문에 걸린 색 버튼 잠금장치 (진행 칸에 물건 그림) */
.modal-box.keypad { width: 900px; height: 600px; padding: 0; border: 0; border-radius: 4px; overflow: hidden; min-width: 0; max-width: none; max-height: none; background: #02030a; }
.modal-box.keypad .modal-body { position: absolute; inset: 0; display: grid; place-items: center; background: #02030a center / cover no-repeat; }
.kp-device { position: relative; width: 244px; margin-top: -60px; padding: 16px 18px 14px; border-radius: 18px; background: linear-gradient(160deg, #3c3f48, #1b1d23); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .13), 0 0 0 1px rgba(0, 0, 0, .6), 0 22px 46px rgba(0, 0, 0, .8); }
.kp-device.bad { animation: shake 420ms; }
/* 닫기는 장면 오른쪽 위가 아니라 잠금장치에 */
.modal-box.keypad > .modal-x { display: none; }
.kp-x { position: absolute; right: -14px; top: -14px; width: 30px; height: 30px; z-index: 1; border-radius: 50%; background: #1b1d23; border: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 4px 10px rgba(0, 0, 0, .6); }
.kp-lamps { display: flex; justify-content: space-between; margin-bottom: 15px; }
.kp-lamps i { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: #0e1015; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .85), 0 1px 0 rgba(255, 255, 255, .06); transition: background .2s, box-shadow .2s; }
.kp-lamps svg { width: 23px; height: 23px; fill: none; stroke: #69707e; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s, filter .2s; }
.kp-lamps i.on { background: #0f2a20; box-shadow: inset 0 0 0 1px rgba(125, 240, 176, .55), 0 0 12px rgba(125, 240, 176, .35); }
.kp-lamps i.on svg { stroke: #a6f7cb; filter: drop-shadow(0 0 4px rgba(125, 240, 176, .8)); }
.kp-device.bad .kp-lamps i.on { background: #2e1014; box-shadow: inset 0 0 0 1px rgba(255, 93, 108, .6), 0 0 12px rgba(255, 93, 108, .4); }
.kp-device.bad .kp-lamps i.on svg { stroke: #ff8f99; filter: drop-shadow(0 0 4px rgba(255, 93, 108, .8)); }
.kp-pad { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kp-btn { position: relative; aspect-ratio: 1; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .08); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 30%, #2a2d35), color-mix(in srgb, var(--c) 14%, #17191e)); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--c) 70%, transparent), inset 0 2px 0 rgba(255, 255, 255, .12), 0 5px 0 #0b0c10; transition: transform .08s, box-shadow .08s; }
.kp-btn:active { transform: translateY(3px); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--c) 70%, transparent), inset 0 2px 0 rgba(255, 255, 255, .12), 0 2px 0 #0b0c10; }
.kp-btn.hit { animation: kpHit .4s ease; }
@keyframes kpHit { 0% { filter: brightness(1.9); } 100% { filter: none; } }
.kp-reset { display: block; margin: 13px auto 0; padding: 3px 14px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .09); background: rgba(255, 255, 255, .05); color: #a3a9b6; font-size: 12px; }
.kp-reset:hover { background: rgba(255, 255, 255, .1); }
