/* Spherical Harmonics Explorer — utility-specific styles */
/* Scoped under .sh-app to avoid collisions with platform variables */

.sh-app {
  --sh-bg: #0b0f14;
  --sh-panel: #111823;
  --sh-panel2: #0e141d;
  --sh-text: #e9eef7;
  --sh-muted: #95a3b8;
  --sh-line: #243244;
  --sh-accent: #7fb3ff;
  --sh-thumb: 92px;
}

.sh-app {
  display: flex;
  height: 75vh;
  min-height: 500px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--sh-line);
  background: var(--sh-bg);
  color: var(--sh-text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.sh-app .sh-sidebar {
  flex-shrink: 0;
  width: 420px;
  min-width: 280px;
  max-width: 72%;
  border-right: 1px solid var(--sh-line);
  background: linear-gradient(180deg, var(--sh-panel), var(--sh-panel2));
  overflow: auto;
  padding: 18px 18px 26px;
}

.sh-app .sh-resizer {
  flex-shrink: 0;
  width: 5px;
  cursor: col-resize;
  background: var(--sh-line);
  transition: background .15s;
  user-select: none;
  -webkit-user-select: none;
}
.sh-app .sh-resizer:hover,
.sh-app .sh-resizer.active { background: var(--sh-accent); }

.sh-app .sh-main {
  flex: 1;
  min-width: 280px;
  position: relative;
  background: radial-gradient(circle at 50% 35%, rgba(110,140,180,.10), rgba(11,15,20,0) 38%),
              linear-gradient(180deg, #0b0f14 0%, #0a0e13 100%);
  overflow: hidden;
}

.sh-app h2.sh-title { margin: 0 0 8px; font-size: 20px; font-weight: 700; color: var(--sh-text); }
.sh-app .sh-subtitle { color: var(--sh-muted); font-size: 12px; line-height: 1.45; margin-bottom: 14px; }

.sh-app .sh-topbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.sh-app .sh-rotbar {
  margin-bottom: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--sh-line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.sh-app .sh-rot-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.sh-app .sh-rot-row .ax-lbl { width: 10px; font-weight: 700; color: var(--sh-accent); }
.sh-app .sh-rot-row input[type=range] { flex: 1; accent-color: var(--sh-accent); }
.sh-app .sh-rot-row .val { width: 38px; text-align: right; font-size: 11px; font-family: ui-monospace, monospace; color: var(--sh-muted); }

.sh-app .sh-auto-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.sh-app .sh-btn {
  background: #172130;
  color: var(--sh-text);
  border: 1px solid #2b3950;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.sh-app .sh-btn:hover { background: #1b2738; }
.sh-app .sh-btn.sm { padding: 4px 9px; font-size: 11px; border-radius: 7px; }
.sh-app .sh-btn.active { background: #152b44; border-color: var(--sh-accent); color: var(--sh-accent); }

.sh-app .sh-control { display: flex; align-items: center; gap: 8px; color: var(--sh-muted); font-size: 12px; }
.sh-app .sh-control input[type=range] { width: 140px; accent-color: var(--sh-accent); }

.sh-app .sh-legend { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--sh-muted); font-size: 12px; }
.sh-app .sh-swatch {
  width: 120px; height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, rgb(54,86,187), rgb(233,236,241), rgb(185,38,46));
  border: 1px solid rgba(255,255,255,.08);
}

.sh-app .sh-pyramid { display: flex; flex-direction: column; gap: 12px; }
.sh-app .sh-row { display: flex; justify-content: center; gap: 8px; min-height: calc(var(--sh-thumb) + 28px); }
.sh-app .sh-thumb-wrap { width: var(--sh-thumb); }
.sh-app .sh-thumb {
  width: var(--sh-thumb); height: var(--sh-thumb);
  border-radius: 14px;
  background: #0a1017;
  border: 1px solid #263244;
  display: block;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.18) inset;
}
.sh-app .sh-thumb.active { outline: 2px solid var(--sh-accent); outline-offset: 2px; border-color: #4d78aa; }
.sh-app .sh-thumb-label { margin-top: 6px; text-align: center; color: var(--sh-muted); font-size: 11px; }

.sh-app #sh-viewer { width: 100%; height: 100%; display: block; cursor: grab; }
.sh-app #sh-viewer.dragging { cursor: grabbing; }

.sh-app .sh-hud {
  position: absolute; left: 22px; top: 20px;
  padding: 14px 16px; border-radius: 14px;
  background: rgba(13,18,26,.62);
  border: 1px solid rgba(66,81,105,.42);
  backdrop-filter: blur(8px);
  max-width: 420px;
}
.sh-app .sh-hud .small { color: var(--sh-muted); font-size: 12px; line-height: 1.45; }
.sh-app .sh-hud .sh-hud-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.sh-app .sh-formula {
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: #cdd8e7;
}

.sh-app .sh-footer {
  position: absolute; left: 22px; bottom: 18px;
  color: var(--sh-muted); font-size: 12px;
  background: rgba(13,18,26,.52);
  border: 1px solid rgba(66,81,105,.35);
  border-radius: 12px;
  padding: 9px 12px;
  backdrop-filter: blur(8px);
}

@media (max-width: 1080px) {
  .sh-app { flex-direction: column; height: auto; min-height: 0; }
  .sh-app .sh-resizer { display: none; }
  .sh-app .sh-sidebar { width: 100% !important; max-width: 100%; height: auto; max-height: 50vh; border-right: none; border-bottom: 1px solid var(--sh-line); }
  .sh-app .sh-main { min-height: 400px; }
}
