/* load156: the loading screen before anything else arrives (public/js/boot.js) — logo, spinner, the stage line
   ("กำลังโหลดภาษา… 45%") and the slow-load card (ลองใหม่ / ล้างแคชแล้วโหลดใหม่). Small and render-blocking on purpose:
   everything else (the game's stylesheet bundle /css/__b.css) loads after the first screen. Copies the few base rules of
   style.css the loading screen needs, so it looks the same before and after the bundle. */
:root {
  --wood-0: #140d07; --gold-1: #8a6324; --gold-3: #f0cf72; --gold-4: #fff0b8; --ink: #f4e6c4; --ink-dim: #b8a27a;
  --f-ui: "Kanit", "Noto Sans Thai", "Noto Sans Lao", "Noto Sans Myanmar", "Noto Sans SC", "Noto Sans KR", "Noto Sans JP", system-ui, sans-serif;
  --screen-bg: radial-gradient(ellipse at 50% 0%, rgba(240, 207, 114, .16), transparent 60%), radial-gradient(ellipse at 50% 120%, rgba(43, 181, 160, .14), transparent 55%), linear-gradient(#1f150c, #120b06);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --wood-0: #ecdcb8; --gold-1: #c7a159; --gold-3: #8f5f0e; --gold-4: #6e4508; --ink: #3b2a17; --ink-dim: #725a3c;
  --screen-bg: radial-gradient(ellipse at 50% -10%, rgba(255, 255, 255, .9), transparent 60%), radial-gradient(ellipse at 50% 120%, rgba(120, 190, 110, .35), transparent 60%), linear-gradient(#f9eed6, #e6d2a8);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--wood-0); color: var(--ink); font-family: var(--f-ui); font-size: 15px; }
[hidden] { display: none !important; }
#app, .screen { position: fixed; inset: 0; }
.screen { overflow: hidden; }
.center { display: grid; place-items: center; padding: 16px; text-align: center; }
#scr-loading { background: var(--screen-bg); align-content: center; gap: 0; }
.boot-logo { display: block; width: min(340px, 80vw); height: auto; margin: 0 auto; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .45)); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--gold-1); border-top-color: var(--gold-3); animation: spin 1s linear infinite; margin: 20px auto 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* the stage line under the spinner */
.boot-stage { min-height: 1.4em; margin: 14px 0 0; font-size: 14px; color: var(--ink-dim); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.boot-bar { width: min(240px, 64vw); height: 4px; margin: 10px auto 0; border-radius: 4px; background: rgba(138, 99, 36, .35); overflow: hidden; }
.boot-bar > i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--gold-1), var(--gold-3)); transition: width .25s ease-out; }

/* the slow-load card: above everything (also above the language picker and the game), never covering the whole screen */
.l156-slow { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 2147483000;
  width: min(420px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 14px; text-align: center;
  background: rgba(20, 13, 7, .94); color: #f4e6c4; border: 1px solid #8a6324; box-shadow: 0 10px 34px rgba(0, 0, 0, .5); font-family: var(--f-ui); }
.l156-slow b { display: block; font-size: 16px; color: #f0cf72; }
.l156-slow p { margin: 6px 0 10px; font-size: 13px; line-height: 1.45; color: #e2cfa6; }
.l156-slow small { display: block; margin-top: 8px; font-size: 12px; color: #b8a27a; font-variant-numeric: tabular-nums; }
.l156-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.l156-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid #8a6324;
  background: linear-gradient(#4a3520, #2b1d10); color: #fff0b8; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.l156-btn.gold { background: linear-gradient(#f3c75a, #c48a23); color: #2a1300; border-color: #f0cf72; }
.l156-btn:focus-visible { outline: 2px solid #f0cf72; outline-offset: 2px; }
.l156-btn[hidden] { display: none; } /* fix390: ใช้ภาพแบบปกติ only when a 3D mode may be the cause */
@media (orientation: landscape) and (max-height: 500px) { .l156-slow { bottom: 8px; padding: 10px 14px; } .l156-slow p { margin: 4px 0 8px; } }

/* /sw-reset */
.l156-reset { display: grid; place-items: center; background: var(--screen-bg); }
.l156-reset-box { width: min(420px, calc(100vw - 32px)); text-align: center; }
.l156-reset-box img { width: min(220px, 60vw); height: auto; }
.l156-reset-box p { color: var(--ink-dim); }
/* fix390: Settings → Session — 🧹 clear the cache and reload */
.f390-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.f390-row .f390-note { flex: 1 1 220px; min-width: 0; line-height: 1.4; opacity: .85; }
