/* ============================================================
   OGACIAL — DESIGN SYSTEM CORE
   Single typeface: DM Sans. Sharp geometry. No rounded corners.
   ============================================================ */

:root {
  /* — Palette: glacial expedition. Deep ink, steel surfaces, ice accent — */
  --ink-0: #07090d;            /* deepest backdrop */
  --ink-1: #0b0e14;            /* primary surface */
  --ink-2: #11151d;            /* raised surface */
  --ink-3: #171c26;            /* interactive surface */
  --ink-4: #1f2531;            /* hover surface */

  --line-0: #232a37;           /* hairline borders */
  --line-1: #303949;           /* emphasized borders */

  --text-0: #eef2f6;           /* primary text */
  --text-1: #9aa7b8;           /* secondary text */
  --text-2: #5d6a7d;           /* tertiary / labels */

  --ice: #6fe3d2;              /* primary accent — glacial */
  --ice-dim: #3f9c90;
  --ice-deep: #0f2b29;

  --ember: #e8a94f;            /* secondary accent — warmth / rarity */
  --danger: #e25d5d;
  --success: #6fce7e;

  /* — Geometry — */
  --radius: 0px;               /* the game is made of blocks; so is the UI */
  --bevel: 2px;                /* notch size for clipped corners */
  --hairline: 1px solid var(--line-0);

  /* — Type scale (DM Sans only) — */
  --font: "DM Sans", sans-serif;
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 24px;
  --fs-2xl: 34px;
  --fs-display: clamp(56px, 9vw, 104px);

  --ls-tight: -0.02em;
  --ls-label: 0.14em;          /* uppercase micro-labels */

  /* — Spacing rhythm — */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* — Motion — */
  --t-fast: 120ms cubic-bezier(0.2, 0, 0, 1);
  --t-med: 240ms cubic-bezier(0.2, 0, 0, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--ink-0);
  color: var(--text-0);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  letter-spacing: var(--ls-tight);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

img { display: block; max-width: 100%; }
button, input, select { font: inherit; letter-spacing: inherit; color: inherit; }
input { user-select: text; }

h1, h2, h3 { font-weight: 700; line-height: 1.15; }

::selection { background: var(--ice); color: var(--ink-0); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--ink-1); }
::-webkit-scrollbar-thumb { background: var(--line-1); border: 1px solid var(--ink-1); }
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

/* ---------- Layers ---------- */
#game-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}

#ui-root { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#screen-layer, #hud-layer { position: absolute; inset: 0; }
#screen-layer > * { pointer-events: auto; }
#toast-layer {
  position: absolute; top: var(--s5); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--s2); align-items: center;
  z-index: 50;
}

.hidden { display: none !important; }

/* ---------- Shared micro-label ---------- */
.label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--text-2);
}

/* ---------- Boot screen ---------- */
#boot-screen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--ink-0);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--s5);
  transition: opacity 400ms ease, visibility 400ms ease;
}
#boot-screen.done { opacity: 0; visibility: hidden; }

.boot-mark { display: flex; flex-direction: column; align-items: center; gap: var(--s4); }

.boot-voxel {
  width: 28px; height: 28px;
  background: var(--ice);
  animation: voxel-spin 1.4s steps(4) infinite;
}
@keyframes voxel-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.boot-title {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: 0.32em;
  text-indent: 0.32em; /* optically center the tracked text */
}

.boot-bar {
  width: 220px; height: 2px;
  background: var(--line-0);
}
.boot-bar-fill {
  width: 0%; height: 100%;
  background: var(--ice);
  transition: width 200ms ease;
}

.boot-status {
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--ls-label);
  color: var(--text-2);
}

/* ---------- Toasts ---------- */
.toast {
  pointer-events: auto;
  background: var(--ink-2);
  border: var(--hairline);
  border-left: 2px solid var(--ice);
  padding: var(--s3) var(--s4);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-0);
  min-width: 260px;
  animation: toast-in var(--t-med) both;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
