/* shop.css — 판매 화면(구매 시트·내 구매·결제 확인·결과·사업자 표시). app.css 의 종이·필름 톤을 그대로 쓴다. */

/* 종이 톤 고정: 브라우저·웹뷰의 자동 다크(강제 다크)로 글자가 뒤집히지 않게 */
:root { color-scheme: only light; }

/* ───────── 구매 시트 ───────── */
.sheet--shop .sheet-body { padding-top: 4px; }
.shop { display: flex; flex-direction: column; gap: 10px; }
.shop-lead { margin: 0 0 2px; color: var(--ink-2); font-size: 14.5px; }
.shop-list { display: flex; flex-direction: column; gap: 8px; }
.shop-item {
  position: relative; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px;
  width: 100%; padding: 14px 14px; border: 0; border-radius: 14px; text-align: left;
  background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line);
  transition: box-shadow 160ms ease, transform 140ms var(--ease-out), background-color 160ms ease;
}
button.shop-item:active:not(:disabled) { transform: scale(0.985); }
.shop-item.is-on { box-shadow: inset 0 0 0 2px var(--ink), var(--shadow-1); background: #fbf7ee; }
.shop-item.is-owned { opacity: 0.6; }
.shop-item:disabled { cursor: default; }
.shop-radio { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-2); background: var(--paper); }
.shop-item.is-on .shop-radio { box-shadow: inset 0 0 0 6px var(--ink); }
div.shop-item .shop-radio { visibility: hidden; width: 0; }
div.shop-item { grid-template-columns: 0 1fr auto; gap: 0 12px; }
.shop-item-main { display: flex; flex-direction: column; min-width: 0; }
.shop-item-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-family: var(--f-head); font-weight: 800; font-size: 16.5px; line-height: 1.3; }
.shop-item-desc { margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.shop-item-price { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.shop-item-price b { font-family: var(--f-head); font-weight: 800; font-size: 17px; }
.shop-item-price small { font-family: var(--f-dot); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.shop-best, .shop-owned, .shop-test {
  display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 4px;
  font-family: var(--f-body); font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.shop-best { color: #5a3a0a; background: linear-gradient(180deg, #f3d48b, #e2b356); }
.shop-owned { color: var(--ok); box-shadow: inset 0 0 0 1px rgba(74, 107, 71, 0.5); }
.shop-test { color: #fff; background: var(--red); }
.shop-period { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.shop-period .ico { width: 16px; height: 16px; color: var(--ok); }
.shop-cta { margin-top: 4px; }
.shop-cta.is-disabled { opacity: 0.38; pointer-events: none; }
.shop-restore { min-height: 44px; }
.shop-note { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.shop-input {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 0; border-radius: 12px;
  background: #fbf7ee; box-shadow: inset 0 0 0 1.5px var(--line-2); font-size: 16px; /* 16px: iOS 확대 방지 */
}
.shop-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.shop-code { min-height: 64px; resize: vertical; font-family: var(--f-dot); font-size: 13px; word-break: break-all; }
.shop-notify, .restore-form { display: flex; flex-direction: column; gap: 10px; }
.shop-agree { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.5; cursor: pointer; }
.shop-agree input, .shop-check { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); }
.shop-done { display: flex; align-items: center; gap: 8px; margin: 4px 0; padding: 14px; border-radius: 12px; background: rgba(74, 107, 71, 0.1); color: var(--ok); font-weight: 700; }
.shop-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 8px; font-size: 12px; }
.shop-legal a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; color: var(--muted); text-decoration: none; } /* 터치 44px */
.shop-legal a b { font-weight: 700; color: var(--ink-2); }
.shop-textlink { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 6px; padding: 10px; color: var(--muted); font-size: 13.5px; } /* 터치 44px */
.shop-legal a { min-width: 44px; justify-content: center; } /* 「Terms」 등 짧은 낱말도 폭 44px */
.shop-empty { margin: 4px 0 6px; color: var(--muted); }

/* 내 구매 */
.mine-item { padding: 14px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.mine-top { display: flex; align-items: center; gap: 8px; font-family: var(--f-head); font-size: 16.5px; }
.mine-desc { margin: 0; color: var(--muted); font-size: 12.5px; }
.mine-dl { margin: 0; width: 100%; display: flex; flex-direction: column; gap: 2px; }
.mine-dl > div { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.mine-dl dt { color: var(--muted); }
.mine-dl dd { margin: 0; display: flex; align-items: center; gap: 4px; min-width: 0; }
.mine-dl code { font-family: var(--f-dot); font-size: 12px; overflow-wrap: anywhere; }
.restore { margin-top: 10px; padding-top: 14px; border-top: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 14px; }
.restore-h { margin: 0; font-family: var(--f-head); font-weight: 800; font-size: 17px; }
.restore-form--code { padding-top: 12px; border-top: 1px solid var(--line); }

/* 목록 배지·잠긴 화면 */
.badge--owned { color: var(--ok); box-shadow: inset 0 0 0 1px rgba(74, 107, 71, 0.5); }
.notice--shop .btn--wide { max-width: 340px; }

/* 결과 화면: 다음 편 잠금 · 다음 레벨 */
.next-case.is-locked .next-arrow { color: #f3d48b; }
.upsell {
  width: 100%; margin-top: 12px; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; text-align: left;
  padding: 16px 18px; border: 0; border-radius: 16px; color: #3d2a08;
  background: linear-gradient(160deg, #f6dc98, #e2b356); box-shadow: inset 0 0 0 1px rgba(138, 90, 18, 0.3), var(--shadow-1);
  transition: transform 140ms var(--ease-out);
}
.upsell:active { transform: scale(0.98); }
.upsell-k { font-family: var(--f-dot); font-size: 11px; letter-spacing: 0.2em; opacity: 0.75; }
.upsell-t { font-family: var(--f-head); font-weight: 800; font-size: 18px; line-height: 1.35; }
.upsell-s { font-size: 13px; font-weight: 700; }
.upsell-n { font-size: 12px; opacity: 0.8; margin-top: 2px; }
.upsell-arrow { grid-column: 2; grid-row: 1 / 5; }

/* ───────── 사업자 정보 하단 ───────── */
.biz { padding: 18px 22px calc(28px + var(--sab)); border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; line-height: 1.55; text-align: left; }
.biz .shop-legal { justify-content: flex-start; margin: 0 0 8px; }
.biz-name { margin: 0 0 4px; font-weight: 700; color: var(--ink-2); font-size: 12px; }
.biz-dl { margin: 0; display: flex; flex-wrap: wrap; gap: 0 12px; }
.biz-dl > div { display: inline-flex; gap: 4px; max-width: 100%; }
.biz-dl dt { flex: none; white-space: nowrap; } /* 항목 이름이 「所在 / 地:」처럼 쪼개지지 않게(Q1-1) */
.biz-dl dt::after { content: ':'; }
html[data-lang='ja'] .biz-dl dt::after, html[data-lang='zh'] .biz-dl dt::after { content: '：'; } /* 같은 칸의 「（韓国）：」·앱 안내 줄과 같은 전각(블라인드 QA #9) */
.biz-dl dd { margin: 0; min-width: 0; }
.biz-dl .is-todo dd { color: var(--red-ink); font-weight: 700; }
.biz-check { display: inline-block; margin-top: 6px; color: var(--ink-2); }

/* ───────── 결제 확인·결과 페이지(checkout.html, pay-*.html) ───────── */
.page-shop .app { overflow-y: auto; overscroll-behavior: contain; display: block; }
.pg { padding: calc(var(--sat) + 8px) 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.pg-top { display: flex; align-items: center; justify-content: space-between; margin: 0 -12px; }
.pg-kicker { margin: 0; font-family: var(--f-dot); font-size: 11px; letter-spacing: 0.16em; color: var(--muted); }
.pg-title { margin: 0; font-family: var(--f-head); font-weight: 800; font-size: 24px; line-height: 1.3; }
.pg-lead { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.pg-card { padding: 16px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-1); }
.co-sum { margin: 0; display: flex; flex-direction: column; }
.co-sum > div { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); font-size: 14px; }
.co-sum > div:last-child { border-bottom: 0; }
.co-sum dt { color: var(--muted); }
.co-sum dd { margin: 0; font-weight: 500; }
.co-sum .co-price dd { font-family: var(--f-head); font-weight: 800; font-size: 20px; }
.co-field { display: flex; flex-direction: column; gap: 6px; }
.co-label { font-weight: 700; font-size: 14px; }
.co-help { margin: 0; color: var(--muted); font-size: 12.5px; }
.co-agree { display: flex; flex-direction: column; gap: 10px; }
.co-agree-all { padding-bottom: 10px; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--ink); font-size: 14.5px; }
.co-agree .shop-agree a { color: var(--ink-2); margin-left: 4px; white-space: nowrap; }
.co-warn { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(181, 64, 44, 0.08); color: var(--red-ink); font-size: 13px; }
.co-test { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--film); color: var(--amber); font-family: var(--f-dot); font-size: 12px; letter-spacing: 0.04em; }
.co-pay { position: sticky; bottom: 0; padding: 12px 0 calc(12px + var(--sab)); background: linear-gradient(180deg, rgba(243, 234, 216, 0), var(--paper) 30%); }
.co-sdk:empty { display: none; }
.pay-center { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.pay-stamp { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; box-shadow: 0 0 0 6px rgba(74, 107, 71, 0.18); }
.pay-stamp .ico { width: 40px; height: 40px; stroke-width: 2.2; }
.pay-stamp--fail { background: var(--red); box-shadow: 0 0 0 6px rgba(181, 64, 44, 0.16); }
.pay-order { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 0; font-family: var(--f-dot); font-size: 13px; overflow-wrap: anywhere; }
.pay-save { margin: 0; max-width: 320px; color: var(--muted); font-size: 12.5px; }
.pay-actions { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

/* 모의 결제창(로컬 시험 전용) */
.mock { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 24px; background: #1d2b4a; color: #fff; font-family: system-ui, sans-serif; }
.mock-badge { align-self: flex-start; padding: 4px 10px; border-radius: 6px; background: #ffcc00; color: #222; font-weight: 800; font-size: 12px; }
.mock h1 { margin: 0; font-size: 22px; }
.mock dl { margin: 0; padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); }
.mock dl div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 14px; }
.mock dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; text-align: right; }
.mock button { min-height: 50px; border: 0; border-radius: 12px; font-size: 16px; font-weight: 800; cursor: pointer; }
.mock .mock-ok { background: #3b82f6; color: #fff; }
.mock .mock-no { background: transparent; color: #cfd8ee; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.3); }

/* ───────── 약관 페이지 ───────── */
.legal { padding: calc(var(--sat) + 8px) 22px 10px; }
.legal article { display: none; }
.legal article.is-on { display: block; }
/* DET-12: legal.js 전에는 앞단 스크립트가 정한 언어(data-pre-lang) 본문만 — legal.js 가 html.legal-ready 를 달면 원래 규칙 */
html[data-pre-lang]:not(.legal-ready) .legal article.is-on { display: none; }
html[data-pre-lang='ko']:not(.legal-ready) .legal article[data-lang='ko'], html[data-pre-lang='en']:not(.legal-ready) .legal article[data-lang='en'],
html[data-pre-lang='ja']:not(.legal-ready) .legal article[data-lang='ja'], html[data-pre-lang='zh']:not(.legal-ready) .legal article[data-lang='zh'] { display: block; }
.legal h1 { margin: 6px 0 4px; font-family: var(--f-head); font-weight: 800; font-size: 24px; line-height: 1.3; }
.legal h2 { margin: 22px 0 6px; font-family: var(--f-head); font-weight: 800; font-size: 16.5px; }
.legal p, .legal li { font-size: 14px; color: var(--ink-2); }
.legal ol, .legal ul { padding-left: 20px; margin: 6px 0; }
.legal table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.legal th, .legal td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.legal .legal-meta { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }
.legal .legal-note { padding: 10px 12px; border-radius: 10px; background: rgba(42, 36, 32, 0.05); font-size: 12.5px; color: var(--muted); }
.legal [data-biz] { font-weight: 700; color: var(--ink); }
.legal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -12px; }
.legal .is-todo { color: var(--red-ink); }

/* 스크롤되는 화면(목록·결제·약관)에서는 시트·토스트를 화면에 고정한다.
   .app 이 스크롤 상자라 position:absolute 이면 스크롤한 만큼 시트가 화면 밖(맨 위)에 뜬다. */
.page-home .sheet-root, .page-shop .sheet-root {
  position: fixed; inset: 0; margin: 0 auto; width: 100%;
  max-width: calc(100dvh * 9 / 16); min-width: min(100%, 360px);
}
.page-home .toast, .page-shop .toast { position: fixed; }
@media (min-aspect-ratio: 9/16) and (min-width: 600px) {
  .page-home .sheet-root, .page-shop .sheet-root {
    top: 50%; bottom: auto; height: min(100dvh, 960px); transform: translateY(-50%);
    max-width: min(540px, calc(min(100dvh, 960px) * 9 / 16)); border-radius: 22px; overflow: hidden;
  }
  /* 어두운 막은 화면 전체(가운데 띠만 어두워지던 것). 시트 판은 위 틀 안에 그대로.
     translateY 대신 top 으로 가운데 → 막의 position:fixed 가 틀이 아니라 화면을 기준으로(틀의 overflow 에도 안 잘림) */
  .page-home .sheet-root, .page-shop .sheet-root { top: calc((100dvh - min(100dvh, 960px)) / 2); transform: none; }
  .page-home .sheet-root .sheet-back, .page-shop .sheet-root .sheet-back { position: fixed; inset: 0; }
}
.pay-amount { font-family: var(--f-body); font-weight: 700; font-size: 15px; letter-spacing: 0; }
/* 特商法 표기 표: 항목 열이 한 글자씩 꺾이지 않게 */
.legal table.tk > tbody > tr > th { width: 32%; min-width: 7.5em; padding-right: 10px; font-weight: 700; color: var(--ink); }
.legal table.tk td table th { width: auto; min-width: 0; }
/* 일본어·중국어 법률 문서: 낱말 가운데서 꺾지 않는다(「返品・キャン|セル」「プライバ|シーポリシー」「隐私政|策」, R6).
   본문은 어절 단위(auto-phrase, 크롬·안드로이드 WebView — 아이폰 WebKit 은 기본 줄바꿈), 표 항목·링크는 낱말째(keep-all, 「・」 뒤에서만 꺾임) */
.legal article[data-lang='ja'] { word-break: auto-phrase; overflow-wrap: anywhere; }
.legal article[data-lang='zh'] :is(h1, h2, p, li, td) { text-wrap: pretty; }
.legal article:is([data-lang='ja'], [data-lang='zh']) a { word-break: keep-all; }
.legal article:is([data-lang='ja'], [data-lang='zh']) table.tk > tbody > tr > th { min-width: 9.5em; word-break: keep-all; overflow-wrap: normal; }
.legal article[data-lang='ja'] table.tk > tbody > tr > th { word-break: auto-phrase; }
/* 가격표가 든 표(웹 特商法)는 375px 미만에서 항목 칸을 조금 좁힌다 — 안쪽 가격표 설명이 「有料エピソードすべ|て」로 꺾이지 않게(「返品・|キャンセル」은 「・」 뒤에서) */
@media (max-width: 374px) { .legal article:is([data-lang='ja'], [data-lang='zh']) table.tk:has(.price-table) > tbody > tr > th { min-width: 8.5em; } }
/* 한 덩어리로 둘 짧은 말: 가격표 설명의 괄호(js/legal.js keepParen, 「（I01～|I20）」), 「数字商品（解锁券）」 */
.legal .nw { white-space: nowrap; }

/* ───────── 코인(앱 전용, js/tickets.js) — 칩·배지·코인 창·잠긴 편 화면 모양은 css/cinema-shop.css (시네마 리디자인 2026-11-14) ───────── */
.next-case.is-locked .next-arrow { stroke-width: 1.8; }

/* 앱(html.is-app, 앱 브리지가 붙임) / 웹 전용 문구.
   html.legal-app-view = 브라우저로 보는 앱판 법률 문서(legal/*.html?view=app, 스토어 제출 URL — js/legal.js): 앱과 같은 문구를 보인다 */
html.is-app [data-web], html.legal-app-view [data-web] { display: none !important; }
html:not(.is-app):not(.legal-app-view) [data-app] { display: none !important; }
/* 웹 판매 꺼짐(전 편 무료, js/legal.js 가 html[data-sales-off]를 붙임): 유료 조항은 숨기고 「전부 무료」 안내를 보인다 */
html[data-sales-off] [data-sales] { display: none !important; }
html:not([data-sales-off]) [data-sales-free] { display: none !important; }
.biz-note { margin: 4px 0 0; }
/* 약관·特商法 가격표: [상품명/설명] [가격] 두 칸 */
.legal table.price-table th { width: auto; min-width: 0; font-weight: 400; }
.legal .pt-name { display: block; font-weight: 700; color: var(--ink); word-break: keep-all; }
.legal .pt-desc { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.legal .pt-price { white-space: nowrap; text-align: right; font-weight: 700; color: var(--ink); width: 1%; }
