/* ==========================================================
   Fonts
   Baumans (headings) is self-hosted below from /fonts — no
   external request needed, works fully offline.
   "Technology" is a commercial/non-CDN display font used for
   numbers/scores. If you own a license, drop the font files into
   /fonts and uncomment the @font-face block below. Until then,
   the game falls back to Orbitron (a free, LCD/digital-style
   Google Font loaded via CDN) which visually fills the same role.
   ========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700&display=swap');

@font-face {
  font-family: 'Baumans';
  src: url('assets/fonts/Baumans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/*
@font-face {
  font-family: 'Technology';
  src: url('assets/fonts/technology.woff2') format('woff2'),
       url('assets/fonts/technology.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
*/

:root {
  /* ---- Base palette (as specified) ---- */
  --color-bg: rgb(178, 190, 181);        /* background */
  --color-secondary: rgb(108, 180, 238); /* platforms / secondary UI accent */
  --color-coin: rgb(233, 214, 107);      /* coins */
  --color-danger: rgb(255, 0, 128);      /* obstacles / "you're out" */

  /* ---- Shades derived from the background colour ---- */
  --color-bg-darker-1: rgb(158, 170, 161);
  --color-bg-darker-2: rgb(138, 150, 141);
  --color-bg-darker-3: rgb(108, 120, 111);
  --color-bg-lighter-1: rgb(198, 210, 201);
  --color-bg-lighter-2: rgb(218, 228, 220);

  /* ---- Shades derived from the secondary colour ---- */
  --color-secondary-dark: rgb(78, 150, 208);
  --color-secondary-light: rgb(158, 210, 248);

  /* ---- Shades derived from the coin colour ---- */
  --color-coin-dark: rgb(203, 184, 77);
  --color-coin-light: rgb(245, 232, 158);

  /* ---- Text / surfaces ---- */
  --color-text: rgb(30, 34, 31);
  --color-text-inverse: rgb(245, 247, 245);
  --color-surface: rgb(218, 228, 220);
  --color-surface-border: rgb(138, 150, 141);

  /* ---- Fonts ---- */
  --font-heading: 'Baumans', cursive;
  --font-number: 'Technology', 'Orbitron', monospace;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}

.heading {
  font-family: var(--font-heading);
  font-weight: 400;
  letter-spacing: 0.5px;
  margin: 0 0 0.25em 0;
  color: var(--color-text);
}

.number {
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 0%, var(--color-bg-lighter-2), var(--color-bg) 70%);
}

.screen.active { display: flex; }

.panel {
  background: var(--color-surface);
  border: 2px solid var(--color-surface-border);
  border-radius: 16px;
  padding: 2.5rem 3rem;
  width: min(480px, 90vw);
  text-align: center;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
}

.subtitle {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--color-bg-darker-3);
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}

#login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

#login-form input {
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 2px solid var(--color-surface-border);
  background: var(--color-bg-lighter-2);
  color: var(--color-text);
}

#login-form input:focus {
  outline: none;
  border-color: var(--color-secondary);
}

.btn {
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  border: none;
  display: inline-block;
  text-decoration: none;
  text-align: center;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--color-secondary);
  color: var(--color-text-inverse);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  margin-top: 1rem;
  background: transparent;
  color: var(--color-bg-darker-3);
  border: 2px solid var(--color-surface-border);
}
.btn-ghost:hover { background: var(--color-bg-lighter-1); }

.message {
  font-size: 0.9rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  margin: 0 0 1rem 0;
}
.message.error {
  background: rgba(255,0,128,0.12);
  color: rgb(140, 0, 70);
  border: 1px solid var(--color-danger);
}
.message.info {
  background: rgba(108,180,238,0.15);
  color: rgb(30, 80, 120);
  border: 1px solid var(--color-secondary);
}
.message.success {
  background: rgba(233,214,107,0.2);
  color: rgb(110, 92, 10);
  border: 1px solid var(--color-coin-dark);
}

.highscore-list {
  text-align: left;
  padding-left: 1.2rem;
  max-height: 50vh;
  overflow-y: auto;
}
.highscore-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-bg-darker-1);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.highscore-list li:last-child { border-bottom: none; }

.score-final { font-size: 1.2rem; }
.score-final .number { font-size: 1.5rem; color: var(--color-coin-dark); }

/* ---------------- Game screen ---------------- */
#screen-game {
  display: none;
  background: var(--color-bg);
  padding: 0;
}
#screen-game.active { display: block; }

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--color-bg);
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 2rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(to bottom, rgba(30,34,31,0.55), transparent);
  color: var(--color-text-inverse);
  font-size: 1.1rem;
  pointer-events: none;
}
.hud-item { display: flex; align-items: center; gap: 0.4rem; }
.hud-hint {
  margin-left: auto;
  font-size: 0.85rem;
  opacity: 0.85;
}

#pause-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(30,34,31,0.55);
  color: var(--color-text-inverse);
}
#pause-overlay[hidden] { display: none; }

#level-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-heading);
  font-size: 3rem;
  color: var(--color-text-inverse);
  text-shadow: 0 4px 12px rgba(0,0,0,0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#level-banner.show { opacity: 1; }
#level-banner.hidden { display: none; }

/* ---------------- Standalone highscore / admin pages ---------------- */
.page-wrap {
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.5rem;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 0%, var(--color-bg-lighter-2), var(--color-bg) 70%);
}

.panel-wide {
  background: var(--color-surface);
  border: 2px solid var(--color-surface-border);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  width: min(760px, 95vw);
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
}

.panel-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.admin-gate {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.admin-gate input {
  flex: 1;
  min-width: 180px;
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 2px solid var(--color-surface-border);
  background: var(--color-bg-lighter-2);
  color: var(--color-text);
}
.admin-gate input:focus {
  outline: none;
  border-color: var(--color-secondary);
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 60vh;
  border: 1px solid var(--color-bg-darker-1);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}
.data-table th, .data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--color-bg-darker-1);
  white-space: nowrap;
}
.data-table th {
  position: sticky;
  top: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-bg-darker-3);
  background: var(--color-surface);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table td.score-cell { font-family: var(--font-number); font-variant-numeric: tabular-nums; }