/* ASSETORY — 씬 전용 페이지 (/scene/*)
   Tailwind CDN에 의존하지 않는 독립 스타일. 씬 페이지는 공유 링크로
   바로 열리는 경우가 많아 초기 로딩을 최대한 가볍게 유지한다. */

:root {
    --base-100: #3a3a3a;
    --base-200: #2a2a2a;
    --base-300: #242424;
    --base-400: #1c1c1c;
    --base-500: #141414;
    --border: #3d3d3d;
    --muted: #a3a3a3;
    --accent: #58a6ff;
    --accent-300: #8ec5ff;
    --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--base-300);
    color: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.kr { word-break: keep-all; }

a { color: inherit; }

a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

.skip {
    position: absolute;
    left: -9999px;
}
.skip:focus {
    left: 1rem;
    top: 1rem;
    z-index: 100;
    background: #fff;
    color: #000;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
}

/* ── 헤더 ───────────────────────────────────────────── */
.bar {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
    background: var(--base-200);
    border-bottom: 1px solid var(--border);
}

.bar .brand {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    flex-shrink: 0;
}
.bar .brand img { height: 22px; display: block; }

.bar .meta { min-width: 0; flex: 1; }
.bar .meta h1 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bar .meta .cat {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar .actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.btn {
    height: 44px;
    min-width: 44px;
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 999px;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.2); }
.btn.icon-only { padding: 0; width: 44px; }

@media (max-width: 640px) {
    .btn .txt { display: none; }
    .btn { padding: 0; width: 44px; }
}

/* ── 뷰어 무대 ───────────────────────────────────────── */
.stage {
    position: relative;
    width: 100%;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    background: var(--base-400);
    overflow: hidden;
}

.stage iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.5s;
}
.stage iframe.ready { opacity: 1; }

.loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: opacity 0.3s;
}
.loading.done { opacity: 0; }

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading p { margin: 0; color: var(--muted); font-weight: 500; letter-spacing: 0.02em; }

/* ── 조작 안내 ───────────────────────────────────────── */
.hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    justify-content: center;
    padding: 0 1rem 1.5rem;
    transition: opacity 0.5s;
    /* 래퍼는 뷰어 하단을 통째로 덮으므로 절대 터치를 받으면 안 된다.
       클릭을 받는 것은 안쪽 .hint-card 뿐이다. */
    pointer-events: none;
}
.hint.off { opacity: 0; visibility: hidden; }

.hint-card {
    pointer-events: auto;
    width: 100%;
    max-width: 32rem;
    background: rgba(36, 36, 36, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}
@media (min-width: 640px) { .hint-card { max-width: 48rem; } }

.hint-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.hint-head span {
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgba(163, 163, 163, 0.7);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.hint-close {
    width: 44px;
    height: 44px;
    margin: -0.5rem -0.75rem -0.5rem 0;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.125rem;
    cursor: pointer;
    line-height: 1;
}
.hint-close:hover { color: #fff; }

.hint-list {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 640px) {
    .hint-list.cols-4 { grid-template-columns: repeat(4, 1fr); }
    .hint-list.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

.hint-item { display: flex; flex-direction: row; align-items: center; gap: 0.75rem; }
@media (min-width: 640px) { .hint-item { flex-direction: column; align-items: flex-start; gap: 0.5rem; } }

.hint-keys { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.hint-keys .plus { color: var(--muted); font-size: 0.875rem; margin-left: 0.25rem; }

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.125rem;
    height: 2.125rem;
    padding: 0 0.5rem;
    border-radius: 0.5rem;
    background: var(--base-100);
    border: 1px solid #4a4a4a;
    border-bottom-width: 2px;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
}

.hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: var(--base-100);
    border: 1px solid var(--border);
    font-size: 1rem;
    flex-shrink: 0;
}

.hint-item dd { margin: 0; color: var(--muted); font-size: 15px; }
@media (min-width: 640px) { .hint-item dd { font-size: 0.875rem; white-space: nowrap; } }

.hint-note {
    margin: 0.75rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: rgba(163, 163, 163, 0.8);
    line-height: 1.6;
}

/* ── 공유 토스트 ─────────────────────────────────────── */
.toast {
    position: absolute;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    max-width: calc(100% - 2rem);
}
.toast.on { opacity: 1; }
.toast div {
    background: rgba(36, 36, 36, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}
.toast span { user-select: all; word-break: break-all; }

/* ── 본문 (스크롤 시 노출 · 검색 색인 대상) ──────────── */
.below {
    max-width: 48rem;
    margin: 0 auto;
    padding: 4rem 1.25rem 5rem;
}
.below h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1rem;
    line-height: 1.3;
}
.below p { color: var(--muted); line-height: 1.8; margin: 0 0 1.5rem; }
.below .back {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    gap: 0.5rem;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.below .back:hover { color: var(--accent-300); }

.site-foot {
    border-top: 1px solid var(--border);
    background: var(--base-400);
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.875rem;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .spinner { animation: none; }
    .stage iframe, .loading, .hint, .toast { transition: none; }
}
