body { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
#inspector {
  width: 280px;
  flex: none;
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  min-height: 0;
}
#inspector[hidden] { display: none; }
.side-right h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
#text-list, #list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 120px; }
#text-list li { display: flex; gap: 6px; align-items: center; padding: 4px 0; }
#text-list li.sel input { background: var(--color-primary-50); }
#text-list input[type="text"] { flex: 1; min-width: 0; }
#text-list button.jump { padding: 6px 8px; }
.filters { display: flex; gap: 6px; }
#list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text-primary);
}
#list li:hover { background: var(--bg-hover); }
#list li.sel { background: var(--color-primary-50); color: var(--color-primary-dark); }
.dark #list li.sel { color: var(--text-primary); background: var(--bg-hover); }
#list li.off { color: var(--color-danger); }
#list li.list-head {
  cursor: default;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding-bottom: 2px;
}
#list li.list-head:hover { background: transparent; }
.hint { margin: 0; font-size: 12px; color: var(--text-muted); }
.layers { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; color: var(--text-secondary); }
#conformite-plan { font-size: 12px; color: var(--text-secondary); line-height: 1.35; }
#conformite-plan summary { cursor: pointer; color: var(--text-primary); font-weight: 600; }
#conformite-plan p { margin: 6px 0 0; }
#conformite-plan ul { margin: 6px 0 0; padding-left: 16px; }
#conformite-plan li { margin: 0 0 4px; }
#conformite-plan[hidden] { display: none; }
#fissures-note { font-size: 12px; color: var(--text-secondary); line-height: 1.35; }
#fissures-note summary, #feux-details summary { cursor: pointer; color: var(--text-primary); font-weight: 600; }
#fissures-note p { margin: 6px 0 0; }
#viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  cursor: grab;
  background: var(--bg-page);
  border-radius: 16px;
  min-width: 0;
  min-height: 0;
}
#viewport.mode-edit { cursor: default; }
#viewport.drag { cursor: grabbing; }
#mini {
  position: absolute;
  right: 10px;
  top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--map-well);
  cursor: pointer;
  z-index: 3;
  overflow: hidden;
}
#mini canvas { display: block; }
.mark.locked { outline: 1px dashed var(--color-danger); }
#world { position: absolute; top: 0; left: 0; width: 4522px; height: 1247px; transform-origin: 0 0; box-shadow: 0 0 0 1px rgba(19, 19, 19, 0.28); }
#approche-fond { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; pointer-events: none; z-index: 0; }
#approche-fond img { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#plan, #traits, #draw, #signav { position: absolute; top: 0; left: 0; width: 4522px; height: 1247px; }
#plan { z-index: 1; }
#plan { display: block; user-select: none; }
#traits, #draw, #signav, #marquage, #fissures, #balisage { pointer-events: none; }
#marquage, #fissures, #balisage { position: absolute; top: 0; left: 0; width: 4522px; height: 1247px; }
#marquage { z-index: 1; }
#balisage { z-index: 2; }
.arcal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.arcal h2 { margin: 0; font-size: 14px; font-weight: 600; }
#arcal-facts, #arcal-state { margin: 0; font-size: 12px; color: var(--text-secondary); }
#arcal-state.on { color: var(--color-primary); font-weight: 600; }
.arcal-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.arcal button { padding-inline: 8px; }
.radio-mic {
  align-self: center;
  flex-direction: column;
  gap: 0;
  width: 84px;
  min-height: 0;
  padding: 4px 4px 6px;
  background: var(--bg-page);
  border-color: var(--border);
}
.radio-mic:hover { background: var(--bg-page); }
.radio-mic.keyed .ptt { fill: #F59E0B; }
.radio-mic.live { border-color: var(--color-primary); }
#arcal-clicks { font-size: 11px; color: var(--text-muted); }
#papi-open { width: auto; }
#ops {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 46%;
  overflow: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: var(--shadow-card);
}
#ops.is-shut {
  left: 50%;
  right: auto;
  width: max-content;
  max-height: none;
  transform: translateX(-50%);
  padding: 4px;
  overflow: visible;
}
#ops.is-shut #ops-body { display: none; }
.ops-row, .ops-lights, .ops-modes, .ops-rwy, .ops-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ops-lights { margin-left: auto; }
#ops #arcal-state { margin: 0; min-width: 7.5rem; font-size: 12px; color: var(--text-secondary); }
#ops #arcal-state.on { color: var(--color-primary); font-weight: 600; }
#ops .radio-mic {
  width: 46px;
  min-height: 0;
  padding: 2px 2px 4px;
  flex-direction: column;
  gap: 0;
}
#ops #arcal-clicks { font-size: 10px; }
#circuit-phase { margin: 0; font-size: 13px; color: var(--text-primary); }
#ops details summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); }
#ops details p { margin: 6px 0 0; font-size: 12px; color: var(--text-secondary); }
#circuit-path { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
#circuit-mark { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.circuit-jet { position: absolute; width: 28px; height: 28px; }
.circuit-tag {
  position: absolute;
  transform: translate(14px, 16px);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
#papi-sim[hidden] { display: none; }
#papi-sim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8, 10, 14, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.papi-card {
  width: min(680px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.papi-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.papi-head h2 { margin: 0; font-size: 16px; }
#papi-cockpit { width: 100%; height: auto; border-radius: 12px; background: #0b1c33; }
.papi-slider { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
#papi-readout { margin: 0; font-size: 13px; }
#papi-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#papi-table th, #papi-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); }
#papi-table td.blanc { color: #64748b; }
.dark #papi-table td.blanc { color: #e8e8ec; }
#papi-table td.rouge { color: #b91c1c; font-weight: 600; }
.arcal details summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); }
.arcal details p { margin: 6px 0 0; }
#nav-marks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.nav-mark {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 2px;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  background: #fff;
  flex: none;
}
.nav-papi { border-color: #9f2d12; }
.nav-papi .nav-dot { border-color: #9f2d12; background: #fff; }
.nav-approche, .nav-odal { border-color: #b45309; }
.nav-approche .nav-dot, .nav-odal .nav-dot { border-color: #b45309; background: #fff; }
#fissure-marks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.fissure-mark {
  position: absolute;
  background: #7f1d1d;
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transform: translate(8px, -120%);
}
#balisage .flash { animation: arcal-flash 1s linear infinite; }
#balisage .flash-rail { animation: rail-flash 0.5s linear infinite; }
#balisage .flash-wag { animation: wag-flash 1s linear infinite; }
@keyframes arcal-flash {
  0%, 6% { opacity: 1; }
  8%, 100% { opacity: 0.2; }
}
@keyframes rail-flash {
  0%, 8% { opacity: 1; }
  12%, 100% { opacity: 0.2; }
}
@keyframes wag-flash {
  0%, 50% { opacity: 1; }
  50.1%, 100% { opacity: 0.2; }
}
#balisage .feu-hit, #balisage .feu-porte { pointer-events: all; cursor: pointer; }
#piste-signs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.piste-sign {
  position: absolute;
  line-height: 0;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
}
.piste-sign canvas { display: block; width: 100%; height: 100%; }
@media (prefers-reduced-motion: reduce) {
  #balisage .flash, #balisage .flash-rail, #balisage .flash-wag { animation: none; }
}
#signav-banner {
  font-size: 12px;
  background: color-mix(in srgb, var(--color-accent) 16%, var(--bg-card));
  border: 1px solid var(--color-accent);
  border-radius: 12px;
  padding: 8px;
  color: var(--text-primary);
}
#signav-banner summary { cursor: pointer; font-weight: 650; }
#signav-banner p { margin: 0 0 6px; }
#signav-banner .tool-link, #signav-banner button { margin-top: 6px; }
#marks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#bg-clear { width: 100%; }
#size-box:not([hidden]) { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-secondary); }
#size-box[hidden] { display: none; }
#size-box input[type="range"] { width: 100%; }
.mark { box-sizing: border-box; }
.handle {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: var(--color-primary);
  border: 1px solid #fff;
  border-radius: 2px;
  cursor: nwse-resize;
}
.mark {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  font-weight: 700;
  line-height: 1;
  touch-action: none;
}
.mark.porte, .mark.carre {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-width: 0;
  overflow: hidden;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff;
}
.mark.porte {
  background: var(--porte);
  color: var(--text-primary);
  border: 1px solid var(--color-primary-dark);
  border-radius: 3px;
  font-size: 13px;
  text-align: center;
}
.mark.carre {
  background: #fff;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  font-size: 11px;
  text-align: center;
}
.mark.sel { outline: 2px solid var(--color-primary); outline-offset: 2px; }
#chantier-draw, #mesure-draw, #feux-pose-draw, #avion-draw { position: absolute; top: 0; left: 0; width: 4522px; height: 1247px; pointer-events: none; }
#feux-pose-draw, #avion-draw { z-index: 3; }
#help {
  margin: 0;
  padding: 0 0 0 16px;
  color: var(--text-secondary);
  font-size: 12px;
}
#help[hidden] { display: none; }
#pose {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 7;
  margin: 0;
  max-width: calc(100% - 24px);
  background: var(--color-primary);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}
#pose[hidden] { display: none; }
#actif {
  position: absolute;
  left: 12px;
  bottom: 48px;
  z-index: 6;
  margin: 0;
  max-width: min(420px, calc(100% - 24px));
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#actif[hidden] { display: none; }
#actif p { margin: 0; font-size: 13px; line-height: 1.35; }
#actif a { font-size: 13px; font-weight: 600; }
#actif .grue-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#actif .grue-head strong { font-size: 14px; font-weight: 600; }
#regle {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: max-content;
  max-width: min(230px, calc(100% - 24px));
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.3;
  pointer-events: none;
}
#regle-scale { display: flex; align-items: center; gap: 8px; }
#regle-bar {
  display: block;
  height: 0;
  width: 48px;
  flex: none;
  border-bottom: 3px solid var(--color-primary);
  border-left: 2px solid var(--color-primary);
  border-right: 2px solid var(--color-primary);
}
#regle-read { color: var(--text-secondary); }
#ops:not(.is-shut) ~ #regle { top: 12px; bottom: auto; }
#hauteur-plan { list-style: none; margin: 0; padding: 0; }
#hauteur-plan li {
  padding: 4px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}
#feux-note, #chantier-note, #chantier-use, #eau-plan, #avion-note, #avion-lecture { margin: 0; font-size: 12px; color: var(--text-secondary); line-height: 1.35; }
#chantier, #avion, #feux-pose { display: flex; flex-direction: column; gap: 6px; }
#avion.outil { margin-top: 0; }
#avion-lecture { white-space: pre-line; }
#avion-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
#avion select, #avion-t { width: 100%; }
@media (max-width: 800px) {
  #viewport { min-height: 52vh; }
  #regle { top: 8px; bottom: auto; left: 8px; max-width: calc(100% - 16px); }
  #pose { top: 140px; }
  #mini { top: 76px; }
  #inspector {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 36%;
    z-index: 7;
    overflow: auto;
  }
  #ops:not(.is-shut) { max-height: 70%; }
  #ops button { min-height: 30px; padding: 3px 7px; font-size: 12px; }
  #ops .ops-lights { margin-left: 0; }
}
