/* Microphone Matching Lab (/audio/mic-match/). Builds on refined.css's account-area look: the same bar, cards, fields and buttons. */

:root {
  --c-source: #6aa8ff; --c-target: #5fe0a0; --c-eq: #ffc857; --c-result: #ff7aa8;
  --band: rgba(255, 255, 255, 0.035);
}
html[data-theme="light"] {
  --c-source: #1f5fd0; --c-target: #0b7a4b; --c-eq: #a05a00; --c-result: #c2255c;
  --band: rgba(10, 30, 32, 0.045);
}

.shell .mic-main { max-width: 1240px; }
.mic-layout { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.mic-right { display: grid; gap: 16px; min-width: 0; }
.mic .account-card { min-width: 0; }
.mic-pick { gap: 18px; }
.mic .field select { width: 100%; }

/* The microphone search: a box to type in, with the matches under it */
.combo { position: relative; }
.combo input { width: 100%; padding-right: 36px !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858d92' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.500 4.500'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 10px center !important; background-size: 18px !important; text-overflow: ellipsis; }
.combo-list { position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 4px); max-height: min(340px, 50vh); overflow-y: auto; margin: 0; padding: 4px; list-style: none; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28); }
.combo-list li { padding: 9px 10px; border-radius: var(--radius-sm); font-size: 0.9375rem; line-height: 1.35; color: var(--text); cursor: pointer; }
.combo-list li.active, .combo-list li[role="option"]:hover { background: var(--nav-active); color: var(--nav-active-text); }
.combo-list li[aria-selected="true"] { font-weight: 600; }
.combo-list li[aria-selected="true"]::after { content: " \2713"; }
.combo-maker { color: var(--text-3); }
.combo-list li.active .combo-maker { color: inherit; opacity: 0.8; }
.combo-list .combo-none { color: var(--text-2); cursor: default; }
.mic .btn.btn-small { min-height: 34px; padding: 6px 12px; font-size: 0.875rem; }
.mic-import { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.file-btn { cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.mic-swap { justify-self: center !important; }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; vertical-align: baseline; }
.dot-source { background: var(--c-source); }
.dot-target { background: var(--c-target); }

.mic-options { display: grid; gap: 14px; padding-top: 16px; border-top: 1px solid var(--border); }
.mic-options .switch { align-items: flex-start; font-weight: 600; font-size: 0.9375rem; color: var(--text); }
.mic-options .switch-track { margin-top: 1px; }
.mic-options small { display: block; margin-top: 2px; font-weight: 400; font-size: 0.875rem; line-height: 1.45; color: var(--text-2); }
html[data-theme="light"] .switch input:checked + .switch-track { background: var(--primary); }

/* The graph */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { padding: 6px 10px; border: 0; border-left: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: 500 0.875rem/1.3 var(--ui-font); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--nav-active); color: var(--nav-active-text); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.9375rem; color: var(--text); }
.legend label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.legend input { width: 18px; height: 18px; accent-color: var(--primary); }
.swatch { width: 22px; height: 0; border-top: 3px solid; border-radius: 2px; }
.sw-source { border-color: var(--c-source); }
.sw-target { border-color: var(--c-target); }
.sw-eq { border-color: var(--c-eq); border-top-style: dashed; }
.sw-result { border-color: var(--c-result); border-top-width: 6px; opacity: 0.5; }
.chart-wrap { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
html[data-theme="light"] .chart-wrap { background: #fff; }
#chart { display: block; width: 100%; touch-action: pan-y; cursor: crosshair; }
.readout { margin: 0; min-height: 1.5em; font-size: 0.9375rem; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* The download */
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.mic .auth-msg { width: auto; }

/* The tracer */
.tracer { margin-top: 16px; }
.tracer > .muted { max-width: 70ch; }
.drop { display: grid; justify-items: center; gap: 12px; padding: 36px 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius); text-align: center; }
.drop p { margin: 0; color: var(--text); }
.drop.over { border-color: var(--primary); background: var(--nav-active); }
.trace-work { display: grid; gap: 16px; }
.tracer .setup-steps { margin: 0; max-width: 78ch; }
.trace-stage { position: relative; justify-self: start; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; line-height: 0; background: #fff; }
#trace-canvas { display: block; max-width: 100%; height: auto; touch-action: none; cursor: crosshair; }
#loupe { position: absolute; top: 8px; right: 8px; width: 140px; height: 140px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); pointer-events: none; }
#loupe.at-left { right: auto; left: 8px; }
.trace-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.trace-grid input[type="range"] { padding: 0; border: 0; background: none; accent-color: var(--primary); min-height: 44px; box-shadow: none; }
.label-like { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.color-chip { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 0.9375rem; color: var(--text-2); }
.color-chip::before { content: ""; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--chip, transparent); }
.tracer .cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }

/* The paste sheet */
.sheet textarea { font-family: ui-monospace, Consolas, monospace; font-size: 0.875rem; }
#paste-preview td, #paste-preview th { padding: 6px 10px; font-size: 0.8125rem; white-space: nowrap; }

@media (max-width: 900px) {
  .mic-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .card-title-row { flex-wrap: wrap; }
  #loupe { width: 110px; height: 110px; }
}
