/* ── Tester page (testers/index.html) ─────────────────────────────────
   Two tracks share one form: "audio" (Mix Analyzer, Amatone) looks like a
   metering plugin; "music" (the ear-training apps) uses the note colours.
   The track only changes the look and which app list shows first; the
   profile sections follow the apps that are ticked, as testers.php expects. */

.tz {
  --tz-panel: #14141c;
  --tz-head: #191923;
  --tz-input: #0e0e16;
  --tz-chip: #1b1b25;
  --tz-on: #1c1b36;
  --tz-muted: #a0a0bc;
  --tz-accent: var(--brand);
  --tz-glow: rgba(34, 211, 238, 0.14);
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.tz[data-track="music"] { --tz-glow: rgba(217, 70, 239, 0.16); }

/* Hero */
.tz-hero { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; }
.tz-hero-text { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.tz-kicker, .tz-panel-head, .tz-meter-sub {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tz-muted);
}
.tz-title {
  font-family: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.tz-intro { color: var(--tz-muted); max-width: 52ch; }

.tz-tracks { flex: 2 1 560px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tz-track {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #08080e;
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  font: inherit;
  aspect-ratio: 16 / 11;
  max-width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.tz-track img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; opacity: 0.55; transition: opacity 0.15s; }
.tz-track-label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 40px 16px 14px;
  background: linear-gradient(to top, rgba(8, 8, 14, 0.95), rgba(8, 8, 14, 0));
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tz-track-name { font-family: 'Archivo', 'Helvetica Neue', Arial, sans-serif; font-size: 1.4rem; font-weight: 700; }
.tz-track-apps { font-size: 0.8rem; color: var(--tz-muted); }
.tz-track:hover img { opacity: 0.8; }
.tz-track[aria-pressed="true"] { border-color: #22d3ee; box-shadow: 0 0 32px rgba(34, 211, 238, 0.22); }
.tz-track[data-pick-track="music"][aria-pressed="true"] { border-color: #d946ef; box-shadow: 0 0 32px rgba(217, 70, 239, 0.25); }
.tz-track[aria-pressed="true"] img { opacity: 1; }

/* Body: form + side meter */
.tz-body { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.tz-form { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.tz-side { flex: 1 1 260px; min-width: 0; position: sticky; top: 76px; }
@media (max-width: 900px) { .tz-side { position: static; order: -1; } }

.tz-panel { background: var(--tz-panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tz-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: var(--tz-head);
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}
.tz-panel-hint { margin-left: auto; color: var(--tz-muted); letter-spacing: 0.06em; }
.tz-step { color: #b98cff; font-weight: 600; }
.tz[data-track="music"] .tz-step[data-music="Do"] { color: #FF1500; }
.tz[data-track="music"] .tz-step[data-music="Mi"] { color: #87CEEB; }
.tz-step-music { color: #FFE600; }
.tz-panel-body { padding: 20px 18px; display: flex; flex-direction: column; gap: 20px; }

/* Fields */
.tz-field { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.tz-label { font-size: 0.85rem; font-weight: 600; color: var(--fg); padding: 0; }
.tz-req { color: #b98cff; }
.tz[data-track="music"] .tz-req { color: #FF8C00; }
.tz-opt { font-weight: 400; color: var(--tz-muted); }
.tz-hint { font-size: 0.82rem; color: var(--tz-muted); margin: 0; }
.tz-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.tz-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; }
.tz-grow { flex: 1 1 240px; }
.tz-narrow { max-width: 520px; }
.tz-sub { padding-left: 16px; border-left: 2px solid var(--border); }

.tz-input {
  height: 44px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--tz-input);
  color: var(--fg);
  font: 15px 'DM Sans', system-ui, sans-serif;
  width: 100%;
}
.tz-input::placeholder { color: #6c6c88; }
.tz-input:focus { border-color: var(--brand-2); outline: none; }
.tz-input-short { max-width: 320px; }

/* Chips: real radio/checkbox inputs, visually hidden, with an LED */
.tz-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tz-chip, .tz-app, .tz-seg label { position: relative; cursor: pointer; }
.tz-chip input, .tz-app input, .tz-seg input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.tz-chip {
  --c: var(--tz-accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--tz-chip);
  color: #c4c4d8;
  font-size: 0.88rem;
  font-weight: 500;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.tz-chip[hidden], .tz-apps[hidden], .tz-field[hidden], .tz-panel[hidden] { display: none; }
.tz-led { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: #33334a; transition: background 0.12s, box-shadow 0.12s; }
.tz[data-track="music"] .tz-chip .tz-led { background: transparent; border: 2px solid var(--c); opacity: 0.55; }
.tz-chip:hover { border-color: #3a3a52; color: var(--fg); }
.tz-chip:has(input:checked) { border-color: var(--brand-2); background: var(--tz-on); color: #fff; }
.tz[data-track="music"] .tz-chip:has(input:checked) { border-color: var(--c); background: #1d1b2c; }
.tz-chip input:checked + .tz-led { background: var(--c); box-shadow: 0 0 8px var(--c); opacity: 1; }
.tz-chip:has(input:focus-visible), .tz-app:has(input:focus-visible), .tz-seg label:has(input:focus-visible) { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* Segmented control (audio numbers) */
.tz-seg { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.tz-seg span {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-right: 1px solid var(--border);
  background: var(--tz-chip);
  color: #c4c4d8;
  font: 600 0.82rem var(--mono);
}
.tz-seg label:last-child span { border-right: 0; }
.tz-seg input:checked + span { background: var(--brand); color: #fff; }

/* App cards */
.tz-apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tz-apps + .tz-apps { margin-top: 12px; }
.tz-app {
  --c: #4169E1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-top: 3px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: var(--tz-chip);
}
.tz-app-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tz-app-name { font-family: 'Archivo', 'Helvetica Neue', Arial, sans-serif; font-size: 1.15rem; font-weight: 700; color: #f2f2f8; }
.tz-app-sub { font-size: 0.8rem; color: var(--tz-muted); }
.tz-app:has(input:checked) { border-color: var(--c); background: #1d1b2c; }
.tz-app:has(input:checked) { border-top-color: var(--c); }
.tz-app input:checked ~ .tz-led { background: var(--c); box-shadow: 0 0 8px var(--c); }
.tz-apps[data-group="audio"] .tz-app { --c: #8B00FF; }
.tz-tag { margin-left: auto; flex-shrink: 0; }
.tz-tag:not(.badge) { display: none; }

.tz-other {
  align-self: flex-start;
  margin-top: 4px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--link);
  font: 500 0.88rem 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
}
.tz-other:hover { text-decoration: underline; }
.tz-other[hidden] { display: none; }

.tz-check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; cursor: pointer; }
.tz-check input { width: 18px; height: 18px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--brand); }
.tz[data-track="music"] .tz-check input { accent-color: #FF8C00; }

.tz-submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.tz-submit { border: 0; cursor: pointer; font-family: 'DM Sans', system-ui, sans-serif; min-height: 48px; }
.tz-submit:disabled { opacity: 0.6; cursor: default; }

/* Side meter */
.tz-meter-body { flex-direction: row; gap: 18px; }
.tz-meter { display: flex; flex-direction: column; gap: 3px; width: 32px; flex-shrink: 0; }
.tz-meter span { display: block; height: 10px; border-radius: 2px; background: #22222e; transition: background 0.15s, box-shadow 0.15s; }
.tz[data-track="music"] .tz-meter { width: auto; gap: 4px; }
.tz[data-track="music"] .tz-meter span { height: 20px; border-radius: 4px; }
.tz-meter-read { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tz-meter-value { font: 600 1.9rem var(--mono); font-variant-numeric: tabular-nums; color: #f2f2f8; }
.tz[data-track="music"] .tz-meter-value { font-family: 'Archivo', 'Helvetica Neue', Arial, sans-serif; font-weight: 700; }
.tz-meter-read .tz-hint { margin-top: 10px; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  .tz-chip, .tz-led, .tz-track, .tz-track img, .tz-meter span { transition: none; }
}
