/* Stage 21d: Edit HUD mode (src/ui/hudEditor.js). Quiet, grounded: sail paper + ink, signal orange for the active thing. */
.hle-dim { position: fixed; inset: 0; z-index: 4; background: rgba(10, 8, 6, .55); pointer-events: none; }
.hle { position: fixed; inset: 0; z-index: 40; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; font-family: 'Barlow Condensed', system-ui, sans-serif; }
.hle-safe { position: absolute; border: 1px dashed rgba(244, 239, 227, .35); pointer-events: none; box-sizing: border-box; }
.hle-grid { position: absolute; pointer-events: none;
  background-image: linear-gradient(to right, rgba(244, 239, 227, .1) 1px, transparent 1px), linear-gradient(to bottom, rgba(244, 239, 227, .1) 1px, transparent 1px);
  background-size: 5% 5%; }
.hle-zones, .hle-proxies { position: absolute; inset: 0; pointer-events: none; }
.hle-zone { position: absolute; box-sizing: border-box; pointer-events: none; border: 1px solid rgba(229, 72, 77, .3);
  background: repeating-linear-gradient(135deg, rgba(229, 72, 77, .12) 0 6px, rgba(229, 72, 77, .03) 6px 12px); }
.hle-zone-lab { position: absolute; left: 4px; top: 2px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: rgba(244, 200, 200, .8); }

.hle-proxy { position: absolute; pointer-events: auto; touch-action: none; cursor: grab; }
.hle-outline { position: absolute; box-sizing: border-box; border: 1.5px dashed rgba(244, 239, 227, .7); border-radius: 6px; pointer-events: none; }
.hle-label { position: absolute; left: 50%; bottom: calc(100% + 2px); transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #F4EFE3; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.hle-proxy.is-selected .hle-outline { border: 2px solid #FF5B1F; }
.hle-proxy.is-selected .hle-label { color: #FF5B1F; }
.hle-proxy.is-invalid .hle-outline, .hle-proxy.hle-flash .hle-outline { border: 2px solid #E5484D; background: rgba(229, 72, 77, .18); }
.hle-proxy.is-invalid .hle-label, .hle-proxy.hle-flash .hle-label { color: #FFB4B6; }

/* the card lives in the view-centre zone (a forbidden zone for controls); JS sets left / width / top / max-height */
.hle-card { position: absolute; transform: translateY(-50%); overflow: auto; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px;
  background: #E8E0CC; color: #17140F; border: 2px solid #17140F; border-radius: 6px; padding: 2px; touch-action: pan-y; overscroll-behavior: contain;
  font: 700 12px 'Barlow Condensed', sans-serif; letter-spacing: .06em; text-transform: uppercase; scrollbar-width: none; }
.hle-card::-webkit-scrollbar { display: none; }
.hle-pill { display: none; position: absolute; left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); transform: translateX(-50%); min-height: 44px; padding: 0 16px; background: #E8E0CC; color: #17140F; border: 2px solid #17140F; border-radius: 22px;
  font: 700 14px 'Barlow Condensed', sans-serif; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.hle-collapsed .hle-card { display: none; }
.hle-collapsed .hle-pill { display: block; }

.hle-row { display: flex; gap: 3px; }
.hle-global { display: flex; flex-direction: column; gap: 3px; }
.hle-card.is-sel .hle-global, .hle-card:not(.is-sel) .hle-sel { display: none; }
.hle-sel { display: flex; flex-direction: column; gap: 1px; }
.hle-card.is-sel .hle-actions .hle-btn { min-height: 38px; }

.hle-btn { flex: 1 1 0; min-width: 0; min-height: 40px; padding: 0 4px; box-sizing: border-box; background: transparent; color: #17140F; border: 2px solid #17140F; border-radius: 5px; cursor: pointer;
  font: 700 13px 'Barlow Condensed', sans-serif; letter-spacing: .06em; text-transform: uppercase; touch-action: manipulation; white-space: nowrap; }
.hle-btn:active:not(:disabled) { background: rgba(23, 20, 15, .12); }
.hle-btn:focus-visible, .hle-pill:focus-visible, .hle-slide input:focus-visible { outline: 2px solid #FF5B1F; outline-offset: 1px; }
.hle-btn:disabled { opacity: .4; cursor: default; }
.hle-btn.is-active { background: #17140F; color: #E8E0CC; }
.hle-actions .hle-btn { min-height: 44px; font-size: 14px; }
.hle-primary { background: #FF5B1F; }
.hle-primary:active:not(:disabled) { background: #E24E15; }
.hle-actions .hle-toggle { flex: 0 0 40px; padding: 0; font-size: 15px; }
.hle-tools .hle-btn { flex: 0 0 auto; min-height: 36px; padding: 0 8px; }
.hle-info { flex: 1 1 0; min-width: 0; align-self: center; font-size: 12px; line-height: 1.1; padding-left: 3px; }
.hle-info.is-bad, .hle-sel-name.is-bad { color: #B3262B; }

.hle-sel-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 24px; }
.hle-sel-name { font: 800 14px 'Big Shoulders Stencil Display', 'Barlow Condensed', sans-serif; letter-spacing: .05em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hle-x { flex: 0 0 36px; min-height: 24px; height: 24px; padding: 0; font-size: 18px; line-height: 1; }
.hle-slide { display: grid; grid-template-columns: 52px 1fr 40px; align-items: center; column-gap: 6px; height: 26px; font-size: 12px; }
.hle-slide input { grid-column: 2; grid-row: 1; width: 100%; min-width: 0; height: 26px; margin: 0; accent-color: #FF5B1F; touch-action: pan-y; }
.hle-slide-val { grid-column: 3; grid-row: 1; text-align: right; font-variant-numeric: tabular-nums; }
.hle-nudge { display: flex; gap: 3px; margin-top: 1px; }
.hle-nudge .hle-btn { min-height: 40px; }
.hle-arrow { flex: 0 0 40px; padding: 0; font-size: 17px; }
.hle-defspot { flex: 1 1 auto; }

/* portrait: the centre zone is narrower (about 234 px + overhang); tighter buttons, the info / default-spot items wrap */
@media (orientation: portrait) {
  .hle-actions .hle-btn { font-size: 12px; padding: 0 2px; letter-spacing: .03em; }
  .hle-actions .hle-toggle { flex: 0 0 32px; }
  .hle-presets .hle-btn { font-size: 12px; padding: 0 2px; letter-spacing: .03em; }
  .hle-tools { flex-wrap: wrap; }
  .hle-info { flex: 1 1 100%; order: 3; }
  .hle-nudge { flex-wrap: wrap; }
  .hle-arrow { flex: 1 1 calc(25% - 3px); }
  .hle-defspot { flex: 1 1 100%; min-height: 36px; }
}

@media (prefers-reduced-motion: no-preference) {
  .hle-outline { transition: border-color .12s, background-color .12s; }
}

/* main thread: while a control is dragged the card fades and lets it through, so a control over the view centre
   (refused there) stays visible with its red outline */
.hle.hle-dragging .hle-card, .hle.hle-dragging .hle-pill { opacity: .22; pointer-events: none; transition: opacity .12s linear; }
.hle-proxies { z-index: 1; }
.hle.hle-dragging .hle-proxies { z-index: 3; }
.hle-card, .hle-pill { z-index: 2; }
