/* AR-pic 웹앱 — 색·배경은 theme.js가 기기별로 CSS 변수에 넣는다. */
:root {
  --bg-image: url("/assets/bg.jpg");
  --accent: #6f7bff;
  --accent2: #b9a6ff;
  --panel: rgba(14, 14, 40, 0.72);
  --text: #ffffff;
  --soft: #c3c7f0;
  --line: color-mix(in srgb, var(--accent) 50%, transparent);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #05050f; color: var(--text); overflow: hidden; }
body { font-family: Pretendard, -apple-system, "Apple SD Gothic Neo", "PingFang SC", "Hiragino Sans", "Noto Sans CJK", "Malgun Gothic", sans-serif; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
b { font-weight: 800; }

.screen { position: fixed; inset: 0; overflow: hidden; }
.bg { position: absolute; inset: 0; background: var(--bg-image) center / cover no-repeat; }
.bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 42%, rgba(10,10,40,.15), rgba(5,5,20,.62)); }
.center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 30px; }
.logo { width: min(62vw, 240px); filter: drop-shadow(0 8px 24px rgba(80,90,255,.4)); }
.mini-logo { position: absolute; top: calc(env(safe-area-inset-top) + 18px); left: 18px; width: 92px; z-index: 6; }
.title { font-size: 25px; font-weight: 800; line-height: 1.35; margin-top: 24px; letter-spacing: -0.3px; }
.desc { font-size: 15px; color: var(--soft); margin-top: 12px; line-height: 1.55; }
.note { font-size: 13px; color: var(--soft); margin-top: 22px; opacity: .85; }
.bar { width: min(62vw, 230px); height: 6px; border-radius: 6px; background: rgba(255,255,255,.16); margin-top: 32px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent2)); box-shadow: 0 0 12px var(--accent); transition: width .25s; }
.pct { font-size: 13px; color: var(--soft); margin-top: 10px; }
.icon-box { width: 84px; height: 84px; border-radius: 26px; background: color-mix(in srgb, var(--accent) 18%, transparent); border: 1px solid var(--line);
            display: flex; align-items: center; justify-content: center; }
.icon-box svg { width: 42px; height: 42px; stroke: var(--soft); }
.btn-main { margin-top: 26px; height: 54px; padding: 0 28px; border-radius: 16px; font-size: 17px; font-weight: 800; color: #fff;
            background: linear-gradient(90deg, var(--accent), var(--accent2)); box-shadow: 0 8px 22px rgba(0,0,0,.3); }

/* 언어 버튼·목록 */
.lang-btn { position: absolute; top: calc(env(safe-area-inset-top) + 14px); right: 14px; z-index: 20; display: flex; align-items: center; gap: 8px; height: 46px;
            padding: 0 15px 0 13px; border-radius: 999px; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
            border: 1px solid var(--line); font-size: 16px; font-weight: 800; color: var(--text); }
.lang-btn svg { width: 21px; height: 21px; }
.lang-btn .chev { width: 14px; height: 14px; opacity: .8; }
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-dim { position: absolute; inset: 0; background: rgba(0,0,0,.5); animation: fade .18s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(env(safe-area-inset-bottom) + 24px); border-radius: 26px 26px 0 0;
         background: #151530; background: color-mix(in srgb, var(--panel) 92%, #000); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
         border-top: 1px solid var(--line); animation: up .2s ease-out; }
.sheet .grab { width: 44px; height: 5px; border-radius: 5px; background: rgba(255,255,255,.28); margin: 0 auto 14px; }
.sheet h4 { font-size: 15px; color: var(--soft); font-weight: 700; margin: 0 6px 10px; }
.opt { width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 0 16px; border-radius: 16px; font-size: 19px; font-weight: 700; text-align: left; border: 1px solid transparent; }
.opt small { font-size: 13px; color: var(--soft); font-weight: 500; margin-left: 10px; }
.opt.on { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--line); }
.opt i { font-style: normal; color: var(--accent2); }
.closing .sheet { animation: down .18s forwards; } .closing .sheet-dim { animation: fade .18s reverse forwards; }
@keyframes up { from { transform: translateY(100%); } } @keyframes down { to { transform: translateY(100%); } } @keyframes fade { from { opacity: 0; } }

/* AR 화면 */
#ar-stage { position: absolute; inset: 0; background: #000; z-index: 0; } /* z-index: MindAR 카메라 영상(z-index -2)이 무대 배경 뒤로 숨지 않게 */
#ar-stage video { object-fit: cover; }
.top-shade { position: absolute; top: 0; left: 0; right: 0; height: 130px; background: linear-gradient(rgba(0,0,0,.55), transparent); z-index: 5; pointer-events: none; }
.guide { position: absolute; left: 50%; top: 50%; width: min(80vw, 330px); aspect-ratio: 4 / 3; transform: translate(-50%, -54%); z-index: 6; pointer-events: none; }
.guide b { position: absolute; width: 36px; height: 36px; border: 4px solid var(--accent); filter: drop-shadow(0 0 6px var(--accent)); }
.guide b:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; }
.guide b:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 12px 0 0; }
.guide b:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 12px; }
.guide b:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 12px 0; }
.scanline { position: absolute; left: 8px; right: 8px; height: 2px; background: linear-gradient(90deg, transparent, var(--accent2), transparent); box-shadow: 0 0 12px var(--accent); animation: scan 2.2s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 12%; } 50% { top: 86%; } }
.hint { position: absolute; left: 18px; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 40px); padding: 16px 18px; border-radius: 20px; z-index: 6; text-align: center;
        background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); }
.hint strong { display: block; font-size: 17px; font-weight: 800; }
.hint span { display: block; font-size: 13px; color: var(--soft); margin-top: 5px; }
.sound-btn { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 36px); transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px;
             padding: 14px 24px; border-radius: 999px; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line);
             font-size: 16px; font-weight: 800; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.4); color: var(--text); }
.sound-btn svg { width: 22px; height: 22px; }
.sound-btn.on { background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; }
.hidden { display: none !important; }

/* 다운로드 페이지 */
.dl { position: absolute; inset: 0; display: flex; flex-direction: column; }
.dl-body { flex: 1; min-height: 0; overflow-y: auto; padding: calc(env(safe-area-inset-top) + 86px) 20px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; position: relative; z-index: 2; }
.dl-title { font-size: 23px; font-weight: 800; text-align: center; line-height: 1.3; }
.dl-note { font-size: 13px; color: var(--soft); text-align: center; margin-top: -6px; }
.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.tabs button { padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--soft); }
.tabs button.on { background: var(--accent); color: #fff; }
.media { width: 100%; max-width: 520px; position: relative; border-radius: 10px; overflow: hidden; box-shadow: 0 14px 30px rgba(0,0,0,.45); background: rgba(255,255,255,.06); min-height: 120px; }
.media img { display: block; width: 100%; }
.play { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(0,0,0,.35); font-size: 14px; font-weight: 700; }
.play i { width: 64px; height: 64px; border-radius: 50%; background: rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.85); display: flex; align-items: center; justify-content: center; }
.play i::after { content: ""; border-left: 20px solid #fff; border-top: 13px solid transparent; border-bottom: 13px solid transparent; margin-left: 5px; }
.dl-foot { position: relative; z-index: 3; padding: 12px 18px calc(env(safe-area-inset-bottom) + 22px); display: flex; flex-direction: column; gap: 10px;
           background: linear-gradient(transparent, rgba(0,0,0,.4) 30%); }
.timer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 14px; border-radius: 14px; font-size: 15px; font-weight: 800;
         background: color-mix(in srgb, var(--accent) 24%, rgba(0,0,0,.35)); border: 1px solid var(--line); }
.timer svg { width: 20px; height: 20px; flex: none; }
.timer .left { font-variant-numeric: tabular-nums; color: var(--accent2); }
.timer.urgent { background: rgba(255,80,110,.28); border-color: rgba(255,120,140,.6); } .timer.urgent .left { color: #ffd0d8; }
.btn-save { height: 58px; border-radius: 18px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 18px; font-weight: 800; color: #fff;
            background: linear-gradient(90deg, var(--accent), var(--accent2)); box-shadow: 0 8px 22px rgba(0,0,0,.3); }
.btn-save:disabled { opacity: .55; }
.btn-save svg { width: 22px; height: 22px; stroke: currentColor; }
.toast { position: fixed; left: 22px; right: 22px; top: 50%; transform: translateY(-50%); z-index: 60; padding: 22px 20px; border-radius: 22px; text-align: center;
         background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); box-shadow: 0 20px 40px rgba(0,0,0,.45); animation: fade .18s; }
.toast .ok { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 900; color: #fff; }
.toast b { display: block; font-size: 18px; } .toast span { display: block; font-size: 14px; color: var(--soft); margin-top: 6px; line-height: 1.5; }
