
.hqmd {
  --hqmd-bg:#101010;
  --hqmd-panel:#171717;
  --hqmd-panel-2:#1d1d1d;
  --hqmd-border:#343434;
  --hqmd-text:#f2f2f2;
  --hqmd-muted:#b7b7b7;
  --hqmd-accent:#d39c48;
  --hqmd-accent-hover:#e0aa58;
  --hqmd-track:#55555d;
  max-width:1100px;
  margin:2rem auto;
  color:var(--hqmd-text);
  font-size:16px;
  line-height:1.5;
}
.hqmd *, .hqmd *::before, .hqmd *::after { box-sizing:border-box; }
.hqmd__header { margin-bottom:2rem; }
.hqmd__header h2 { margin:0 0 .45rem; color:var(--hqmd-text); }
.hqmd__header p { margin:0; color:var(--hqmd-text); }
.hqmd__grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1.5rem; }
.hqmd__panel { position:relative; padding:2rem; border:1px solid var(--hqmd-border); border-radius:10px; background:var(--hqmd-panel); color:var(--hqmd-text); box-shadow:none; }
.hqmd__panel h3 { margin:0 0 1.5rem; color:var(--hqmd-text); }
.hqmd__panel--quality h3 { padding-right:96px; }
.hqmd label { display:block; margin:0 0 .55rem; color:var(--hqmd-text); font-weight:600; }
.hqmd output { float:right; min-width:1.2em; color:var(--hqmd-accent); font-weight:700; text-align:right; }
.hqmd select {
  display:block; width:100%; min-height:46px; margin:0 0 1.65rem; padding:.55rem .75rem;
  border:1px solid #444; border-radius:4px; background-color:var(--hqmd-panel-2);
  color:var(--hqmd-text); font:inherit; appearance:auto;
}
.hqmd select:focus { outline:2px solid var(--hqmd-accent); outline-offset:1px; border-color:var(--hqmd-accent); }
.hqmd input[type="range"] {
  display:block; width:100%; height:24px; margin:0 0 .05rem; padding:0;
  background:transparent; accent-color:var(--hqmd-accent); cursor:pointer;
}
.hqmd input[type="range"]::-webkit-slider-runnable-track {
  height:6px; border:1px solid #777783; border-radius:999px; background:var(--hqmd-track);
}
.hqmd input[type="range"]::-webkit-slider-thumb {
  width:22px; height:22px; margin-top:-9px; border:2px solid #f0f0f0; border-radius:50%;
  background:var(--hqmd-accent); box-shadow:0 0 0 2px #222; appearance:none;
}
.hqmd input[type="range"]::-moz-range-track {
  height:6px; border:1px solid #777783; border-radius:999px; background:var(--hqmd-track);
}
.hqmd input[type="range"]::-moz-range-thumb {
  width:18px; height:18px; border:2px solid #f0f0f0; border-radius:50%;
  background:var(--hqmd-accent); box-shadow:0 0 0 2px #222;
}
.hqmd__range-group { margin-bottom:1.65rem; }
.hqmd__range-group label { margin-bottom:.45rem; }
.hqmd__scale {
  display:grid; grid-template-columns:repeat(6,1fr); width:100%; margin-top:.05rem;
  color:#8f8f8f; font-size:.78rem; line-height:1; text-align:center;
}
.hqmd__scale span:first-child { text-align:left; }
.hqmd__scale span:last-child { text-align:right; }
.hqmd__scale-label {
  min-height:1.35rem; margin-top:.45rem; color:var(--hqmd-accent);
  font-size:.86rem; font-weight:600; text-align:center;
}
.hqmd__button {
  width:100%; min-height:48px; border:1px solid var(--hqmd-accent); border-radius:5px;
  padding:.75rem 1rem; background:var(--hqmd-accent); color:#111; cursor:pointer;
  font:inherit; font-weight:700; transition:background .15s ease,border-color .15s ease,transform .05s ease;
}
.hqmd__button:hover { border-color:var(--hqmd-accent-hover); background:var(--hqmd-accent-hover); }
.hqmd__button:active { transform:translateY(1px); }
.hqmd__readonly {
  width:100%; min-height:46px; margin:0 0 .35rem; padding:.55rem .75rem;
  border:1px solid #444; border-radius:4px; background:var(--hqmd-panel-2); color:var(--hqmd-text);
}
.hqmd__hint { margin:0 0 1.65rem; color:var(--hqmd-muted); font-size:.78rem; line-height:1.35; }
.hqmd__footer-meta { margin-top:.8rem; color:var(--hqmd-muted); font-size:.82rem; line-height:1.35; }
.hqmd__footer-meta p { margin:.1rem 0; color:var(--hqmd-muted); }
.hqmd__footer-meta a { color:inherit; text-decoration:underline; text-underline-offset:2px; }
.hqmd__footer-meta a:hover,.hqmd__footer-meta a:focus { opacity:.82; }
.hqmd__status { min-height:1.5rem; margin:1.1rem 0; color:var(--hqmd-muted); }
.hqmd__results { display:grid; gap:12px; margin-top:18px; }
.hqmd__result { background:var(--hqmd-panel); border:1px solid var(--hqmd-border); border-radius:8px; padding:1.1rem; color:var(--hqmd-text); }
.hqmd__result-head { display:flex; justify-content:space-between; gap:15px; align-items:center; }
.hqmd__description { color:#c9c9c9; line-height:1.5; margin:10px 0 12px; }
.hqmd__meta { display:flex; flex-wrap:wrap; gap:7px 14px; color:#999; font-size:.83rem; }
.hqmd__rating { display:flex; gap:4px; white-space:nowrap; }
.hqmd__rating-logo { position:relative; display:inline-block; width:25px; height:25px; overflow:hidden; }
.hqmd__rating-logo>img { position:absolute; inset:1px; width:23px; height:23px; object-fit:contain; opacity:.18; }
.hqmd__rating-logo>span { position:absolute; left:0; top:0; height:100%; overflow:hidden; }
.hqmd__rating-logo>span img { position:absolute; left:1px; top:1px; width:23px; height:23px; max-width:none; object-fit:contain; display:block; }
.hqmd__brand-logo-box {
  position:absolute; top:18px; right:18px; display:block; width:64px; height:64px;
  max-width:64px; max-height:64px; margin:0; padding:0; overflow:hidden; pointer-events:none;
}
.hqmd__brand-logo-box > img.hqmd__brand-logo {
  position:static; display:block; width:64px; height:64px; min-width:0; min-height:0;
  max-width:64px; max-height:64px; margin:0; padding:0; object-fit:contain; opacity:.92; transform:none;
}
[hidden] { display:none!important; }
@media(max-width:760px) {
  .hqmd__grid { grid-template-columns:1fr; }
  .hqmd__panel { padding:1.25rem; }
  .hqmd__result-head { align-items:flex-start; flex-direction:column; }
}
@media(max-width:640px) {
  .hqmd__brand-logo-box { width:50px; height:50px; max-width:50px; max-height:50px; top:14px; right:14px; }
  .hqmd__brand-logo-box > img.hqmd__brand-logo { width:50px; height:50px; max-width:50px; max-height:50px; }
  .hqmd__panel--quality h3 { padding-right:64px; }
}

/* Result design aligned with HQPlayer Filter Settings 1.4.8 */
.hqmd__results {
  display:block;
  margin-top:18px;
}
.hqmd__result {
  display:grid;
  grid-template-columns:48px 1fr;
  gap:1rem;
  margin-bottom:.8rem;
  padding:1.1rem;
  border:1px solid var(--hqmd-border);
  border-radius:8px;
  background:var(--hqmd-panel);
  color:var(--hqmd-text);
}
.hqmd__result--top {
  border-color:var(--hqmd-border);
  border-width:1px;
}
.hqmd__rank {
  display:grid;
  place-items:center;
  width:36px;
  height:36px;
  border:1px solid var(--hqmd-border);
  border-radius:50%;
  background:var(--hqmd-panel-2);
  color:var(--hqmd-text);
  font-weight:800;
}
.hqmd__result--top .hqmd__rank {
  border-color:var(--hqmd-border);
  color:var(--hqmd-text);
}
.hqmd__result-main { min-width:0; }
.hqmd__result-head {
  display:flex;
  justify-content:space-between;
  gap:1rem;
  align-items:center;
}
.hqmd__result-name {
  display:inline-block;
  padding:.15rem .35rem;
  border-radius:3px;
  background:#242424;
  color:var(--hqmd-text);
  font-size:1.05rem;
  font-weight:700;
}
.hqmd__description {
  margin:.55rem 0 .85rem;
  color:var(--hqmd-muted);
  line-height:1.5;
}
.hqmd__meta {
  display:flex;
  flex-wrap:wrap;
  gap:.45rem;
  color:var(--hqmd-muted);
  font-size:.9rem;
}
.hqmd__meta > span {
  padding:.2rem .5rem;
  border:1px solid var(--hqmd-border);
  border-radius:4px;
  background:var(--hqmd-panel-2);
  color:var(--hqmd-muted);
}
.hqmd__rating {
  display:inline-flex;
  align-items:center;
  gap:.25rem;
  flex:0 0 auto;
}
@media(max-width:760px) {
  .hqmd__result { grid-template-columns:40px 1fr; }
  .hqmd__result-head { align-items:flex-start; flex-direction:column; }
}

/* Contextual help popups 1.4.4 */
.hqmd__label-help{display:flex;align-items:center;justify-content:space-between;gap:.55rem}
.hqmd__label-help>label{flex:1;min-width:0}
.hqmd__label-help>label output{float:none;margin-left:.35rem}
.hqmd__help-button{
  width:28px!important;height:28px!important;min-width:28px!important;min-height:28px!important;
  max-width:28px!important;max-height:28px!important;padding:0!important;display:inline-flex!important;
  align-items:center!important;justify-content:center!important;border:1px solid var(--hqmd-border)!important;
  border-radius:50%!important;background:transparent!important;color:var(--hqmd-muted)!important;
  font:inherit!important;font-size:15px!important;line-height:1!important;cursor:pointer
}
.hqmd__help-button:hover,.hqmd__help-button:focus-visible{
  border-color:var(--hqmd-accent)!important;color:var(--hqmd-accent)!important
}
.hqmd__help-dialog{
  width:min(760px,calc(100vw - 32px));max-height:calc(100vh - 48px);padding:0;
  border:1px solid #4a4a4a;border-radius:14px;background:#1b1b1b;color:var(--hqmd-text);
  box-shadow:0 18px 60px rgba(0,0,0,.55)
}
.hqmd__help-dialog::backdrop{background:rgba(0,0,0,.72)}
.hqmd__help-dialog-inner{position:relative;padding:32px 40px 30px;overflow:auto}
.hqmd__help-dialog h4{margin:0 52px 20px 0;font-size:1.25rem;color:var(--hqmd-text)}
.hqmd__help-dialog p{margin:.7rem 0;line-height:1.55}
.hqmd__help-dialog dl{display:grid;grid-template-columns:max-content 1fr;gap:.55rem 1.25rem;margin:1.4rem 0}
.hqmd__help-dialog dt{font-weight:700;color:var(--hqmd-text)}
.hqmd__help-dialog dd{margin:0;color:var(--hqmd-muted)}
.hqmd__help-note{margin-top:1.25rem!important}
.hqmd__help-close{
  position:absolute!important;top:16px!important;right:16px!important;width:36px!important;height:36px!important;
  min-width:36px!important;min-height:36px!important;max-width:36px!important;max-height:36px!important;
  padding:0!important;display:flex!important;align-items:center!important;justify-content:center!important;
  border:1px solid var(--hqmd-accent)!important;border-radius:50%!important;background:var(--hqmd-accent)!important;
  color:#fff!important;font:inherit!important;font-size:24px!important;font-weight:700!important;line-height:1!important;cursor:pointer
}
@media(max-width:600px){
  .hqmd__help-dialog-inner{padding:26px 22px 24px}
  .hqmd__help-dialog dl{grid-template-columns:1fr;gap:.2rem}
  .hqmd__help-dialog dd{margin-bottom:.6rem}
}

/* Help button contrast 1.4.5 */
.hqmd__help-button{
  border-color:#ffffff!important;
  color:#ffffff!important;
}
.hqmd__help-button:hover,
.hqmd__help-button:focus-visible{
  border-color:var(--hqmd-accent)!important;
  color:var(--hqmd-accent)!important;
}

/* DAC device information 1.4.8 */
.hqmd__dac-info{display:grid;gap:8px;margin-top:10px}
.hqmd__dac-info .hqmd__readonly{margin:0}

/* 1.6.0: direct output-mode options and version history */
.hqmd__field-label{font-weight:600}
.hqmd__option-group{display:flex;gap:.65rem;margin:.25rem 0 1rem}
.hqmd__option{display:flex;flex:1;align-items:center;justify-content:center;gap:.5rem;min-height:44px;margin:0;padding:.55rem .8rem;border:1px solid var(--hqmd-border);border-radius:6px;background:var(--hqmd-panel-2);color:var(--hqmd-text);font-weight:600;cursor:pointer}
.hqmd__option:has(input:checked){border-color:var(--hqmd-accent);box-shadow:0 0 0 1px var(--hqmd-accent)}
.hqmd__option input[type="radio"]{width:18px;height:18px;margin:0;accent-color:var(--hqmd-accent);cursor:pointer}
.hqmd__version-link{display:inline;margin:0;padding:0;border:0;background:transparent;color:inherit;font:inherit;line-height:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer}
.hqmd__version-link:hover,.hqmd__version-link:focus-visible{opacity:.82}
.hqmd__version-history{grid-template-columns:minmax(160px,max-content) 1fr}
.hqmd__version-history dd{line-height:1.5}

.hqmd__data-disclaimer{margin-top:4px;font-size:.78rem;line-height:1.35;opacity:.68}

.hqmd__result[data-hqmd-result]{cursor:pointer}.hqmd__result--selected{outline:2px solid rgba(217,161,43,.75);outline-offset:2px}

/* 2.8.4: Bridge-only manual Q1 refresh, with own theme-independent button skin. */
.hqmd__bridge-refresh-row{margin:-.25rem 0 1.15rem}
[data-hqmd] .hqmd__bridge-refresh-button {
  display:inline-flex !important;align-items:center;justify-content:center;
  min-height:38px;padding:.5rem .85rem;
  border:1px solid #e8b04a !important;border-radius:5px;
  background:#171717 !important;color:#e8b04a !important;
  box-shadow:none !important;text-decoration:none !important;
  font:inherit;font-weight:700;cursor:pointer;
}
[data-hqmd] .hqmd__bridge-refresh-button:hover,
[data-hqmd] .hqmd__bridge-refresh-button:focus,
[data-hqmd] .hqmd__bridge-refresh-button:focus-visible {
  background:#e8b04a !important;color:#171717 !important;
  border-color:#e8b04a !important;box-shadow:none !important;
  text-decoration:none !important;outline:none !important;
}
[data-hqmd] .hqmd__bridge-refresh-button:disabled {
  background:#e8b04a !important;color:#171717 !important;
  border-color:#e8b04a !important;opacity:.72 !important;cursor:wait;
}
