/* 홈페이지 3D 세계 — 화면 전체 캔버스, 위에 UI. #list 는 WebGL 이 없을 때(body 에 .gl 이 없을 때)만 보인다 */
:root { --ink: #F4F1E8; --deep: #0E1A1C; --line: rgba(244,241,232,.25); color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--deep); color: var(--ink); font-family: 'Pretendard Variable', 'Pretendard JP Variable', system-ui, sans-serif; }
html:lang(ko) body { word-break: keep-all; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: none; touch-action: none; }
body.gl { overflow: hidden; }
body.gl #world { display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#ui > * { pointer-events: auto; }
.w-logo { position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); }
.w-logo img { display: block; height: 22px; width: auto; filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.w-langs { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); display: flex; align-items: baseline; gap: 10px; font-size: 13px; line-height: 20px; }
.w-langs a { color: var(--ink); text-decoration: none; opacity: .75; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.w-langs a[aria-current] { opacity: 1; font-weight: 700; }
#list { padding: 84px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); max-width: 880px; margin: 0 auto; }
body.gl #list { display: none; }
#list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
#list li { border: 1px solid var(--line); padding: 18px; }
#list h2 { margin: 4px 0 8px; font-size: 22px; }
#list .kind { margin: 0; font-size: 12px; letter-spacing: .12em; opacity: .7; }
#list p { line-height: 1.6; }
#list .ctas { display: flex; flex-wrap: wrap; gap: 10px; }
#list .btn { display: inline-block; padding: 9px 16px; border: 1px solid var(--ink); color: var(--ink); text-decoration: none; font-size: 14px; }
#list .btn.solid { background: var(--ink); color: var(--deep); }

/* 세계 위 UI — 납작한 종이 카드 + 굵은 잉크 테두리 (세계 그림체와 맞춤) */
/* 로딩: 화면 전체를 덮고(빈 세계가 보이지 않게) 로고 · 막대 · 몇 % — 다 오면 걷힌다 */
.w-loading { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(120% 90% at 50% 40%, #1F3A3B, #0E1A1C 70%); transition: opacity .6s ease, visibility 0s linear .6s; pointer-events: none; }
.w-load-in { display: grid; gap: 16px; justify-items: center; color: #F4F1E8; }
.w-load-in img { width: min(62vw, 240px); height: auto; }
.w-loading i { display: block; width: min(62vw, 240px); height: 4px; background: rgba(244,241,232,.18); overflow: hidden; border-radius: 2px; }
.w-loading b { display: block; width: 100%; height: 100%; background: #F4F1E8; transform: scaleX(0); transform-origin: 0 50%; transition: transform .25s ease-out; }
.w-loading span { font-size: 13px; letter-spacing: .1em; opacity: .85; }
.w-loading em { font-style: normal; font-variant-numeric: tabular-nums; }
.w-loading.done { opacity: 0; visibility: hidden; }
.w-loading:not(.done) { transition: opacity .3s ease; }
html:not(.js) #wload, body:not(.gl) #wload { display: none; }   /* 스크립트 · 3D 가 없으면 덮지 않는다 (게임 목록이 보이게) */
.w-listbtn { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); font: 600 14px/1 inherit; font-family: inherit; padding: 12px 16px; background: #F4F1E8; color: #1D2422; border: 2px solid #1D2422; box-shadow: 3px 3px 0 #1D2422; cursor: pointer; }
.w-listbtn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #1D2422; }
.w-card { position: absolute; left: 50%; bottom: max(78px, calc(env(safe-area-inset-bottom) + 70px)); transform: translateX(-50%); width: min(440px, calc(100% - 32px)); background: #F4F1E8; color: #1D2422; border: 2px solid #1D2422; box-shadow: 5px 5px 0 #1D2422; padding: 16px 18px 18px; animation: wcard .28s ease-out; }
@keyframes wcard { from { transform: translate(-50%, 14px); } to { transform: translate(-50%, 0); } }
.w-x { position: absolute; top: 2px; right: 2px; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #1D2422; font: 700 20px/1 system-ui, sans-serif; opacity: .55; cursor: pointer; }
.w-x:hover, .w-x:focus-visible { opacity: 1; }
.w-card .w-kind { padding-right: 26px; }
.w-card h2 { margin: 2px 0 6px; font-size: 21px; line-height: 1.25; overflow-wrap: anywhere; text-wrap: balance; }
.w-kind { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: #5B6563; }
.w-body { margin: 0 0 12px; font-size: 14px; line-height: 1.6; }
.w-ctas { display: flex; flex-wrap: wrap; gap: 8px; }
.w-btn { display: inline-block; padding: 10px 14px; border: 2px solid #1D2422; color: #1D2422; text-decoration: none; font-weight: 700; font-size: 14px; background: transparent; }
.w-btn.solid { background: #1D2422; color: #F4F1E8; }
.w-tabs { display: flex; gap: 6px; margin: 8px 0 4px; flex-wrap: wrap; }
.w-tabs button { font: inherit; font-size: 12px; font-weight: 700; padding: 5px 10px; border: 2px solid #1D2422; background: transparent; color: #1D2422; cursor: pointer; }
.w-tabs button[aria-selected="true"] { background: #1D2422; color: #F4F1E8; }
.w-map { position: absolute; inset: 0; background: rgba(14,26,28,.55); display: grid; place-items: center; padding: 16px; }
.w-map[hidden] { display: none; }
.w-map-in { position: relative; width: min(560px, 100%); max-height: calc(100% - 32px); overflow: auto; background: #F4F1E8; color: #1D2422; border: 2px solid #1D2422; box-shadow: 6px 6px 0 #1D2422; padding: 18px; display: grid; gap: 14px; }
.w-classic { justify-self: center; padding: 8px 12px; font-size: 14px; font-weight: 700; color: #1D2422; text-decoration: underline; text-underline-offset: 3px; }
.w-map h2 { margin: 0 0 8px; font-size: 13px; letter-spacing: .14em; color: #5B6563; }
.w-map ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.w-map li button { width: 100%; text-align: left; font: inherit; padding: 10px 12px; border: 2px solid #1D2422; background: #fff; color: #1D2422; cursor: pointer; display: grid; gap: 3px; min-height: 64px; }
.w-map li b { font-size: 15px; overflow-wrap: anywhere; }
.w-map li span { font-size: 11px; color: #5B6563; }
.w-map li button:hover, .w-map li button:focus-visible { background: #DDEFEA; }
.w-close { justify-self: end; font: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; border: 2px solid #1D2422; background: transparent; color: #1D2422; cursor: pointer; }
.w-fade { position: fixed; inset: 0; background: #F4F1E8; opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 5; }
.w-fade.on { opacity: 1; }
#ui button:focus-visible, #ui a:focus-visible { outline: 3px solid #22D3C5; outline-offset: 2px; }
@media (max-width: 520px) { .w-map ul { grid-template-columns: 1fr; } .w-card h2 { font-size: 19px; } }
@media (prefers-reduced-motion: reduce) { .w-card { animation: none; } .w-fade { transition: none; } .w-loading { transition: none; } }
/* 휴대폰 가로 등 낮은 화면: 카드를 왼쪽 아래로 작게 — 가운데의 주인공을 가리지 않게 */
@media (max-height: 500px) and (orientation: landscape) {
  .w-card { left: auto; right: max(16px, env(safe-area-inset-right)); top: max(44px, env(safe-area-inset-top)); bottom: auto; transform: none; width: min(320px, 40vw); padding: 10px 12px 12px; animation: none; }
  .w-card h2 { font-size: 16px; } .w-body { font-size: 12px; line-height: 1.5; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .w-btn { padding: 7px 10px; font-size: 13px; } .w-tabs { margin: 4px 0 2px; }
}
.w-hint { position: absolute; left: 50%; top: max(64px, calc(env(safe-area-inset-top) + 52px)); transform: translateX(-50%); margin: 0; padding: 8px 14px; background: #1D2422; color: #F4F1E8; font-size: 13px; font-weight: 600; border: 2px solid #F4F1E8; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
.w-hint[hidden] { display: none; }
.w-fps { position: absolute; right: 8px; top: 40px; font: 12px/1 monospace; color: #fff; text-shadow: 0 1px 2px #000; }

/* 엄지 자리(화면 아래)는 비워 둔다: 휴대폰 세로에서는 카드를 위쪽에 */
@media (max-width: 720px) and (orientation: portrait) {
  .w-card { top: max(54px, calc(env(safe-area-inset-top) + 46px)); bottom: auto; }
  @keyframes wcard { from { transform: translate(-50%, -12px); } to { transform: translate(-50%, 0); } }
  .w-hint { top: auto; bottom: max(78px, calc(env(safe-area-inset-bottom) + 70px)); }
}
/* 보이지 않는 로딩 표시가 터치를 막지 않게, 당겨서 새로고침 막기 */
#ui > .w-loading { pointer-events: none; }
html, body { overscroll-behavior: none; }
.w-card, .w-logo, .w-langs, .w-listbtn { touch-action: manipulation; }
