/* Audio spectrum analyzer — scoped so it does not restyle the rest of the site. */
.audio-spec {
  --as-bezel: #e7ecee;
  --as-edge: #c5ced3;
  --as-ink: #1b242b;
  --as-soft: #4a5862;
  --as-key: #f4f7f8;
  --as-key-ink: #1b242b;
  --as-on: #1b242b;
  --as-on-ink: #eef2f3;
  --as-field: #fff;
  --as-screen: #06121a;
  --as-trace: #9ff3e6;
  --as-hold: #e0a03a;
  --as-focus: #0e7480;
  --as-warn: #8a3b12;
  color: var(--as-ink);
  font: 400 16px/1.45 inherit;
  background: var(--as-bezel);
  border: 1px solid var(--as-edge);
  border-radius: 14px;
  padding: clamp(12px, 2.4vw, 22px);
}
.audio-spec, .audio-spec *, .audio-spec *::before, .audio-spec *::after { box-sizing: border-box; }
.audio-spec .head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.audio-spec .inst-title { margin: 0; font: 600 clamp(1.35rem, 3vw, 1.8rem)/1.05 inherit; letter-spacing: 0; }
.audio-spec .inst-title small { display: block; font: 500 .95rem/1.3 inherit; color: var(--as-soft); margin-top: 4px; }
.audio-spec .seg { display: inline-flex; border: 1px solid var(--as-edge); border-radius: 8px; overflow: hidden; background: var(--as-key); }
.audio-spec .seg button {
  appearance: none; border: 0; background: transparent; color: var(--as-key-ink);
  font: 600 1rem/1 inherit; padding: 10px 14px; cursor: pointer; min-height: 40px;
}
.audio-spec .seg button + button { border-left: 1px solid var(--as-edge); }
.audio-spec .seg button[aria-pressed="true"] { background: var(--as-on); color: var(--as-on-ink); }
.audio-spec button:focus-visible, .audio-spec select:focus-visible, .audio-spec input:focus-visible, .audio-spec label.filebtn:focus-within {
  outline: 2px solid var(--as-focus); outline-offset: 2px;
}
.audio-spec .screen {
  position: relative; background: var(--as-screen); border-radius: 8px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), inset 0 0 30px rgba(0,0,0,.6);
  border: 6px solid #11191f;
}
.audio-spec #spec { display: block; width: 100%; height: clamp(220px, 42vh, 420px); touch-action: pan-y; cursor: crosshair; }
.audio-spec #fall { display: block; width: 100%; height: clamp(90px, 18vh, 170px); border-top: 1px solid #16303a; }
.audio-spec #fall.off { display: none; }
.audio-spec .empty {
  position: absolute; left: 0; right: 0; top: 0; height: clamp(220px, 42vh, 420px);
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 24px; color: #7fa7ac; font-size: 1rem; pointer-events: none;
}
.audio-spec .empty[hidden] { display: none; }
.audio-spec .cursor {
  position: absolute; top: 10px; padding: 4px 8px; border-radius: 4px; pointer-events: none;
  background: rgba(6,18,26,.85); color: var(--as-trace); border: 1px solid #1e4a55;
  font: 500 .9rem/1.2 inherit; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.audio-spec .cursor[hidden] { display: none; }
.audio-spec .readouts { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; margin-top: 12px; font-variant-numeric: tabular-nums; }
.audio-spec .ro { display: flex; flex-direction: column; min-width: 90px; }
.audio-spec .ro span { font: 500 .85rem/1.2 inherit; color: var(--as-soft); }
.audio-spec .ro b { font: 600 1.25rem/1.2 inherit; }
.audio-spec .ro.peak b { font-size: 1.6rem; }
.audio-spec .spacer { flex: 1; }
.audio-spec .key {
  appearance: none; border: 1px solid var(--as-edge); background: var(--as-key); color: var(--as-key-ink);
  font: 600 1rem/1 inherit; padding: 10px 16px; border-radius: 8px; cursor: pointer; min-height: 40px;
}
.audio-spec .key[aria-pressed="true"] { background: var(--as-hold); border-color: var(--as-hold); color: #1b1306; }
.audio-spec .msg { margin: 10px 0 0; color: var(--as-warn); font-weight: 500; }
.audio-spec .msg:empty { display: none; }
.audio-spec .panel { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--as-edge); }
.audio-spec .panel[hidden] { display: none; }
.audio-spec .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 18px; align-items: end; }
.audio-spec .field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.audio-spec .field > span { font: 500 .9rem/1.2 inherit; color: var(--as-soft); display: flex; justify-content: space-between; gap: 8px; }
.audio-spec .field output { color: var(--as-ink); font-variant-numeric: tabular-nums; }
.audio-spec select, .audio-spec input[type="range"] { width: 100%; }
.audio-spec select {
  appearance: none; font: 500 1rem/1.2 inherit; color: var(--as-ink);
  background: var(--as-field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23889'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--as-edge); border-radius: 6px; padding: 8px 28px 8px 10px; min-height: 40px;
}
.audio-spec input[type="range"] { accent-color: var(--as-focus); min-height: 28px; }
.audio-spec .check { flex-direction: row; align-items: center; gap: 8px; min-height: 40px; }
.audio-spec .check input { width: 20px; height: 20px; accent-color: var(--as-focus); }
.audio-spec .check span { font: 500 1rem/1.2 inherit; color: var(--as-ink); }
.audio-spec .filerow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.audio-spec .filebtn { display: inline-flex; align-items: center; }
.audio-spec .filebtn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.audio-spec audio { flex: 1; min-width: 240px; max-width: 100%; }
.audio-spec .filename { color: var(--as-soft); overflow-wrap: anywhere; }
.audio-spec .hint { margin: 12px 0 0; color: var(--as-soft); font-size: .92rem; max-width: 70ch; }
@media (max-width: 560px) {
  .audio-spec .head .seg { width: 100%; }
  .audio-spec .head .seg button { flex: 1; padding: 10px 6px; }
}
