/* QPTWavez - its own styles on top of the suite base (qpt.css, loaded first). Operator pages only:
   index.html (the hub), sync/index.html (laptop), sync/test.html (self-test). The phone page sync/phone.html is its
   own full-screen world and loads neither file (docs/BLUEPRINT.md B7). Own colours have own names (B2). */
:root {
  --wz: #b26bff;          /* QPTWavez purple (the front page card accent) */
  --wz-ink: #d7b6ff;      /* purple for words on the dark background */
  --wz-soft: rgba(178, 107, 255, .14);
  --too-much: #f3b33d;    /* EQ chart: band above the reference (same value as the suite amber, own name) */
  --too-little: #7cb8ff;  /* EQ chart: band below the reference */
}
body { min-height: 100vh; }
[hidden] { display: none !important; }
.bar { display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.bar .mark { display: inline-flex; align-items: center; gap: .45em; color: inherit; text-decoration: none !important; }
.bar .mark img { width: 26px; height: 26px; flex: none; display: block; }
.bar .mark .qpt-word { font-size: 1.05rem; }
.bar .tool { color: var(--text); font-weight: 700; font-size: 1.05rem; }
.bar .tool::before { content: "/"; color: #55636f; margin-right: .5em; font-weight: 400; }
.bar .right { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; }
.lede { color: var(--muted); margin: 0 0 20px; font-size: 1.05rem; }
footer.ver { margin-top: 36px; color: var(--muted); font-size: .8rem; }

/* buttons (product-own until D-00 brings shared ones) */
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 40px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 650; cursor: pointer; text-decoration: none !important; }
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, .drop:focus-visible { outline: 2px solid var(--wz); outline-offset: 2px; }
.btn.primary { background: var(--wz); border-color: var(--wz); color: #14091f; }
.btn.primary:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .5; cursor: default; }
select, input[type=number] { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-height: 40px; max-width: 100%; }

/* hub */
.tools { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.toolcard { display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--line); color: inherit; text-decoration: none !important; position: relative; overflow: hidden; min-height: 170px; }
.toolcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--wz); }
.toolcard:hover, .toolcard:focus-visible { border-color: var(--wz); outline: none; }
.toolcard h2 { margin: 0; font-size: 1.35rem; }
.toolcard p { margin: 0; }
.toolcard .go { margin-top: auto; color: var(--wz-ink); font-weight: 700; }

/* Sync: laptop page */
.sync { display: grid; gap: 28px; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); align-items: start; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--wz-soft); color: var(--wz-ink);
  display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.steps b { display: block; }
.qrcard { display: grid; gap: 10px; justify-items: center; text-align: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px; position: sticky; top: 76px; }
.qrcard .qr { width: 100%; max-width: 360px; aspect-ratio: 1; background: #fff; border-radius: 12px; overflow: hidden; }   /* ~9 px a module: scans from 1-2 m */
.qrcard .qr svg { display: block; width: 100%; height: 100%; }
.qrcard .scan { margin: 6px 0 0; font-size: 1.5rem; font-weight: 800; }
.qrcard .addr { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.qrcard .addr b { color: var(--text); font-weight: 650; }
.onphone { display: none; }
.flow { display: grid; gap: 16px; align-content: start; }
.flow .steps { font-size: 1.12rem; }
.say { margin: 0; }
.tip { margin: 0; color: var(--muted); font-size: .9rem; border-left: 3px solid var(--wz); padding-left: 10px; }
/* the analysis steps: grey (waiting) -> amber (working, animated) -> green tick, or red with a plain message */
.ana { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 1.15rem; }
.ana li { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; column-gap: 12px; color: var(--muted); }
.ana li i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; font-style: normal;
  font-size: .8rem; font-weight: 900; justify-self: center; }
.ana .msg { grid-column: 2; font-size: .95rem; }
.ana .msg:empty { display: none; }
.ana li[data-state=work] { color: var(--amber); }
.ana li[data-state=work] i { border-color: var(--amber); border-top-color: transparent; animation: wz-spin .8s linear infinite; }
.ana li[data-state=ok] { color: var(--green); }
.ana li[data-state=ok] i { border-color: var(--green); background: var(--green); color: var(--bg); }
.ana li[data-state=ok] i::before { content: "\2713"; }
.ana li[data-state=fail] { color: var(--bad-text); }
.ana li[data-state=fail] i { border-color: var(--bad-text); background: var(--bad-text); color: var(--bg); }
.ana li[data-state=fail] i::before { content: "\2715"; }
.ana li[data-state=fail] .msg { color: var(--text); }
@keyframes wz-spin { to { transform: rotate(360deg); } }
.result.in > * { animation: wz-rise .35s ease-out both; }
.result.in > *:nth-child(2) { animation-delay: .08s; }
@keyframes wz-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ana li[data-state=work] i { animation: none; border-top-color: var(--amber); }
  .result.in > * { animation: none; }
}
h3.grp { margin: 16px 0 8px; font-size: 1rem; color: var(--wz-ink); }
h3.grp:first-of-type { margin-top: 0; }

.drop { display: grid; place-items: center; text-align: center; gap: 8px; min-height: 190px; padding: 24px; border-radius: var(--radius);
  border: 2px dashed var(--line); background: var(--panel); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--wz); background: var(--wz-soft); }
.drop .big { font-size: 1.25rem; font-weight: 700; }
.drop input { display: none; }
.work { display: none; gap: 12px; }
.work.on { display: grid; }
.prog { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: var(--wz); transition: width .2s; }
.preview { display: flex; gap: 14px; align-items: center; }
.preview .scanvid { width: 200px; max-width: 45%; border-radius: 6px; background: #000; }

.result { display: grid; gap: 16px; margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.headline { font-size: clamp(1.7rem, 4.2vw, 2.6rem); font-weight: 800; line-height: 1.1; margin: 0; }
.headline.ok { color: var(--green); } .headline.late, .headline.early { color: var(--amber); } .headline.bad { color: var(--bad-text); }
.frames { color: var(--muted); font-size: 1.1rem; margin: 4px 0 12px; }
.fix { font-size: 1.1rem; margin: 0 0 12px; }
.conf { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .92rem; }
.conf b { color: var(--text); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pill.high { background: rgba(62, 194, 127, .18); color: var(--green); }
.pill.medium { background: rgba(243, 179, 61, .18); color: var(--amber); }
.pill.low { background: rgba(229, 68, 58, .18); color: var(--bad-text); }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--link); }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 8px; }
.tbl th, .tbl td { text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.dots { display: block; width: 100%; height: 56px; margin-top: 10px; }

.advice { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.advice li { border-left: 4px solid var(--line); padding: 6px 0 6px 12px; }
.advice li.fix { border-color: var(--live); } .advice li.tip { border-color: var(--amber); } .advice li.ok { border-color: var(--green); }
.advice .t { font-weight: 700; display: block; }
.advice li.fix .t { color: var(--bad-text); } .advice li.tip .t { color: var(--amber); } .advice li.ok .t { color: var(--green); }
.nums { color: var(--muted); font-size: .88rem; margin-top: 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.eqchart { width: 100%; max-width: 560px; height: auto; display: block; margin-top: 10px; }
.eqchart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.eqchart .v { fill: var(--text); font-weight: 700; }
.err { margin: 8px 0 0; }
.livepanel { margin-top: 20px; border-style: dashed; }
.livepanel .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.livepanel video { width: 260px; max-width: 100%; border-radius: 6px; background: #000; }
.notready { color: var(--amber); font-weight: 700; }

/* self-test */
.cases { width: 100%; border-collapse: collapse; }
.cases th, .cases td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .92rem; }
.cases td.st { font-weight: 800; white-space: nowrap; }
.cases .pass { color: var(--green); } .cases .fail { color: var(--bad-text); } .cases .run { color: var(--amber); }
.cases td.d { overflow-wrap: anywhere; color: var(--muted); }

@media (max-width: 900px) {
  .sync { grid-template-columns: minmax(0, 1fr); }
  .qrcard { position: static; }
  .qrcard .qr { max-width: 300px; }
}
@media (max-width: 640px) {
  .wrap { padding: 16px 16px 40px; }
  .bar { padding: 8px 16px; gap: 10px; }
  .bar .right { display: none; }
  .qrcard .qr, .qrcard .scan, .qrcard .addr { display: none; }
  .onphone { display: inline-flex; }
  .drop { min-height: 150px; }
  .preview .scanvid { width: 140px; }
  .tbl { font-size: .82rem; } .tbl th, .tbl td { padding: 4px 4px; }
  .cases td.d { font-size: .82rem; }
}
