/* Tuner: a small panel over the session. Same glass, type and orange as the metronome. */
.tuner { position: fixed; left: 28px; bottom: 112px; z-index: 70; width: 340px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 124px); overflow: auto; border-radius: 18px; padding: 12px 16px 14px; display: grid; gap: 10px; background: var(--glass-strong); box-shadow: var(--shadow); }
.tuner[hidden] { display: none; }
.tn-head { display: flex; align-items: center; gap: 8px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.tn-head b { font-size: 14px; font-weight: 700; }
.tn-muted { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #ff7070; background: rgba(240, 82, 82, .12); }
.tn-gap { flex: 1; }
#tnMore { color: var(--muted); }
.tuner.more #tnMore { color: var(--text); }

.tn-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tuner .field { gap: 4px; }
.tuner .field > span { font-size: 11px; color: var(--muted); }
.tuner .field select { height: 36px; padding: 0 10px; font-size: 13px; }

.tn-meter { position: relative; height: 158px; }
.tn-meter svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#tnScale line { stroke: rgba(255, 255, 255, .2); stroke-width: 1.5; stroke-linecap: round; }
#tnScale line.major { stroke: rgba(255, 255, 255, .42); }
#tnScale line.lit { stroke: var(--accent); stroke-width: 2; }
#tnScale line.zero { stroke: var(--text); stroke-width: 2.5; }
#tnScale text { fill: var(--muted); font-size: 10px; text-anchor: middle; font-variant-numeric: tabular-nums; }
#tnZone { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; opacity: .35; transition: opacity .2s; }
#tnNeedle { opacity: .25; transition: opacity .2s; }
.tuner.heard:not(.live) #tnNeedle { opacity: .55; }
#tnNeedle path { fill: var(--text); transition: fill .15s; }
.tuner.heard #tnNeedle { opacity: 1; }
.tuner.tuned #tnNeedle path { fill: var(--accent); }
.tuner.tuned #tnNeedle { filter: drop-shadow(0 0 7px rgba(255, 160, 51, .75)); }
.tuner.tuned #tnZone { opacity: 1; filter: drop-shadow(0 0 7px rgba(255, 160, 51, .75)); }

.tn-read { position: absolute; left: 0; right: 0; top: 52px; display: grid; justify-items: center; pointer-events: none; }
.tn-note { display: flex; align-items: flex-start; font-size: 72px; line-height: 1; font-weight: 800; letter-spacing: -3px; color: var(--muted); transition: color .15s; }
.tuner.heard .tn-note { color: var(--text); }
.tuner.tuned .tn-note { color: var(--accent); }
.tn-note sup, .tn-note sub { font-size: 24px; font-weight: 700; letter-spacing: 0; line-height: 1; }
.tn-note sup { margin: 7px 0 0 3px; }
.tn-note sub { align-self: flex-end; margin: 0 0 8px 2px; color: var(--muted); }
.tn-status { margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.tuner.tuned .tn-status { color: var(--accent); }
.tn-figs { display: flex; justify-content: space-between; align-items: baseline; font-variant-numeric: tabular-nums; }
.tn-figs span { font-size: 11px; color: var(--muted); }
.tn-figs b { font-size: 19px; font-weight: 700; color: var(--text); margin-right: 3px; letter-spacing: -.3px; }
.tn-bars { display: grid; gap: 6px; }
.tn-strobe { height: 16px; opacity: .3; background: repeating-linear-gradient(90deg, var(--text) 0 8px, transparent 8px 24px); -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); transition: opacity .2s; }
.tuner.live .tn-strobe { opacity: .8; }
.tuner.tuned .tn-strobe { background-image: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 24px); }
.tn-level { height: 3px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, .08); }
.tn-level i { display: block; height: 100%; width: 0; background: var(--accent); opacity: .7; transition: width .08s linear; }

.tn-strings-row { display: flex; gap: 6px; align-items: stretch; }
.tn-auto { flex: none; border: 1px solid var(--stroke-2); background: transparent; color: var(--muted); border-radius: 10px; padding: 0 10px; font-size: 11px; font-weight: 700; cursor: pointer; }
.tn-auto.on { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.tn-strings { flex: 1; min-width: 0; display: flex; gap: 4px; }
.tn-strings button { position: relative; flex: 1; min-width: 0; height: 42px; display: flex; align-items: baseline; justify-content: center; gap: 1px; padding: 11px 0 0; border-radius: 10px; border: 1px solid var(--stroke); background: rgba(255, 255, 255, .04); color: var(--text-2); cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.tn-strings b { font-size: 14px; font-weight: 700; }
.tn-strings small { font-size: 9px; color: var(--muted); }
.tn-strings button:hover { background: rgba(255, 255, 255, .08); }
.tn-strings button.current { color: var(--text); border-color: var(--stroke-2); background: rgba(255, 255, 255, .1); }
.tn-strings button.picked { color: var(--accent); border-color: var(--accent); background: rgba(255, 160, 51, .12); }
.tn-strings button.ok::after { content: ''; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.tn-foot { display: flex; align-items: center; gap: 8px; }
.tn-a4 { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tn-a4 button { width: 26px; height: 26px; padding: 0; border-radius: 8px; border: 1px solid var(--stroke); background: transparent; color: var(--text); cursor: pointer; }
.tn-a4 button:hover { background: rgba(255, 255, 255, .08); }
.tn-a4 b { min-width: 25px; text-align: center; color: var(--text); }
#tnHear { margin-left: auto; }
#tnHear.on { color: var(--accent); border-color: var(--accent); }
.tn-tip { margin: 0; font-size: 11px; line-height: 1.4; color: var(--muted); }

.tuner.page { position: static; z-index: auto; width: 100%; max-width: 380px; max-height: none; overflow: visible; margin: 0 auto; padding: 0; background: none; box-shadow: none; }
.tuner.page .tn-head { cursor: default; touch-action: auto; }
.tn-page { flex: 1; width: 100%; max-width: 420px; margin: 0 auto; padding: 8px 16px 40px; display: grid; align-content: center; }
.tn-page .btn-lg { width: 100%; }
.tn-page .error { margin: 0; text-align: center; }
.tn-page .error:empty { display: none; }

/* In the dashboard: the page heading is already there, and the content area sets the width */
.view .tn-page { max-width: none; padding: 0; align-content: start; }
.view .tuner.page .tn-head { display: none; }
.view .tuner .field select { padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b8b94' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; }
.view .tuner #tnHear { background: transparent; border: 1px solid var(--stroke-2); color: var(--text); }
.view .tuner #tnHear:disabled { color: var(--muted); }
.view .tuner #tnHear.on { color: var(--accent); border-color: var(--accent); }

/* In a session on a computer, the panel stays short: the gear opens what's rarely needed */
@media (min-width: 721px) {
  .tuner:not(.page):not(.more) .tn-extra { display: none; }
}

/* The Tuner page on a computer: the meter is the page, the controls sit quietly beside it */
@media (min-width: 1000px) {
  .tn-page { max-width: 1240px; padding: 0 48px 48px; }
  .view .tn-page { max-width: 1240px; padding: 0; margin: 0; --tn-room: 480px; }
  .tuner.page { max-width: none; grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: repeat(9, auto) 1fr; column-gap: 72px; row-gap: 0; align-items: start; }
  .tuner.page .tn-meter, .tuner.page .tn-figs, .tuner.page .tn-bars, .tuner.page .tn-strings-row { grid-column: 1; width: 100%; max-width: min(100%, calc((100dvh - var(--tn-room, 372px)) * 2)); justify-self: center; }
  .tuner.page .tn-meter { grid-row: 1 / span 7; height: auto; aspect-ratio: 320 / 158; container-type: inline-size; }
  .tuner.page .tn-figs { grid-row: 8; margin-top: -58px; position: relative; pointer-events: none; }
  .tuner.page .tn-bars { grid-row: 9; margin-top: 12px; gap: 8px; }
  .tuner.page .tn-strobe { height: 22px; }
  .tuner.page .tn-strings-row { grid-row: 10; margin-top: 18px; gap: 8px; }
  .tuner.page .tn-head, .tuner.page .tn-choose, .tuner.page .tn-listen, .tuner.page .tn-foot, .tuner.page #tnStart, .tuner.page .tn-tip, .tuner.page .error { grid-column: 2; }
  .tuner.page .tn-head { grid-row: 1; margin-bottom: 20px; }
  .tuner.page .tn-head i { display: none; }
  .tuner.page .tn-head b { font-size: 34px; letter-spacing: -.03em; line-height: 1.1; }
  .tuner.page .tn-choose { grid-row: 2; grid-template-columns: 1fr; gap: 14px; }
  .tuner.page .tn-listen { grid-row: 3; margin-top: 14px; }
  .tuner.page .field select { height: 42px; font-size: 14px; }
  .tuner.page .field > span { font-size: 12px; }
  .tuner.page .tn-foot { grid-row: 4; margin-top: 16px; }
  .tuner.page #tnStart { grid-row: 5; margin-top: 20px; }
  .tuner.page .error { grid-row: 6; margin-top: 10px; text-align: left; }
  .tuner.page .tn-tip { grid-row: 7; margin-top: 12px; font-size: 12px; }

  .tuner.page .tn-read { top: 31%; }
  .tuner.page .tn-read::before { content: ''; position: absolute; left: 50%; top: 30%; width: 62cqw; height: 44cqw; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(255, 160, 51, .16), transparent); opacity: 0; transition: opacity .25s; }
  .tuner.page.tuned .tn-read::before { opacity: 1; }
  .tuner.page .tn-note { position: relative; font-size: 25cqw; letter-spacing: -.04em; }
  .tuner.page .tn-note sup, .tuner.page .tn-note sub { font-size: 6.5cqw; }
  .tuner.page .tn-note sup { margin: 1.6cqw 0 0 .8cqw; }
  .tuner.page .tn-note sub { margin: 0 0 2.2cqw .6cqw; }
  .tuner.page .tn-status { position: relative; margin-top: 1cqw; font-size: max(15px, 2.4cqw); }
  .tuner.page #tnScale text { font-size: 7px; }
  .tuner.page .tn-figs span { font-size: 13px; }
  .tuner.page .tn-figs b { font-size: 32px; margin-right: 5px; letter-spacing: -.02em; }
  .tuner.page .tn-auto { padding: 0 18px; border-radius: 12px; font-size: 13px; }
  .tuner.page .tn-strings { gap: 8px; }
  .tuner.page .tn-strings button { height: 64px; padding-top: 19px; border-radius: 12px; }
  .tuner.page .tn-strings b { font-size: 20px; }
  .tuner.page .tn-strings small { font-size: 11px; }
  .tuner.page .tn-strings button.ok::after { top: 8px; right: 8px; width: 7px; height: 7px; }
}
#pjTuner.on { color: var(--on-accent); background: var(--accent); }

@media (max-width: 720px) {
  .tuner { left: 8px; right: 8px; bottom: 76px; width: auto; max-width: none; max-height: calc(100dvh - 88px); border-radius: 18px; padding: 10px 12px 12px; }
  .tn-head { cursor: default; }
  .tn-meter { height: 146px; }
  .tn-read { top: 50px; }
  .tn-note { font-size: 60px; }
}
@media (max-height: 700px) {
  .tn-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tn-strobe { display: none; }
  .tn-level i, #tnNeedle, #tnNeedle path, .tn-note, #tnZone, .tn-read::before { transition: none; }
}
