/* /play page — self-contained (does not depend on site.css). */
@font-face {
  font-family: "IM Fell English";
  src: url("/fonts/im-fell-english-latin.woff2") format("woff2");
  font-display: swap;
}

:root {
  --pb-bg: #120b08;
  --pb-panel: #1e130d;
  --pb-line: #3a261a;
  --pb-ink: #f2e6d4;
  --pb-dim: #b9a58c;
  --pb-ember: #ff7a2f;
  --pb-ember-2: #ffb347;
  --pb-ok: #8fd18b;
  --pb-warn: #ffcf6e;
  --pb-err: #ff8a7a;
  --pb-bar-h: 44px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--pb-bg);
  color: var(--pb-ink);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* ---------- top bar (kept off the canvas so it never covers game UI) ---------- */
.pb-bar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--pb-bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  background: linear-gradient(#1a100b, #120b08);
  border-bottom: 1px solid var(--pb-line);
  z-index: 20;
}

.pb-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--pb-ink);
  text-decoration: none;
  font-family: "IM Fell English", Georgia, serif;
  font-size: 19px;
  letter-spacing: 0.02em;
}
.pb-brand:hover { color: var(--pb-ember-2); }

.pb-account { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; }

.pb-sync { color: var(--pb-dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-sync[data-state="synced"] { color: var(--pb-ok); }
.pb-sync[data-state="syncing"] { color: var(--pb-ember-2); }
.pb-sync[data-state="offline"], .pb-sync[data-state="conflict"] { color: var(--pb-warn); }
.pb-sync[data-state="error"] { color: var(--pb-err); }

.pb-gsi { min-height: 32px; display: flex; align-items: center; }
/* GIS renders in an iframe; under color-scheme: dark Chrome paints an opaque white backdrop behind it. */
.pb-gsi, .pb-gsi iframe { color-scheme: light; background: transparent; }

.pb-user, .pb-icon, .pb-btn, .pb-menu button {
  font: inherit;
  color: var(--pb-ink);
  background: var(--pb-panel);
  border: 1px solid var(--pb-line);
  border-radius: 999px;
  cursor: pointer;
}
.pb-user { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; max-width: 220px; }
.pb-user img { border-radius: 50%; }
.pb-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-icon { width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; }
.pb-user:hover, .pb-icon:hover, .pb-btn:hover, .pb-menu button:hover { border-color: var(--pb-ember); }
:focus-visible { outline: 2px solid var(--pb-ember-2); outline-offset: 2px; }

.pb-menu {
  position: absolute;
  right: 42px;
  top: calc(100% + 8px);
  background: var(--pb-panel);
  border: 1px solid var(--pb-line);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.pb-menu button { border-radius: 6px; padding: 6px 14px; width: 100%; text-align: left; }

/* ---------- stage + canvas ---------- */
.pb-stage {
  position: fixed;
  inset: var(--pb-bar-h) 0 0 0;
  background: #000;
}
.pb-stage:fullscreen { inset: 0; }

#glcanvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  background: #000;
  touch-action: none;
}

/* ---------- loader ---------- */
.pb-loader, .pb-notice {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 60%, #2a140a 0%, #120b08 65%);
  z-index: 10;
  transition: opacity 0.45s ease;
}
.pb-loader[hidden], .pb-notice[hidden] { display: none; }
.pb-loader.is-done { opacity: 0; pointer-events: none; }
.pb-loader h1, .pb-notice h1 {
  margin: 0;
  font-family: "IM Fell English", Georgia, serif;
  font-weight: 400;
  font-size: clamp(28px, 5vw, 44px);
  color: var(--pb-ink);
}
.pb-loader-logo { filter: drop-shadow(0 0 18px rgba(255, 122, 47, 0.55)); animation: pb-flicker 2.4s ease-in-out infinite; }
@keyframes pb-flicker { 50% { filter: drop-shadow(0 0 28px rgba(255, 179, 71, 0.75)); } }
@media (prefers-reduced-motion: reduce) { .pb-loader-logo { animation: none; } }

.pb-progress {
  width: min(420px, 80vw);
  height: 8px;
  background: #2b1b12;
  border: 1px solid var(--pb-line);
  border-radius: 999px;
  overflow: hidden;
}
.pb-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--pb-ember), var(--pb-ember-2));
  box-shadow: 0 0 12px var(--pb-ember);
  transition: width 0.25s ease;
}
.pb-loader.is-error .pb-progress-bar { background: var(--pb-err); box-shadow: none; }
.pb-loader-label { margin: 0; color: var(--pb-dim); font-variant-numeric: tabular-nums; }
.pb-loader-tip { margin-top: 18px; color: #8d7a64; font-size: 12.5px; }

.pb-notice p { max-width: 520px; color: var(--pb-dim); }
.pb-notice a { color: var(--pb-ember-2); }

.pb-btn { padding: 8px 18px; }
.pb-btn--primary { background: linear-gradient(#ff8a3d, #d9531c); border-color: #ff9c55; color: #1a0d06; font-weight: 600; }

/* ---------- cloud conflict prompt ---------- */
.pb-conflict {
  position: fixed;
  top: calc(var(--pb-bar-h) + 10px);
  right: 12px;
  width: min(380px, calc(100vw - 24px));
  background: var(--pb-panel);
  border: 1px solid var(--pb-ember);
  border-radius: 12px;
  padding: 12px 14px;
  z-index: 30;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.pb-conflict p { margin: 0 0 8px; color: var(--pb-dim); }
.pb-conflict strong { color: var(--pb-ink); }
.pb-conflict-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 560px) {
  .pb-sync { display: none; }
  .pb-brand span { display: none; }
}
