/* =========================================================
   AURORA — Helm
   Floating scale readout + quick toolbox. Loads after styles.css
   and reuses its palette, chips, text-buttons and star-selects.
   ========================================================= */

/* The setup panel was declared sticky in styles.css, but a later
   `.panel { position: relative }` rule (same specificity, later in
   the file) silently overrides it. Pin it to relative on purpose so
   only the Helm ever floats. */
.controls-panel {
  position: relative;
  top: auto;
}

.helm {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  transform: translateY(-110%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 220ms ease, visibility 0s linear 220ms;
}

.helm.helm-visible {
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition: transform 220ms ease, visibility 0s;
}

.helm-inner {
  position: relative;
  width: min(1540px, calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 9px 14px 11px;
  border: 1px solid rgba(92, 226, 166, 0.36);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background:
    linear-gradient(rgba(92, 226, 166, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 226, 166, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, rgba(12, 30, 43, 0.96), rgba(6, 16, 24, 0.95));
  background-size: 28px 28px, 28px 28px, auto;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
}

/* Brass waterline along the bottom edge, fading at the ends. */
.helm-inner::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(92, 226, 166, 0.75) 18%, rgba(92, 226, 166, 0.75) 82%, transparent);
  pointer-events: none;
}

/* Compass button: back to the setup panel. */
.helm-top {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(92, 226, 166, 0.5);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(92, 226, 166, 0.12), rgba(9, 13, 26, 0.85) 68%);
  color: var(--aurora-bright);
  font-size: 1.2rem;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.helm-top:hover { border-color: var(--aurora-bright); }
.helm-top:active { transform: translateY(1px); }

/* Readout: the one thing this bar exists to show. */
.helm-readout {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 320px;
}

.helm-readout strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.12;
  color: #f1f8f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.helm-readout span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Root / Scale mirrors. */
.helm-selects {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

.helm-select .star-select-trigger {
  min-height: 36px;
  padding: 0 9px 0 10px;
  font-size: 0.86rem;
}

#helmRootSelect { width: 104px; }
#helmQualitySelect { width: 130px; }
#helmExtSelect { width: 190px; }

#helmRootSelect .star-select-menu {
  width: 100%;
  min-width: 0;
}

#helmExtSelect .star-select-menu {
  width: 330px;
  max-height: min(430px, 72vh);
}
#helmQualitySelect .star-select-menu { width: 100%; min-width: 0; }

/* Scale-note chips: same control as the panel, sized for a bar. */
.helm-notes {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.note-chip.helm-chip {
  min-width: 42px;
  min-height: 36px;
  padding: 4px 9px 3px;
  font-size: 0.82rem;
  line-height: 1.05;
}

.note-chip.helm-chip small {
  display: block;
  margin-top: 2px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

/* Tools. */
.helm-tools {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.text-button.helm-tool {
  min-height: 36px;
  padding: 0 11px;
  font-size: 0.8rem;
}

.text-button.helm-tool-primary {
  color: #101322;
  background: linear-gradient(180deg, #63e6ad, #2aa877);
  border-color: #b2f7d8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.text-button.helm-tool-primary:hover {
  border-color: #f6dea0;
}

/* Responsive: chips drop to a second row, then selects and chips
   step aside so the readout and tools always fit. */
@media (max-width: 1240px) {
  .helm-notes {
    order: 10;
    flex-basis: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .helm-inner {
    width: 100%;
    border-radius: 0;
    padding: 8px 10px 10px;
    gap: 8px 10px;
  }
  .helm-selects,
  .helm-notes { display: none; }
  .helm-readout { max-width: none; flex: 1 1 120px; }
  .helm-readout strong { font-size: 1rem; }
  .helm-tools { margin-left: 0; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .helm,
  .helm.helm-visible { transition: none; }
}

#helmMapSelect { width: 132px; }
#helmMapSelect .star-select-menu { width: max(100%, 200px); }
@media (max-width: 1240px) { #helmMapSelect { width: 112px; } }

.helm-help { min-width: 34px; padding-left: 0; padding-right: 0; justify-content: center; font-weight: 900; text-decoration: none; display: inline-flex; align-items: center; }
