/* Slipstream — F1-inspired theme: tokens, type, shell (header/nav/boot), view transitions.
   Visual language modeled on Formula1.com / the F1 app: carbon-black + F1 red, Titillium type,
   angular speed accents, a subtle square grid, bold uppercase, broadcast tabular numbers. */

:root {
  /* Carbon surfaces */
  --bg: #0b0b0f;
  --bg-elev: #16171d;
  --bg-elev-2: #1f2026;
  --bg-elev-3: #282a31;
  --line: #2b2d35;
  --line-soft: #1f2128;
  --grid: rgba(255, 255, 255, 0.045);

  /* Text */
  --text: #ffffff;
  --text-dim: #b6b9c4;
  --text-mute: #797d8a;

  /* F1 red + accents */
  --accent: #e10600;          /* F1 red */
  --accent-bright: #ff1801;   /* F1 logo bright red */
  --accent-soft: #ff3b3b;
  --accent-tint: rgba(225, 6, 0, 0.14);
  --gold: #e0b13a;
  --teal: #2ee6c6;
  --purple: #9b5cff;
  --green: #3fd07a;
  --danger: #ff3b46;

  /* Geometry — F1 is sharp / angular */
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --skew: -13deg;

  --header-h: 56px;
  --nav-h: 66px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.55);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.5);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);

  --font: "Titillium Web", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh;
  overscroll-behavior-y: none;
}
body {
  padding-top: calc(var(--header-h) + var(--safe-top));
  padding-bottom: calc(var(--nav-h) + var(--safe-bot));
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; }

/* Tabular numbers for broadcast-style figures */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--bg-elev-2) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elev-2); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line); }

/* ---- Header ---- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top); padding-left: 16px; padding-right: 10px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(11, 11, 15, 0.9);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
}
.app-wordmark {
  font-weight: 900; font-size: 19px; letter-spacing: 0.02em; text-transform: uppercase;
  cursor: pointer; display: flex; align-items: center;
}
/* Angular F1-style "speed" mark */
.app-wordmark::before {
  content: ""; display: inline-block; width: 15px; height: 19px; margin-right: 10px;
  background: var(--accent);
  clip-path: polygon(26% 0, 100% 0, 74% 100%, 0 100%);
}
.header-btn {
  width: 38px; height: 38px; border: 0; background: transparent;
  color: var(--text-dim); font-size: 20px; border-radius: var(--radius-sm); cursor: pointer;
}
.header-btn:active { background: var(--bg-elev-2); }

/* ---- Bottom nav ---- */
.app-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  display: flex;
  background: rgba(13, 14, 18, 0.94);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 100;
}
.nav-item {
  position: relative; flex: 1; background: none; border: 0; cursor: pointer;
  color: var(--text-mute);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  transition: color 0.15s, transform 0.1s;
}
.nav-item .nav-ico { font-size: 17px; line-height: 1; }
.nav-item::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 0; height: 3px; background: var(--accent); transition: width 0.2s ease;
}
.nav-item.is-active { color: #fff; }
.nav-item.is-active::before { width: 40px; }
.nav-item:active { transform: scale(0.94); }

/* ---- Screen + view transitions ---- */
.screen {
  min-height: calc(100dvh - var(--header-h) - var(--nav-h));
  padding: 16px; max-width: 760px; margin: 0 auto;
  transition: opacity 0.19s ease;
}
/* Page-to-page navigation = clean crossfade */
.screen.is-leaving { opacity: 0; }
.screen.is-entering { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .screen { transition: none; } }

/* ---- Boot splash ---- */
#boot {
  position: fixed; inset: 0; z-index: 1000; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  transition: opacity 0.4s ease;
}
#boot.is-gone { opacity: 0; pointer-events: none; }
.boot-mark { font-weight: 900; letter-spacing: 0.26em; font-size: 24px; text-transform: uppercase; }
.boot-bar { width: 170px; height: 3px; background: var(--bg-elev-2); overflow: hidden; }
.boot-bar span {
  display: block; height: 100%; width: 42%; background: var(--accent);
  clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
  animation: boot-slide 0.95s ease-in-out infinite;
}
@keyframes boot-slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(370%); } }

.muted { color: var(--text-dim); font-size: 13px; line-height: 1.55; }
