/* Lucioles — mobile d'abord ; ordinateur à partir de 900 px ; mode cockpit = html.cockpit */
:root {
  --bg: #0A1120; --surface: #121C31; --surface2: #1A2640; --line: #27365A;
  --text: #E8ECF4; --muted: #A3AEC4; --accent: #C9F25B; --accent-ink: #10170A;
  --warn: #F2A541; --off: #6B7894; --scrim: rgba(3, 6, 12, .62);
  --tiles: invert(1) hue-rotate(180deg) saturate(.35) brightness(.8) contrast(.9);
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
html.cockpit {
  --bg: #000; --surface: #0D0404; --surface2: #170706; --line: #3A0F0C;
  --text: #E0453B; --muted: #A8342C; --accent: #E0453B; --accent-ink: #000;
  --warn: #B8352D; --off: #6E211C; --scrim: rgba(0, 0, 0, .72);
  --tiles: grayscale(1) invert(1) brightness(.32) sepia(1) hue-rotate(-50deg) saturate(5);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--accent); }
a:hover { color: var(--text); }
h2 { font: 600 26px/1.15 var(--serif); margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg .fill { fill: currentColor; }
svg .reddot { fill: #E0453B; stroke: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }
.note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.desktop-only { display: none !important; }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

/* Carte */
#map { position: fixed; inset: 0; background: var(--bg); }
.leaflet-container { background: var(--bg); font: inherit; }
.base-tiles { filter: var(--tiles); }
html.cockpit .aero-tiles { filter: grayscale(1) sepia(1) hue-rotate(-50deg) saturate(5) brightness(.7); }
.leaflet-control-attribution { background: rgba(10, 17, 32, .7) !important; color: var(--muted) !important; font-size: 11px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a, .leaflet-control-layers { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-control-layers-toggle { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A3AEC4' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 8l10 5 10-5-10-5z'/%3E%3Cpath d='m2 13 10 5 10-5'/%3E%3C/svg%3E") !important; background-size: 22px !important; }

/* Symboles VFR de nuit : forme + couleur (lisibles en mode cockpit et pour les daltoniens) */
.dot { display: inline-block; border-radius: 50%; flex-shrink: 0; }
.dot-a { width: 10px; height: 10px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot-l { width: 11px; height: 11px; border: 2px solid var(--warn); background: linear-gradient(90deg, var(--warn) 50%, transparent 50%); }
.dot-r { width: 9px; height: 9px; border: 2px solid var(--warn); border-radius: 1px; transform: rotate(45deg); }
.dot-n { width: 7px; height: 7px; border: 1.5px solid var(--off); }
.mk { display: flex !important; align-items: center; justify-content: center; }
.mk.sel::after { content: ''; position: absolute; inset: 2px; border: 2px solid var(--text); border-radius: 50%; }

/* Contrôles communs */
.iconbtn { min-width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 11px; cursor: pointer; }
.iconbtn .lbl { display: none; font-size: 14px; }
.iconbtn[aria-pressed="true"] { border-color: var(--accent); }
.primary, .secondary { min-height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; text-decoration: none; cursor: pointer; font-weight: 600; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; }
.primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.secondary { border: 1px solid var(--line); color: var(--text); font-weight: 500; font-size: 14px; background: transparent; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; min-height: 44px; }
.chip { min-height: 44px; border-radius: 22px; padding: 0 16px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.chip .n { font: 500 12px var(--mono); opacity: .75; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.pip { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex-shrink: 0; }
.pip.ok { background: var(--accent); }
.links { display: flex; gap: 16px; font-size: 13px; }

/* En-tête (mobile : superposé à la carte) */
.top { position: fixed; left: 0; right: 0; top: 0; z-index: 800; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(var(--bg) 72%, transparent); pointer-events: none; }
.top > * { pointer-events: auto; }
.brandrow { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; flex-grow: 1; text-decoration: none; color: var(--text); font: 600 24px var(--serif); }
.brand:hover { color: var(--text); }
html.cockpit .brand img { filter: grayscale(1) sepia(1) hue-rotate(-50deg) saturate(6) brightness(.8); }
.search { position: relative; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.search input { flex-grow: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; }
.search input::placeholder { color: var(--muted); }
#suggest { position: absolute; left: -1px; right: -1px; top: 50px; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); max-height: 50vh; overflow: auto; }
#suggest li { display: flex; gap: 12px; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
#suggest li[aria-selected="true"], #suggest li:hover { background: var(--surface2); }
#suggest li .mono { width: 44px; color: var(--muted); font-size: 14px; }
.pill { align-self: flex-start; min-height: 36px; padding: 0 12px 0 10px; border-radius: 18px; border: 1px solid var(--warn); background: var(--surface); display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.pill svg { width: 14px; height: 14px; }
.stale { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--warn); background: var(--surface); font-size: 14px; }

/* Pied (mobile : barre du bas) */
.meta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 800; padding: 12px 16px calc(14px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; background: var(--surface); border-top: 1px solid var(--line); }
.legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.legend > span { display: flex; align-items: center; gap: 6px; }
.legend .long { display: none; }
.fresh { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.fab { position: fixed; right: 16px; bottom: calc(96px + var(--safe-b)); z-index: 800; min-height: 48px; padding: 0 18px; border-radius: 24px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; display: flex; align-items: center; gap: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); cursor: pointer; }
.fab .badge { min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent-ink); color: var(--accent); font: 500 12px var(--mono); display: flex; align-items: center; justify-content: center; }
.leaflet-bottom { bottom: calc(84px + var(--safe-b)); }
.leaflet-top { top: calc(176px + env(safe-area-inset-top, 0px)); }

/* Panneaux (mobile : tiroirs du bas) */
/* cursor: pointer : sans lui, Safari iOS ne transmet pas le toucher à un élément non cliquable */
#scrim { position: fixed; inset: 0; z-index: 900; background: var(--scrim); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 950; max-height: 80vh; overflow: auto; padding: 10px 20px calc(24px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; }
.handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); align-self: center; flex-shrink: 0; }
.sheethead { display: flex; align-items: center; gap: 8px; }
.sheethead h2 { flex-grow: 1; }
.changelist { list-style: none; margin: 0; padding: 0; }
.changelist li { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.changelist button { all: unset; cursor: pointer; font: 500 14px var(--mono); width: 44px; flex-shrink: 0; min-height: 24px; }
.changelist button.key { color: var(--warn); }
.changelist .t { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.changelist .t small { font-size: 13px; color: var(--muted); }

/* Fiche aérodrome */
.adhead { display: flex; align-items: flex-start; gap: 12px; }
.adhead > div { flex-grow: 1; }
.sub { font-size: 14px; color: var(--muted); letter-spacing: 1px; }
.status { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); }
.status .dot { width: 16px; height: 16px; }
.status .dot-r { width: 14px; height: 14px; }
.stlabel { font-size: 20px; font-weight: 600; }
.sttext { font-size: 13px; color: var(--muted); }
.change { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--warn); font-size: 14px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles > div { padding: 10px 12px; border-radius: 12px; background: var(--surface2); display: flex; flex-direction: column; gap: 2px; }
.tiles span { font-size: 12px; color: var(--muted); }
.tiles b { font-size: 16px; font-weight: 500; }
.block { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.row .who { color: var(--muted); font-size: 13px; }
.rwy { display: grid; grid-template-columns: 76px minmax(0, 1.4fr) minmax(0, 1fr) 64px; font-size: 14px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.rwy > :last-child { text-align: right; }
.actions { display: flex; gap: 10px; }
.actions .primary { flex-grow: 1; }
.actions a { white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; }
.vactext { font-size: 14px; line-height: 1.5; padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--warn); font-size: 14px; line-height: 1.5; }
.nighthead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nighthead input { font: 500 14px var(--mono); color: var(--text); background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; min-height: 40px; padding: 0 10px; color-scheme: dark; }
.nightgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.nightgrid > div { padding: 10px 12px; border-radius: 12px; background: var(--surface2); display: flex; flex-direction: column; gap: 2px; }
.nightgrid span { font-size: 12px; color: var(--muted); }
.nightgrid b { font: 500 18px var(--mono); }
.nightgrid small { font-size: 12px; color: var(--muted); }
.vactext .hint { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }

/* Bienvenue */
.modal { position: fixed; z-index: 1000; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 32px)); padding: 28px 24px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.modal h2 { font-size: 28px; }
.modal p { margin: 0; }
.warnbox { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--warn); font-size: 14px; }
.modal .links { justify-content: center; }
.offline { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.offline progress { width: 100%; accent-color: var(--accent); }

/* Ordinateur */
@media (min-width: 900px) {
  .mobile-only { display: none !important; }
  .desktop-only { display: block !important; }
  nav.desktop-only { display: flex !important; }
  #map { left: 380px; }
  #side { position: fixed; left: 0; top: 0; bottom: 0; width: 380px; z-index: 800; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 24px; gap: 22px; overflow: hidden; }
  .top { position: static; padding: 0; background: none; }
  .iconbtn .lbl { display: none; }
  .brand { font-size: 28px; }
  .sheet { position: static; max-height: none; padding: 0; background: none; border: 0; border-radius: 0; overflow: visible; gap: 10px; }
  .sheet .handle { display: none; }
  .adcard h2 { font: 600 30px/1.1 var(--serif) !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--text) !important; }
  .sheet h2 { font: 12px var(--sans); text-transform: uppercase; letter-spacing: 1.3px; color: var(--muted); }
  #filters, #changes { display: flex !important; }
  #changes { flex-grow: 1; min-height: 0; }
  .changelist { overflow: auto; }
  #changes .note { display: none; }
  .meta { position: static; padding: 14px 0 0; background: none; border-top: 1px solid var(--line); border-radius: 0; }
  .legend { position: fixed; left: 404px; bottom: 24px; gap: 18px; padding: 12px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
  .legend .long { display: inline; }
  .legend .short { display: none; }
  .disclaimer { margin: 0; font-size: 12px; color: var(--muted); }
  #btn-changes { display: none !important; }
  #scrim { display: none !important; }
  .adcard { position: fixed; z-index: 950; background: var(--surface); overflow: auto; gap: 16px; left: auto; right: 24px; top: 24px; bottom: auto; width: 380px; max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 16px 48px rgba(0, 0, 0, .45); }
  .adcard .handle { display: none; }
  .leaflet-top { top: 0; }
  .leaflet-bottom { bottom: 0; }
}
@media (max-width: 380px) { .legend { font-size: 12px; } .legend > span { gap: 4px; } }
