/* 앱처럼 즐기기 (js/install.js) — 첫 화면·명부의 한지 쪽지, 방법 창(한지 판), 게임 안 한 번 알림, 설정·길잡이 한 줄
   + 홈 화면 앱(주소창 없음)·노치 화면의 안전 구역 */

/* 먹선 아이콘: 눌러야 할 단추를 작게 그린 것 */
.in-ic { display: inline-flex; flex: none; width: 21px; height: 21px; padding: 2px; margin: 0 3px 0 0; vertical-align: -5px; box-sizing: border-box;
  border: 1px solid rgba(74,58,42,0.55); border-radius: 5px; background: rgba(255,250,236,0.6); color: #241a12; box-shadow: 0 1px 0 rgba(0,0,0,0.12); }
.in-ic svg { width: 100%; height: 100%; display: block; }
.in-app { width: 21px; height: 21px; border-radius: 5px; vertical-align: -5px; box-shadow: 0 0 0 1px #3a2a1a; flex: none; }

/* ── 쪽지 (첫 화면·명부) ── */
.inst-card { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; max-width: 380px; margin: 12px auto 0; padding: 9px 10px 9px 10px;
  text-align: left; color: #241a12; background: url("../ui/tex_hanji.png") center / 260px, #e3d3b0;
  border: 1px solid #6d5636; border-left: 3px solid #a8150e;
  box-shadow: 0 0 0 2px #1d140c, 0 0 0 3px rgba(201,162,79,0.5), 0 8px 22px rgba(0,0,0,0.6);
  opacity: 0; transform: translateY(8px); animation: inkin 1s 2.8s forwards; }
.inst-card .inst-seal { flex: none; width: 40px; height: 40px; padding: 2px; background: #a8150e; border-radius: 9px; box-shadow: 0 1px 3px rgba(0,0,0,0.45); }
.inst-card .inst-seal img, #inst-nudge .inst-seal img { display: block; width: 100%; height: 100%; border-radius: 7px; }
.inst-card .inst-txt { flex: 1 1 170px; min-width: 0; line-height: 1.35; }
.inst-t { font-family: var(--title); font-weight: 400; font-size: 16px; color: #8e2a22; letter-spacing: 1px; }
.inst-s { font-size: 12px; color: #4a3a2a; margin-left: 6px; }
.inst-how { display: flex; flex-wrap: wrap; align-items: center; row-gap: 3px; margin-top: 4px; font-size: 12.5px; color: #2a2018; cursor: pointer; }
.inst-how i { font-style: normal; color: #a8150e; margin: 0 5px; }
.inst-acts { flex: none; display: flex; flex-direction: column; align-items: stretch; gap: 3px; margin-left: auto; }
.inst-main, .inst-go { font-family: var(--title); font-size: 14px; padding: 6px 11px; background: #7a1a12; color: #f6e2b0; border: 1px solid #a8803e; letter-spacing: 1px;
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.18), 0 2px 4px rgba(0,0,0,0.4); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.inst-main i, .inst-go i { font-style: normal; font-size: 11px; margin-left: 5px; opacity: 0.65; }
.inst-main:active, .inst-go:active { transform: translateY(1px); }
.inst-never { background: none; border: none; padding: 1px 0; font-size: 11px; color: #6d5636; text-decoration: underline dotted; text-underline-offset: 2px; cursor: pointer; }
.inst-x { position: absolute; top: -10px; right: -10px; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid #a8803e; background: #1d140c; color: #e6d2a4; font-size: 11px; line-height: 22px; cursor: pointer; }
/* 명부: 제목 줄 오른쪽의 작은 표찰 */
#chars .chars-box > h2 { display: flex; align-items: center; gap: 8px; }
.inst-card.inst-chip { flex: none; margin: 0 0 0 auto; padding: 3px 9px 3px 3px; max-width: none; gap: 6px; flex-wrap: nowrap; animation: none; opacity: 1; transform: none;
  font: 400 13px/1 var(--title); letter-spacing: 1px; color: #7a1a12; cursor: pointer;
  box-shadow: 0 0 0 1px #1d140c, 0 2px 6px rgba(0,0,0,0.35); }
.inst-card.inst-chip .in-app { width: 24px; height: 24px; border-radius: 6px; vertical-align: 0; box-shadow: 0 0 0 1.5px #a8150e; }
.inst-card.inst-chip:active { transform: translateY(1px); }
/* 낮은 가로 화면(휴대폰 가로)의 첫 화면: 한 줄로 납작하게 */
@media (orientation: landscape) and (max-height: 560px) {
  #title .inst-card { margin-top: 8px; padding: 6px 8px; gap: 4px 8px; }
  #title .inst-card .inst-seal { width: 32px; height: 32px; }
  #title .inst-card .inst-acts { flex-direction: row; align-items: center; gap: 8px; }
  #title .inst-card .inst-main { padding: 4px 9px; font-size: 13px; }
  .inst-how { font-size: 11.5px; margin-top: 2px; }
}
@media (orientation: portrait) and (max-width: 520px) {
  #title .inst-card { margin-top: 10px; padding: 7px 8px; gap: 4px 8px; flex-wrap: nowrap; }
  #title .inst-card .inst-seal { width: 34px; height: 34px; border-radius: 8px; }
  #title .inst-card .inst-txt { flex: 1 1 auto; }
  #title .inst-card .inst-s { display: block; margin: 0; font-size: 11.5px; }
  #title .inst-card .inst-main { font-size: 13px; padding: 5px 8px; white-space: nowrap; }
  #title .inst-card .inst-main i { display: none; }
  #title .inst-how { font-size: 12px; margin-top: 3px; }
  #title .inst-how i { margin: 0 3px; }
}
/* 세로인데 높이가 모자라면 (Safari 주소창·도구 막대가 먹는 실제 높이): 한 줄 띠로 — 순서·다시 보지 않기는 방법 창 안에 */
@media (orientation: portrait) and (max-height: 760px) {
  #title .inst-card { margin-top: 8px; padding: 5px 8px 5px 6px; align-items: center; }
  #title .inst-card .inst-seal { width: 30px; height: 30px; border-radius: 7px; }
  #title .inst-card .inst-how, #title .inst-card .inst-never { display: none; }
  #title .inst-card .inst-t { font-size: 15px; }
}

/* ── 방법 창 ── */
#inst-sheet { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: rgba(5,4,3,0.62);
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  animation: inst-fade 0.25s ease-out; }
@keyframes inst-fade { from { opacity: 0; } }
#inst-sheet .inst-panel { position: relative; width: min(540px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 6px 12px 10px; color: #241a12; user-select: none; -webkit-user-select: none; }
#inst-sheet h3 { display: flex; align-items: baseline; }
#inst-sheet h3 .close { margin-left: auto; background: none; border: none; color: var(--ink2); font-size: 18px; padding: 0 2px 0 10px; cursor: pointer; }
.inst-lead { margin: 6px 0 4px; font-size: 14px; line-height: 1.65; color: #2a2018; }
.inst-lead b, .inst-steps b, .inst-note b, .inst-now b { color: #8e1e14; }
.inst-now { font-size: 12.5px; color: #4a3a2a; margin: 4px 0 8px; }
.inst-back { margin-left: 6px; padding: 1px 7px; font-size: 11.5px; background: #eadfc4; border: 1px solid #a88a5a; color: #4a3a2a; }
.inst-body { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: start; }
.inst-fig { grid-row: 1 / span 2; padding-top: 4px; }
.in-phone { display: block; overflow: visible; }
.in-phone .ph-body { fill: rgba(36,26,18,0.06); stroke: #241a12; stroke-width: 1.6; }
.in-phone .ph-bar { fill: rgba(36,26,18,0.16); }
.in-phone .ph-field { fill: rgba(255,250,236,0.7); stroke: rgba(36,26,18,0.3); stroke-width: 0.8; }
.in-phone .ph-ink { fill: none; stroke: rgba(36,26,18,0.38); stroke-width: 2.2; stroke-linecap: round; }
.in-phone .ph-ink2 { fill: none; stroke: rgba(36,26,18,0.22); stroke-width: 1.6; stroke-linecap: round; }
.in-phone .ph-ring { fill: none; stroke: #b0281a; stroke-width: 1.6; transform-box: fill-box; transform-origin: center; animation: inst-ring 1.6s ease-out infinite; }
.in-phone .ph-dot { fill: #b0281a; }
@keyframes inst-ring { 0% { opacity: 1; transform: scale(0.6); } 100% { opacity: 0; transform: scale(1.5); } }
.inst-steps { list-style: none; margin: 0; padding: 0; counter-reset: ist; }
.inst-steps li { counter-increment: ist; display: flex; align-items: flex-start; gap: 7px; padding: 7px 0; border-bottom: 1px dashed rgba(120,90,50,0.35); font-size: 14px; line-height: 1.6; color: #2a2018; }
.inst-steps li:last-child { border-bottom: none; }
.inst-steps li::before { content: counter(ist); flex: none; width: 19px; height: 19px; margin-top: 2px; border-radius: 3px; background: #a8150e; color: #f6e2c8;
  font: 400 12px/19px var(--title); text-align: center; }
.inst-steps li > .in-ic, .inst-steps li > .in-app { width: 24px; height: 24px; margin-top: 0; }
.inst-steps li > .inst-tx { flex: 1; min-width: 0; }
.inst-steps li > .inst-tx .in-ic { width: 19px; height: 19px; margin: 0 1px; }
.inst-btns { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 4px; }
.inst-go { font-size: 15px; padding: 7px 14px; }
.inst-sub { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; font-size: 13px; background: #eadfc4; border: 1px solid #a88a5a; color: #4a3a2a; }
.inst-sub .in-ic { margin: 0; }
.inst-note { grid-column: 1 / -1; margin: 6px 0 0; padding-top: 7px; border-top: 1px dashed rgba(120,90,50,0.45); font-size: 12.5px; line-height: 1.6; color: #4a3a2a; }
.inst-pick { margin-top: 10px; padding-top: 7px; border-top: 1px solid rgba(110,80,40,0.35); font-size: 12px; color: #6d5636; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.inst-pick span { margin-right: 2px; }
.inst-pick button { padding: 3px 8px; font-size: 12px; background: #eadfc4; border: 1px solid #a88a5a; color: #4a3a2a; }
.inst-foot { display: flex; justify-content: flex-end; margin-top: 6px; }
.inst-pick button.on { background: #7a1a12; color: #f6e2b0; border-color: #a8803e; }
@media (max-width: 520px) {
  #inst-sheet .inst-panel { border-width: 20px; padding: 4px 6px 8px; }
  .inst-body { gap: 4px 10px; }
  .inst-fig svg { width: 54px; height: auto; }
  .inst-steps li { font-size: 13.5px; }
}
@media (max-height: 520px) {
  #inst-sheet .inst-panel { border-width: 18px; }
  .inst-lead { display: none; }
}

/* ── 게임 안 한 번 알림 ── */
#inst-nudge { position: fixed; z-index: 70; left: 50%; top: max(10px, calc(env(safe-area-inset-top) + 4px)); transform: translateX(-50%); width: min(460px, calc(100vw - 20px));
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; box-sizing: border-box;
  border: 14px solid transparent; border-image: url("../ui/frame_najeon.png") 58 stretch; background: rgba(12,8,6,0.95); background-clip: padding-box;
  animation: inst-drop 0.4s ease-out; }
@keyframes inst-drop { from { opacity: 0; transform: translate(-50%, -14px); } }
#inst-nudge .inst-seal { flex: none; width: 34px; height: 34px; padding: 2px; background: #a8150e; border-radius: 8px; }
#inst-nudge .inst-txt { flex: 1; min-width: 0; line-height: 1.35; }
#inst-nudge .inst-txt b { display: block; font-family: var(--title); font-weight: 400; font-size: 15px; color: #ffcf7a; }
#inst-nudge .inst-txt span { font-size: 12px; color: #efe2c4; }
#inst-nudge .inst-main { flex: none; font-size: 13px; padding: 5px 10px; }
#inst-nudge .inst-x { position: static; flex: none; width: 24px; height: 24px; line-height: 22px; }

/* ── 설정 '조작' · 길잡이 '조작'의 한 칸 ── */
.inst-entry { display: flex; align-items: center; gap: 10px; margin: 8px 0 10px; padding: 8px 10px; border: 1px dashed rgba(110,80,40,0.55); border-left: 3px solid #a8150e; background: rgba(255,248,230,0.35); }
.inst-entry > .in-app { width: 34px; height: 34px; border-radius: 8px; }
.inst-entry > div { flex: 1; min-width: 0; line-height: 1.4; }
.inst-entry b { font-family: var(--title); font-weight: 400; font-size: 15px; color: #7a1a12; }
.inst-entry small { display: block; font-size: 12px; color: #6d5636; }
.inst-entry .inst-open { flex: none; padding: 5px 10px; font-size: 13px; background: #7a1a12; color: #f6e2b0; border: 1px solid #a8803e; font-family: var(--title); }

/* ── 안전 구역: 노치·다이내믹 아일랜드·홈 막대 (viewport-fit=cover — 홈 화면 앱과 Safari 가로 화면) ── */
body.phone #tracker { left: max(10px, env(safe-area-inset-left)); }
body.phone:not(.portrait) #sysbox { right: max(10px, env(safe-area-inset-right)); }
body.phone:not(.portrait) #zone-name { left: max(16px, env(safe-area-inset-left)); }
body.phone:not(.portrait) #dialog { bottom: max(8px, env(safe-area-inset-bottom)); }
body.phone.portrait #sysbox, body.phone.portrait #chatbox { left: max(10px, env(safe-area-inset-left)); }
