/* style.css — base layout, loading screen, design tokens. */

:root {
  --c-bg: #0a1220;
  --c-panel: rgba(13, 22, 40, 0.82);
  --c-panel-border: rgba(127, 212, 255, 0.18);
  --c-text: #e8f1fc;
  --c-text-dim: #8fa5c4;
  --c-accent: #37b6ff;
  --c-accent-2: #7fd4ff;
  --c-gold: #ffd166;
  --c-danger: #ff5a6e;
  --font-display: 'Arial Black', 'Segoe UI', Arial, sans-serif;
  --font-body: 'Segoe UI', Arial, sans-serif;

  /* ---- elevation scale ----
     One shadow per height, used consistently, so the interface reads as
     stacked surfaces rather than as flat layers sharing one drop shadow.
     Each step adds both a tighter contact shadow and a wider ambient one,
     which is what makes a raised element look raised. */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.22);
  --sh-2: 0 2px 4px rgba(0, 0, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.3);
  --sh-3: 0 4px 8px rgba(0, 0, 0, 0.32), 0 14px 34px rgba(0, 0, 0, 0.38);
  --sh-4: 0 8px 18px rgba(0, 0, 0, 0.36), 0 28px 70px rgba(0, 0, 0, 0.46);
  /* Accent glow, re-tinted per location by UIManager.applyTheme(). */
  --sh-glow: 0 0 22px rgba(55, 182, 255, 0.42);

  /* The live location accent. Every map's own palette is written into
     these at run start, so the whole UI wears the mountain you are on. */
  --c-map-accent: #37b6ff;
  --c-map-neon: #ffb347;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Scrolling stays (wheel/touch), but scrollbars never show. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  overscroll-behavior: none;
  touch-action: none;
  /* Stops tablets showing the magnifier / selection context menu on
     long-press and double-tap. */
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#app {
  position: fixed;
  inset: 0;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#ui-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#ui-root > * { pointer-events: auto; }

/* Full-screen effect layers must never eat a click or a touch. */
#ui-root > .fx-overlay { pointer-events: none; }

.hidden { display: none !important; }

/* ---------------- boot loading screen ---------------- */

#screen-loading {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 120%, #16345c 0%, transparent 60%),
    linear-gradient(180deg, #060b16 0%, #0a1220 55%, #10203a 100%);
  transition: opacity 0.6s ease;
}

#screen-loading.hidden {
  display: flex !important;
  opacity: 0;
  pointer-events: none;
}

.loading-inner {
  text-align: center;
  max-width: 420px;
  padding: 2rem;
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 3rem);
  letter-spacing: 0.06em;
  font-style: italic;
  text-shadow: 0 2px 24px rgba(55, 182, 255, 0.55);
}

.game-title span {
  background: linear-gradient(180deg, #d9f1ff 20%, #37b6ff 70%, #1668b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#loading-bar {
  height: 8px;
  margin: 1.6rem 0 0.8rem;
  background: rgba(127, 212, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

#loading-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-2));
  box-shadow: 0 0 12px rgba(55, 182, 255, 0.8);
  transition: width 0.25s ease;
}

#loading-status {
  color: var(--c-text-dim);
  font-size: 0.85rem;
}

#loading-status code {
  color: var(--c-accent-2);
}

/* ---------------- shared panel & buttons ---------------- */

.panel {
  background: var(--c-panel);
  border: 1px solid var(--c-panel-border);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--sh-3);
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: var(--c-text);
  background: linear-gradient(180deg, rgba(41, 66, 110, 0.9), rgba(22, 38, 66, 0.9));
  border: 1px solid rgba(127, 212, 255, 0.25);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-2);
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.3, 1),
    box-shadow 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

/*
 * Press ripple. The origin is written by UIManager on pointerdown, so the
 * ring grows from exactly where the finger or cursor landed — the single
 * cheapest way to make an interface feel like it is answering you.
 */
.btn::after,
.card::after,
.ride-tile::after {
  content: '';
  position: absolute;
  left: var(--rx, 50%);
  top: var(--ry, 50%);
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: scale(1);
}

.btn.rippling::after,
.card.rippling::after,
.ride-tile.rippling::after {
  animation: ui-ripple 0.5s ease-out;
}

@keyframes ui-ripple {
  0% { opacity: 0.42; transform: scale(1); }
  100% { opacity: 0; transform: scale(34); }
}

.btn:hover:not(:disabled) {
  /* Magnetic hover: --mx/--my are written by UIManager from the pointer's
     offset within the element, so the button leans toward the cursor. */
  transform: translate(calc(var(--mx, 0) * 3px), calc(-2px + var(--my, 0) * 2px)) scale(1.02);
  border-color: rgba(127, 212, 255, 0.75);
  background: linear-gradient(180deg, rgba(52, 84, 138, 0.95), rgba(28, 48, 82, 0.95));
  box-shadow: var(--sh-3), var(--sh-glow);
}

.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }

.btn:disabled { opacity: 0.4; cursor: default; }

.btn-big { font-size: 1.2rem; padding: 0.9rem 2.2rem; }
.btn-small { font-size: 0.78rem; padding: 0.45rem 0.9rem; }

.btn-accent {
  background: linear-gradient(180deg, #2f9dff, #1668b8);
  border-color: rgba(200, 236, 255, 0.55);
}

.btn-danger {
  background: linear-gradient(180deg, #b83a4a, #7c2230);
  border-color: rgba(255, 138, 155, 0.4);
}

.btn-back {
  font-size: 1.1rem;
  padding: 0.5rem 0.95rem;
}
