/* ==========================================================================
   Unfair Advantage — Interactive Hub Window & Controls (Studio Glass UI)
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(232, 17, 45, 0.14);
  border: 1px solid rgba(255, 46, 70, 0.34);
  color: #ffb5be;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

#stage-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  letter-spacing: 0.02em;
}

.hub-window {
  position: relative;
  color: var(--text);
  width: min(820px, 100%);
  max-width: 100%;
  min-width: 0;
  border-radius: 26px;
  overflow: hidden;
}

.hub-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  min-height: 64px;
  padding: 12px 16px 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(34, 40, 54, 0.72), rgba(18, 22, 31, 0.85));
}

.hub-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 24px;
  width: 24%;
  height: 1.5px;
  background: linear-gradient(90deg, var(--signal), rgba(255, 46, 70, 0.15) 75%, transparent);
  pointer-events: none;
}

.hub-header > img {
  flex: none;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(232, 17, 45, 0.25));
}

.hub-nav {
  position: relative;
  isolation: isolate;
  display: flex;
  min-width: 0;
  overflow: auto;
  scrollbar-width: none;
  margin-right: auto;
  padding: 3px;
  background: rgba(8, 10, 15, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 999px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.55);
}

.hub-nav::-webkit-scrollbar {
  display: none;
}

.hub-nav button {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 30px;
  white-space: nowrap;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 550;
  transition: color 0.18s var(--sine);
}

.hub-nav button:hover,
.hub-nav button[aria-pressed='true'] {
  color: #ffffff;
}

.hub-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: transform 0.36s var(--ease), width 0.36s var(--ease);
}

.hub-search,
.hub-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-soft);
  border: 1px solid rgba(255, 255, 255, 0.1);
  height: 34px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background-color 0.18s, border-color 0.18s, color 0.18s, transform 0.2s var(--snap);
}

.hub-search:hover,
.hub-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.hub-icon {
  width: 34px;
  font-size: 19px;
  line-height: 1;
}

.hub-search {
  padding: 0 9px 0 10px;
}

.hub-search kbd {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

.hub-search svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hub-content {
  min-height: 210px;
  padding: 18px 18px 26px;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hub-card {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 66px;
  border-radius: 16px;
  gap: 10px;
  padding: 0 12px 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  background: linear-gradient(165deg, rgba(32, 38, 52, 0.72), rgba(20, 24, 34, 0.85));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 16px -8px rgba(0, 0, 0, 0.7);
  transition: transform 0.24s var(--ease), border-color 0.2s, background-color 0.2s, box-shadow 0.24s;
}

.hub-card[data-on='true'] {
  border-color: rgba(255, 46, 70, 0.36);
  background: linear-gradient(165deg, rgba(52, 24, 34, 0.65), rgba(22, 20, 30, 0.9));
  box-shadow:
    inset 0 1px 0 rgba(255, 130, 145, 0.14),
    inset 3px 0 0 var(--signal),
    0 8px 20px -10px rgba(232, 17, 45, 0.35);
}

.hub-card:hover,
.hub-card:focus-within {
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(165deg, rgba(42, 49, 66, 0.84), rgba(25, 30, 42, 0.92));
}

.hub-card[data-on='true']:hover,
.hub-card[data-on='true']:focus-within {
  border-color: rgba(255, 76, 98, 0.56);
}

.hub-card-open {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  padding: 10px 0;
  line-height: 1.25;
}

.hub-card-open strong {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 620;
  letter-spacing: -0.015em;
}

.hub-card-open small {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-card[data-on='true'] small {
  color: #ff9ba6;
}

.hub-chip {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.2;
  background: rgba(8, 10, 15, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 4px 8px;
  white-space: nowrap;
}

.hub-chevron {
  padding: 0 3px;
  border: 0;
  background: none;
  font-size: 20px;
  line-height: 32px;
  color: var(--dim);
}

.hub-card:hover .hub-chevron {
  color: var(--text);
  transform: translateX(2px);
}

/* Tactile Spring Switch */
.hub-switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.85);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.65);
  transition: background-color 0.24s var(--ease), border-color 0.24s var(--ease), box-shadow 0.24s;
}

.hub-switch::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #aeb6c7;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
  transition: transform 0.34s var(--spring), background-color 0.18s;
}

.hub-switch[aria-checked='true'] {
  background: linear-gradient(180deg, #f31e38, #c40d24);
  border-color: rgba(255, 118, 134, 0.65);
  box-shadow: 0 0 14px rgba(232, 17, 45, 0.55);
}

.hub-switch[aria-checked='true']::after {
  background: #ffffff;
  transform: translateX(16px);
}

.hub-switch:active::after {
  scale: 1.15 0.9;
}

/* Detail View */
.hub-detail-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 0 2px;
}

.block .hub-detail-top h2 {
  font-size: 17px;
  font-weight: 650;
  margin-right: auto;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.hub-detail-top h2 span {
  color: var(--muted);
  font-weight: 500;
}

.hub-group {
  background: rgba(15, 19, 28, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 13px;
}

.hub-group h3 {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px 4px;
}

.hub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
  font-size: 13px;
  transition: background-color 0.18s, border-color 0.18s;
}

a.hub-row:hover {
  background: rgba(232, 17, 45, 0.14);
  border-color: rgba(255, 46, 70, 0.4);
  color: #ffffff;
}

.hub-row + .hub-row {
  margin-top: 7px;
}

.hub-row select {
  max-width: 52%;
  background: #0d1017;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
}

.hub-row output {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--crimson-hot);
}

.hub-row input[type='range'] {
  accent-color: var(--signal);
  width: min(38%, 140px);
}

.hub-detail-note {
  color: var(--dim);
  font-size: 11.5px;
  margin: 12px 0 0 4px;
}

/* Minimized Floating Pill */
.hub-pill {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border-radius: 999px;
  color: var(--text);
  padding: 10px 16px 10px 20px;
  min-height: 50px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
}

.hub-pill img {
  object-fit: contain;
}

/* Quick Find Spotlight Palette */
.hub-find {
  position: absolute;
  inset: 14px 0 auto;
  margin: 0 auto;
  width: min(440px, calc(100% - 28px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 19, 28, 0.94);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  color: var(--text);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 46, 70, 0.14);
  z-index: 10;
}

.hub-find-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-find input {
  width: 100%;
  min-width: 0;
  background: rgba(7, 8, 12, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
}

.hub-find input:focus {
  border-color: rgba(255, 46, 70, 0.6);
  outline: none;
}

.find-results {
  max-height: 170px;
  overflow: auto;
  margin-top: 8px;
  display: grid;
  gap: 3px;
}

.find-results button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  padding: 8px 11px;
  font-size: 13px;
  transition: background-color 0.16s, transform 0.2s var(--snap);
}

.find-results small {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.find-results button:hover,
.find-results button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(3px);
}

.find-empty {
  color: var(--muted);
  font-size: 12.5px;
  padding: 10px 8px;
}

@media (max-width: 740px) {
  .hub-header {
    gap: 7px;
    padding: 10px;
  }
  .hub-header > img {
    width: 28px;
  }
  .hub-nav button {
    padding-inline: 9px;
    font-size: 12px;
  }
  .hub-search kbd {
    display: none;
  }
  .hub-search {
    width: 34px;
    padding: 0;
  }
  .hub-content {
    padding: 14px 12px 20px;
  }
  .hub-grid {
    gap: 8px;
  }
  .hub-card {
    border-radius: 13px;
    padding-inline: 10px;
    min-height: 60px;
  }
  .hub-card-open strong {
    font-size: 12px;
  }
  .hub-card-open small {
    font-size: 10.5px;
  }
  .hub-card .hub-chip {
    display: none;
  }
}

@media (max-width: 520px) {
  .hub-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-switch:active::after {
    scale: none;
  }
}
