/* Base: "Ingeniería" color tokens (:root), page, buttons, panels; Home and Title (cover) screens */
/* Layout: a pit-wall timing screen. Track on the left, timing tower on the right, strategy desk underneath. */
:root {
  /* "Ingeniería" look (27 oct 2026, docs/diseno/): pure black, Saira type, mint-green accent */
  --asphalt: #000000;
  --panel: #111312;
  --line: rgba(255, 255, 255, 0.11);
  --fg: #e6e6e6;
  --hi: #ffffff;
  --muted: #7e8482;
  --flag: #12a486;
  --on-flag: #00130f;
  --glass: rgba(255, 255, 255, 0.04);
  --glow: #0b1a17;   /* the soft glow at the top of the page */
  --soft: #e5484d;
  --medium: #f2c94c;
  --hard: #efefea;
  --ok: #3fc79a;     /* enrolled, new entry */
  --edit: #f2c94c;   /* editing an entry */
  --rec: #c4161c;    /* FDM TV: ● REPLAY */
  --display: "Saira Condensed", "Arial Narrow", sans-serif;
  --body: "Saira", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--asphalt);
  color: var(--fg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 32px;
}
.wrap { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h1 { font-family: var(--display); font-weight: 600; font-size: 34px; letter-spacing: 0.02em; text-transform: uppercase; margin: 0; line-height: 1; text-wrap: balance; }
h1 span { color: var(--flag); }
.status { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.status b { color: var(--fg); font-weight: 500; }
.main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 820px) { .main { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.track-box { padding: 10px; }
canvas { width: 100%; height: auto; display: block; aspect-ratio: 800 / 460; max-width: 100%; }
.label { font-family: var(--display); font-weight: 500; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tower { padding: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tower-head { display: flex; justify-content: space-between; align-items: baseline; }
.row { display: grid; grid-template-columns: 26px 6px minmax(0, 1fr) 22px 54px 64px; align-items: center; gap: 8px; padding: 8px 6px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.pos { font-family: var(--display); font-weight: 600; font-size: 20px; text-align: center; }
.chip { width: 6px; height: 26px; border-radius: 2px; }
.name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.name small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.tyre { width: 22px; height: 22px; border-radius: 50%; border: 3px solid; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; font-size: 11px; color: var(--fg); }
.life { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.life i { display: block; height: 100%; border-radius: 3px; }
.gap { font-family: var(--mono); font-size: 13px; text-align: right; }
.pit { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; color: var(--asphalt); background: var(--flag); border-radius: 3px; padding: 1px 6px; }
.note { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.desk { padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tyre-pick { display: flex; gap: 6px; }
select, button { font: inherit; color: var(--fg); background: var(--asphalt); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
select { flex: 1; min-width: 0; }
button { cursor: pointer; font-family: var(--display); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 15px; }
button:hover { border-color: var(--muted); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--flag); outline-offset: 2px; }
.gate { margin: 0; font-size: 14px; color: var(--muted); }
.gate-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#skipDay { text-transform: none; letter-spacing: 0; font-family: var(--body); font-weight: 500; font-size: 14px; border-style: dashed; }
.go:disabled { opacity: 0.4; cursor: not-allowed; }
.go { background: var(--flag); color: var(--asphalt); border-color: var(--flag); padding: 10px 18px; }
.go:hover { border-color: var(--fg); }
.speed { display: flex; gap: 6px; }
.speed button { flex: 1; font-size: 14px; padding: 8px; }
.speed button[aria-pressed="true"] { border-color: var(--flag); color: var(--flag); }
#playback { gap: 4px; }
#playback button { flex: 0 0 auto; font-size: 13px; padding: 4px 8px; }
.types { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.types button { text-transform: none; letter-spacing: 0; font-family: var(--body); font-weight: 400; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; text-align: left; }
.types button[aria-pressed="true"] { border-color: var(--flag); background: color-mix(in srgb, var(--flag) 10%, var(--asphalt)); }
.types .tname { display: flex; align-items: center; gap: 6px; font-family: var(--display); font-weight: 600; font-size: 17px; text-transform: uppercase; letter-spacing: 0.04em; }
.types small { font-size: 12px; color: var(--muted); }
.types .taff { width: 100%; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.types .taff i { display: block; height: 100%; }
.slider { display: flex; align-items: center; gap: 10px; }
.slider input { flex: 1; accent-color: var(--flag); }
.slider output { font-family: var(--mono); font-size: 14px; min-width: 40px; text-align: right; }

/* ===== Home screen ===== */
.screen { display: flex; flex-direction: column; gap: 16px; }
.hero { padding: 28px 24px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 120px; background: repeating-conic-gradient(var(--fg) 0 25%, transparent 0 50%) 0 0 / 20px 20px; opacity: 0.06; pointer-events: none; }
.game-name { font-family: var(--display); font-weight: 600; font-size: clamp(44px, 9vw, 76px); line-height: 0.9; text-transform: uppercase; letter-spacing: 0.01em; margin: 0; text-wrap: balance; }
.game-name span { color: var(--flag); }
.team-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 16px; }
.badge { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 10px; border-radius: 4px; border: 1px solid var(--flag); color: var(--flag); }
.ladder { display: flex; flex-direction: column; gap: 4px; font-family: var(--display); font-weight: 500; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); position: relative; z-index: 1; }
.ladder div { display: flex; align-items: center; gap: 8px; }
.ladder i { width: 34px; height: 4px; border-radius: 2px; background: var(--line); }
.ladder .here { color: var(--flag); }
.ladder .here i { background: var(--flag); }
.menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tile { text-align: left; text-transform: none; letter-spacing: 0; font-family: var(--body); font-weight: 400; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 6px; min-height: 132px; }
.tile:hover:not([aria-disabled="true"]) { border-color: var(--flag); }
.tile.primary { grid-column: 1 / -1; border-color: var(--flag); min-height: 0; flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.tile[aria-disabled="true"] { cursor: default; opacity: 0.6; }
.tile-title { font-family: var(--display); font-weight: 600; font-size: 26px; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1; }
.tile-sub { font-size: 14px; color: var(--muted); }
.tile-tag { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: auto; }
.tile.primary .tile-tag { margin: 0; background: var(--flag); color: var(--asphalt); padding: 8px 14px; border-radius: 6px; font-size: 15px; }
.back { font-size: 14px; padding: 6px 12px; }

/* ===== Title screen ===== */
/* The cover fills the whole browser window, edge to edge, with no scroll (30 oct 2026). Only this screen leaves the page's
   max width and margins: the other screens keep them. Logo, tagline and menu shrink with the window's height (dvh). */
#screen-title { position: fixed; inset: 0; z-index: 10; width: 100%; height: 100dvh; }
.title-screen { position: relative; width: 100%; height: 100%; overflow: hidden; border: 0; border-radius: 0; background: #000; display: flex; flex-direction: column; }
body:has(#screen-title:not([hidden])) { overflow: hidden; }
body.fdm-test #screen-title { top: 26px; height: calc(100dvh - 26px); }   /* test mode: below its red strip */
.title-screen canvas { display: none; }   /* the track silhouette gave way to the cover photo */
/* Cover photo, darkened on the left (logo and menu) and at the bottom (the band of facts) */
.cv-bg { position: absolute; inset: 0; z-index: 0; background: url("../assets/portada/portada-pilotos.jpg") 100% 50% / cover; }   /* v3 photo: right edge, so the green driver and the black-and-gold champion stand clear of the menu */
.cv-scrim { position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .9) 0%, rgba(0, 0, 0, .6) 32%, rgba(0, 0, 0, .05) 60%, rgba(0, 0, 0, 0) 100%), linear-gradient(0deg, rgba(0, 0, 0, .8) 0%, rgba(0, 0, 0, 0) 30%); }
.title-inner { position: relative; z-index: 2; flex: 1 1 auto; min-height: 0; width: 100%; padding: clamp(16px, 5dvh, 56px) clamp(20px, 6vw, 96px); display: flex; flex-direction: column; justify-content: center; gap: clamp(14px, 3.4dvh, 32px); }
.title-inner .game-name { font-size: clamp(48px, min(13vw, 14dvh), 150px); }
.title-inner .label { margin-top: clamp(4px, 1dvh, 10px) !important; font-size: clamp(13px, 1.9dvh, 16px) !important; }
.cv-tag { font-family: var(--body); font-size: clamp(15px, 2.6dvh, 24px); line-height: 1.35; color: #fff; max-width: min(460px, 33vw); margin: clamp(6px, 2dvh, 18px) 0 0; }   /* narrow enough to stay clear of the drivers */
/* The band of facts: in the flow, under the menu, always at the bottom of the window */
.cv-band { position: relative; z-index: 2; flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: clamp(10px, 2.4dvh, 24px) clamp(20px, 6vw, 96px); background: rgba(0, 0, 0, .72); }
.cv-band div { display: flex; flex-direction: column; gap: 2px; font-family: var(--body); color: var(--muted); font-size: clamp(12px, 1.6dvh, 15px); }
.cv-band b { font-family: var(--display); font-style: italic; font-size: clamp(22px, 3.6dvh, 36px); line-height: 1; color: var(--flag); }
@media (max-width: 760px) {
  .cv-band { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(6px, 1.4dvh, 12px); padding: clamp(10px, 2dvh, 16px) 16px; }
  .cv-band b { font-size: clamp(20px, 3.2dvh, 26px); }
  .cv-band div { font-size: 13px; }
  .cv-tag { max-width: none; }
  .cv-bg { background-position: 80% 50%; }   /* phone: the black-and-gold champion in the middle (there is no room beside the menu) */
}
.title-menu { display: flex; flex-direction: column; gap: clamp(6px, 1.2dvh, 10px); width: min(clamp(260px, 36dvh, 340px), 100%); }
.title-menu button { text-align: left; font-size: clamp(16px, 2.6dvh, 22px); padding: clamp(6px, 1.35dvh, 12px) 18px; background: color-mix(in srgb, var(--asphalt) 80%, transparent); display: flex; justify-content: space-between; align-items: center; }
.title-menu button::after { content: "›"; color: var(--muted); font-size: 24px; line-height: 1; }
.title-menu button:hover, .title-menu button:focus-visible { border-color: var(--flag); color: var(--flag); }
.title-menu .start { background: var(--flag); color: var(--asphalt); border-color: var(--flag); font-size: clamp(20px, 3.3dvh, 28px); }
.title-menu .start::after { color: var(--asphalt); }
.title-menu .start:hover, .title-menu .start:focus-visible { color: var(--asphalt); border-color: var(--fg); }
.version { display: none; font-family: var(--mono); font-size: 12px; color: var(--muted); }   /* hidden on the cover (Ingeniería design) */

/* "Test version" tag on the cover: friends know their game can be reset (3 nov 2026) */
.cv-beta { display: inline-block; margin-bottom: clamp(6px, 1.4dvh, 12px); padding: 3px 10px; border: 1px solid var(--edit); color: var(--edit); font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; background: rgba(0, 0, 0, .55); }
