/* 액자 — 캔버스 하나를 화면에 앉히는 것이 전부다.
 *
 * HUD·쪽지·단추는 전부 캔버스가 그린다(src/ui.js, 2026-09-27 「UI 는 엔진 렌더링으로」).
 * 여기 남은 것: 글꼴 등록(캔버스도 이 @font-face 를 쓴다), 판 크기, 넓은 화면의 기둥, 안전 영역 프로브, 시험 배지.
 * 껍데기 색은 CSS 가 아니라 window.__SKIN(ui.js 토큰)으로 갈아 끼운다.
 */
* { box-sizing: border-box; }


/* 메뉴 글씨 — 저작권 걱정 없는 귀여운 둥근 글꼴(Fredoka, SIL OFL).
 * 우리가 파일을 안고 간다 — 구글 폰트 주소를 부르면 크레이지게임스 iframe 이나
 * 광고 차단기 뒤에서 글꼴이 안 내려와 화면이 제각각이 된다.
 * 한글은 이 글꼴에 없으니 뒤의 시스템 글꼴이 받는다(라틴만 갈아 끼운다). */
@font-face {
  font-family: 'Fredoka'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("art/font/fredoka-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("art/font/fredoka-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* 한글은 주아(배달의민족 주아, SIL OFL). **이 게임에 나오는 글자만** 깎아 담았다
 * (tools/subset-kr.py — 2.1MB 원본을 그대로 실으면 토스 번들이 무거워진다).
 * 새 한글 문구를 넣으면 빌드가 「빠진 글자」를 일러 준다. */
@font-face {
  font-family: 'Jua'; font-style: normal; font-weight: 400; font-display: swap;
  src: url("art/font/jua-kr.woff2") format("woff2");
}

html, body {
  margin: 0; padding: 0; height: 100%;
  background: #dfe9f3;
  font: 15px/1.4 'Fredoka', 'Jua', -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#app { position: fixed; inset: 0; }

/* ── 넓은 화면(PC·크레이지게임스) ───────────────────────
 * 가로가 넓어지면 세로 판을 **가운데 기둥**으로 세운다.
 * 그냥 늘렸더니 판은 화면 한가운데 조그맣게 뜨고 위 띠만 끝에서 끝까지 늘어났다
 * (2026-09-16 1280×720 확인). 양옆은 같은 하늘 — 판 가장자리엔 흰 블록 기둥 한 줄(docs/ART-MINIMAL-3D.md §2). */
@media (min-aspect-ratio: 3/4) {
  html {
    --pb-col: min(100vw, calc(100vh * 0.5625));
    background: linear-gradient(#dfe9f3, #f6f8fb) fixed;
  }
  body { background: transparent; }
  /* 기둥 두 줄은 html 의 가짜 요소 — body::after 는 시험 계정 띠가 쓴다 */
  html::before, html::after {
    content: ""; position: fixed; top: 0; height: 100vh; width: 14px; z-index: -1;
    background: #eef1f5; border-left: 1px solid #c9d0da; border-right: 1px solid #c9d0da;
  }
  html::before { right: calc(50% + var(--pb-col) / 2); }
  html::after { left: calc(50% + var(--pb-col) / 2); }
  #app {
    left: 50%; right: auto; transform: translateX(-50%);
    width: var(--pb-col);
  }
}

/* ── 가로 액자(docs/LANDSCAPE-FRAMED.md, 2026-10-02) ───────────────────
 * game.js resize 가 화면 꼴을 html[data-layout] 에 적는다(portrait·column·land·rotate). 가로(land)·폰 가로(rotate)는
 * 캔버스를 화면 가득 편다 — 세상 그림·액자·판·HUD 를 캔버스가 다 그린다(render.js landWorld). 양옆 거울은 끈다 */
html[data-layout="land"], html[data-layout="rotate"] { background: #dfe9f3; }
html[data-layout="land"] #app, html[data-layout="rotate"] #app { left: 0; right: 0; transform: none; width: auto; }
html[data-layout="land"]::before, html[data-layout="land"]::after, html[data-layout="rotate"]::before, html[data-layout="rotate"]::after { display: none; }
/* 기둥(column — iPad·폴더블 세로, 정사각에 가까운 창)도 캔버스를 화면 가득(2026-10-02 docs/PORTRAIT-WALLS.md) — 판 양옆 여백에
 * 캔버스가 흰 블록 옆벽과 하늘·블록 실루엣을 그린다(render.js sideWalls). CSS 기둥은 벽을 그릴 자리가 없어 끈다 */
html[data-layout="column"] { background: #dfe9f3; }
html[data-layout="column"] #app { left: 0; right: 0; transform: none; width: auto; }
html[data-layout="column"]::before, html[data-layout="column"]::after { display: none; }
/* 스플래시(캔버스 바탕)의 로고는 액자 자리에 맞춰 조금 작게 */
html[data-layout="land"] #cv { background-size: auto 30%; }

/* 판이 화면을 다 쓴다 */
#field { position: absolute; inset: 0; }
/* 캔버스가 첫 장을 그리기 전에도 스플래시 — 하늘빛 바탕(bg-city 의 위 하늘 → 아래 안개와 같은 색) + 로고. 스크립트·그림보다 먼저 뜬다.
 * 캔버스는 판 스프라이트(art-gem/m3d)가 다 오기 전엔 투명이라(screens/main.js) 이 바탕이 비친다. game.js 가 홈으로 넘어가며 걷는다 */
/* -webkit-touch-callout — iOS 길게 누르기 저장 메뉴(안드로이드는 input.js 의 contextmenu 막기, 2026-10-01) */
#cv { display: block; width: 100%; height: 100%; touch-action: none; -webkit-touch-callout: none;
  background: url("art-gem/brand/loading-portrait.webp") center / cover no-repeat, #dfe9f3; }
@media (orientation: landscape) {
  #cv { background-image: url("art-gem/brand/loading-landscape.webp"); }
}
/* 안전 영역 프로브 — 캔버스는 env() 를 못 읽는다. game.js resize() 가 이 padding 을 읽어 UI.layout 에 넘긴다 */
#safe {
  position: absolute; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  /* 안드로이드 앱(Capacitor SystemBars) — 오래된 WebView 는 env() 가 0 이라 셸이 --safe-area-inset-* 로 시스템 바 높이를 준다(docs/ANDROID-PLAY.md).
   * 변수가 없으면(웹·아이폰) 위 줄의 env() 가 그대로 산다 */
  padding: var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) var(--safe-area-inset-right, env(safe-area-inset-right, 0px))
           var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
}

/* 시험용 계정임을 알린다 — 평소 기록과 딴 서랍을 쓴다(개발용이라 CSS 로 둔다). 글은 언어 표에서(game.js 가 data-test-label 에) */
body[data-test="1"]::after {
  content: attr(data-test-label);
  position: fixed; left: 0; bottom: calc(env(safe-area-inset-bottom) + 2px);
  z-index: 20; padding: 3px 9px 3px 7px; border-radius: 0 999px 999px 0;
  background: rgba(226,87,76,0.9); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: 0.4px;
  pointer-events: none;
}
