/* MT-04 metronome round 3b (Jeff approved 10-20 23:24): the hardware console (option B) for
   the Tempo module, the small metronome while reading, the count-in bar in the same look,
   seven-segment digits that all fill one cell, and the tuner's green line.
   Ported from the approved prototype (DAY-1019/FOR-JEFF-METRONOME-ROUND3B.html).
   glass-green4: the roots are the kit glass sheet and every control is a kit owner; the
   hardware faces are kit variants in gn-kit.css. This file keeps layout and the LED parts. */
:root {
  --gnw-mt-frame: #C2B391;
  --gnw-mt-glass: #3A2820;
  --gnw-mt-lit: #FFF3B8;
  --gnw-mt-typed: #FFD98A;
  --gnw-mt-amber: #D5A83F;
  --gnw-mt-amber-deep: #B9792E;
  --gnw-mt-green: #7BE39A;
  --gnw-mt-shell: linear-gradient(180deg, rgba(244,238,224,.98), rgba(233,225,208,.98));
}

/* ---------- shared parts ---------- */
.gnw-mt-jewel {
  position: relative; display: block; flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #786A45, #3A2820); border: 1px solid #6B5B46;
  box-shadow: inset 0 -2px 4px rgba(58,40,32,.72), inset 0 2px 2px rgba(253,252,249,.38);
}
[aria-pressed="true"] > .gnw-mt-jewel {
  background: radial-gradient(circle at center, #FFFDF8 0%, var(--gnw-mt-amber) 30%, var(--gnw-mt-amber-deep) 100%);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.3), 0 0 8px 3px rgba(213,168,63,.72);
}

/* seven segments: one fixed cell (gnSeg7 in app.js draws the polygons) */
.gnw-mt-seg7 { display: flex; gap: 5px; transform: skewX(-6deg); }
.gnw-mt-dg { flex: 0 0 auto; display: block; filter: drop-shadow(0 0 3px rgba(213,168,63,.78)) drop-shadow(0 0 8px rgba(185,121,46,.52)); }
.gnw-mt-dg polygon { fill: rgba(255,243,184,.07); }
.gnw-mt-dg polygon.gnw-on { fill: var(--gnw-mt-lit); }
.gnw-mt-seg7[data-typing="true"] polygon.gnw-on { fill: var(--gnw-mt-typed); }
#gnwTempoReadout .gnw-mt-dg { width: 36px; height: 63px; }
#countInBand .gnw-mt-cell .gnw-mt-dg { width: 20px; height: 35px; }

.gnw-mt-key { display: grid; place-items: center; }
.gnw-mt-glyph { width: 26px; height: 26px; display: block; filter: drop-shadow(0 0 3px rgba(213,168,63,.78)) drop-shadow(0 0 8px rgba(185,121,46,.52)); }
.gnw-mt-glyph polygon { fill: rgba(255,243,184,.07); }
.gnw-mt-key[aria-pressed="false"] .gnw-mt-glyph polygon[data-glyph="play"],
.gnw-mt-key[aria-pressed="true"] .gnw-mt-glyph polygon[data-glyph="stop"] { fill: var(--gnw-mt-lit); }
/* pressed sits on the kit selected face (cream), so the lit glyph is the kit ink */
html[data-gn-glow] .gnw-mt-key[aria-pressed="true"] .gnw-mt-glyph { filter: none; }
html[data-gn-glow] .gnw-mt-key[aria-pressed="true"] .gnw-mt-glyph polygon { fill: transparent; }
html[data-gn-glow] .gnw-mt-key[aria-pressed="true"] .gnw-mt-glyph polygon[data-glyph="stop"] { fill: var(--gn-k-ink); }

/* the pendulum: the arm angle is written every frame by the one renderer */
.gnw-mt-pend { position: relative; flex: 0 0 auto; }
.gnw-mt-arm {
  position: absolute; left: 50%; bottom: 6px; width: 3px; margin-left: -1.5px; background: var(--gnw-mt-lit);
  box-shadow: 0 0 6px rgba(213,168,63,.78); transform-origin: bottom center; transform: rotate(0deg);
}
.gnw-mt-arm::before { content: ""; position: absolute; left: 50%; transform: translateX(-50%); background: var(--gnw-mt-amber); border-radius: 2px; }
.gnw-mt-pivot { position: absolute; left: 50%; bottom: 2px; border-radius: 50%; background: var(--gnw-mt-lit); box-shadow: 0 0 6px rgba(213,168,63,.78); }
.gnw-mt-pend[data-rest="true"] .gnw-mt-arm { opacity: .38; box-shadow: none; }
.gnw-mt-pend[data-size="large"] { width: 44px; height: 64px; }
.gnw-mt-pend[data-size="large"] .gnw-mt-arm { height: 52px; }
.gnw-mt-pend[data-size="large"] .gnw-mt-arm::before { top: 14px; width: 14px; height: 8px; }
.gnw-mt-pend[data-size="large"] .gnw-mt-pivot { width: 8px; height: 8px; margin-left: -4px; }
.gnw-mt-pend[data-size="small"] { width: 40px; height: 52px; }
.gnw-mt-pend[data-size="small"] .gnw-mt-arm { height: 42px; }
.gnw-mt-pend[data-size="small"] .gnw-mt-arm::before { top: 10px; width: 12px; height: 7px; }
.gnw-mt-pend[data-size="small"] .gnw-mt-pivot { width: 7px; height: 7px; margin-left: -3.5px; }

/* the single beat light: ON is a snap (no transition); its fade-out is computed per frame */
.gnw-mt-lamp,
#gnwTempoModule .gnw-tempo-led.gnw-mt-lamp {
  --gnw-led: 0;
  position: relative; display: block; width: 14px; height: 14px; margin: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #786A45, #3A2820); border: 1px solid #6B5B46;
  box-shadow: none; transition: none; opacity: 1; transform: none;
}
.gnw-mt-lamp::after,
#gnwTempoModule .gnw-tempo-led.gnw-mt-lamp::after {
  /* the legacy .gnw-tempo-led::after is a 30% blurred speck: undo its size, offsets and blur */
  content: ""; position: absolute; inset: -1px; width: auto; height: auto; filter: none; border-radius: 50%;
  background: radial-gradient(circle at center, #FFFDF8 0%, var(--gnw-mt-amber) 34%, var(--gnw-mt-amber-deep) 100%);
  box-shadow: 0 0 10px 4px rgba(213,168,63,.75); opacity: var(--gnw-led); transition: none;
}

/* ---------- the full-size console (the Tempo module) ---------- */
body.reader-focus #gnwTempoModule.gnw-mt-console.gnw-visible,
#gnwTempoModule.gnw-mt-console.gnw-visible {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  width: min(300px, calc(100vw - 16px)) !important; padding: 12px !important; box-sizing: border-box;
  max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain;
}
#gnwTempoModule.gnw-mt-console .gnw-tempo-header { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 0; width: 100%; }
#gnwTempoModule.gnw-mt-console #gnwTempoGrip { width: 24px; height: 44px; flex: 0 0 auto; }
#gnwTempoModule.gnw-mt-console #gnwTempoClose { flex: 0 0 auto; }
.gnw-mt-title { flex: 1; min-width: 0; }
.gnw-mt-eyebrow { margin: 0; }
.gnw-mt-name { margin: 0; }

.gnw-mt-window {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  background: var(--gnw-mt-glass); border: 2px solid #000; border-radius: 8px;
  box-shadow: inset 0 4px 8px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.2);
}
.gnw-mt-left { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 44px; }
.gnw-mt-left .gnw-mt-lamp { margin: 6px 0 4px; }
#gnwTempoModule .gnw-mt-digits {
  flex: 1; display: grid; place-items: center; min-height: 70px; min-width: 0; margin: 0;
}
.gnw-mt-right { display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* the note's line is reserved hidden or shown, so a failed save moves no key */
#gnwTempoModule .gnw-tempo-unsaved { margin: 6px 0 0; text-align: center; }
.gnw-mt-keys { display: flex; gap: 8px; margin-top: 4px; }
#gnwTempoModule .gnw-mt-keys .gnw-mt-step { width: 62px; min-height: 60px; padding: 0; }
#gnwTempoModule .gnw-mt-keys #gnwTapBtn { flex: 1; width: auto; height: auto; min-height: 60px; }
.gnw-mt-toggles { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 8px; margin-top: 0; }
/* the old 28 px Tempo-module buttons keep their ids; the console sizes them */
#gnwTempoModule #gnwTempoSound { display: flex; width: auto; height: auto; flex: initial; }
#gnwTempoModule #gnwTempoPlay { width: 44px; height: 44px; }
.gnw-mt-mode { margin: 2px 0 0; text-align: center; }

#gnwTempoModule .metronome-beat-sync { display: grid; gap: 5px; width: 100%; margin: 10px 0 0; justify-items: stretch; text-align: left; }
#gnwTempoModule #roomBeatSyncLabel { margin: 0; }

/* the keypad replaces the keys in place (one thing, not two) */
#gnwTempoModule .gnw-numpad.gn-k-sheet { display: none; position: static; order: 5; width: auto; min-width: 0; padding: 0; margin: 4px 0 0; }
#gnwTempoModule .gnw-numpad.gn-k-sheet.gnw-visible { display: block; }
#gnwTempoModule .metronome-beat-sync { order: 6; }
#gnwTempoModule[data-editing="true"] :is(.gnw-mt-keys, .gnw-mt-toggles, .gnw-mt-mode) { display: none; }
#gnwTempoModule .gnw-numpad-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 56px; column-gap: 6px; }
#gnwTempoModule .gnw-np-key { width: 100%; height: 100%; padding: 0; }
/* a short window keeps the whole keypad on screen (keys stay 44 px tall) */
@media (max-height: 600px) { #gnwTempoModule .gnw-numpad-grid { grid-auto-rows: 48px; } }
#gnwTempoModule .gnw-np-key.gnw-tall { grid-row: span 2; }
#gnwTempoModule .gnw-np-key.gnw-wide { grid-column: span 2; }

/* ---------- the small metronome while reading ---------- */
.gnw-mt-mini {
  position: fixed; left: 0; top: 0; z-index: var(--gn-layer-floating-popover, 60);
  width: 62px; height: 90px; padding: 6px; box-sizing: border-box; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #F3ECDD; border: 1.5px solid var(--gnw-mt-frame); pointer-events: none;
  transition: left .18s ease-out, top .18s ease-out;
}
.gnw-mt-mini[hidden] { display: none !important; }
.gnw-mt-mini-window {
  width: 48px; height: 56px; border-radius: 7px; background: var(--gnw-mt-glass); border: 1.5px solid #000;
  box-shadow: inset 0 3px 6px rgba(0,0,0,.8); display: grid; place-items: center; overflow: hidden;
}
.gnw-mt-mini[data-live="true"] {
  pointer-events: auto; cursor: pointer; background: var(--gnw-mt-shell);
  box-shadow: 0 0 0 2px rgba(213,168,63,.55), 0 6px 14px rgba(74,59,50,.30), inset 1px 1px 2px rgba(255,255,255,.7);
}
.gnw-mt-mini[data-lifted="true"] { transition: none; box-shadow: 0 0 0 3px rgba(213,168,63,.85), 0 14px 28px rgba(74,59,50,.42); transform: scale(1.06); }
@media (prefers-reduced-motion: reduce) { .gnw-mt-mini { transition: none; } }

/* ---------- the count-in bar, same family look ---------- */
html[data-gn-glow] #countInBand #countInBarContent,
#countInBand #countInBarContent {
  position: relative; display: flex; align-items: center; gap: 8px;
}
#countInBand #startCountIn.gnw-mt-key[disabled] { opacity: .35; cursor: not-allowed; }
#countInBand .count-in-glass.gnw-mt-ciwin {
  display: flex; align-items: center; gap: 4px; min-height: 50px; padding: 6px 9px !important; box-sizing: border-box;
  background: var(--gnw-mt-glass) !important; background-image: none !important; border: 2px solid #000 !important; border-radius: 8px !important;
  box-shadow: inset 0 4px 8px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.2) !important;
}
#countInBand .gnw-mt-ciwin .count-in-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#countInBand .gnw-mt-ciwin .count-in-progress { display: flex; align-items: center; gap: 0; }
#countInBand .count-in-progress-cell.gnw-mt-cell {
  position: relative; display: flex; flex: 0 0 auto; min-width: 0; width: auto; height: auto; padding: 0 2px; margin: 0; border: 0; border-radius: 4px;
  background: none !important; box-shadow: none !important; color: transparent;
}
/* gn-navigation pins floating count cells at 28 px; a two-digit count (10 to 12) needs its width */
html[data-gn-glow="1"] #gnCountFloat #countInProgress > .count-in-progress-cell.gnw-mt-cell { width: auto; min-width: 24px; }
#countInBand .count-in-progress-cell.gnw-mt-cell[data-bar-start="true"] { margin-left: 7px; border-left: 2px solid rgba(255,243,184,.22); padding-left: 8px; border-radius: 0; }
#countInBand .gnw-mt-cell .gnw-mt-seg7 { gap: 0; }
#countInBand .gnw-mt-cell .gnw-mt-dg { filter: none; }
#countInBand .gnw-mt-cell .gnw-mt-dg polygon.gnw-on { fill: rgba(255,243,184,.30); }
#countInBand[data-state="idle"] .gnw-mt-cell .gnw-mt-dg polygon.gnw-on { fill: rgba(255,243,184,.22); }
#countInBand .gnw-mt-cell[data-active="true"] .gnw-mt-dg polygon.gnw-on { fill: var(--gnw-mt-lit); }
#countInBand .gnw-mt-cell[data-active="true"] .gnw-mt-dg { filter: drop-shadow(0 0 3px rgba(213,168,63,.78)) drop-shadow(0 0 8px rgba(185,121,46,.52)); }

/* Jeff 10-20 23:24: the count-in bar stays visible while it counts during reading, then folds. */
html[data-gn-glow] body.reader-focus.reader-chrome-hidden.gnw-count-in-live:not(.annotation-mode) #gnCountFloat,
html[data-gn-glow] body.reader-focus.reader-chrome-hidden.gnw-count-in-live:not(.annotation-mode) #countInBand,
body.reader-focus.reader-chrome-hidden.gnw-count-in-live:not(.annotation-mode) .count-in-band {
  visibility: visible !important; opacity: 1 !important; display: block !important;
}

/* ---------- tuner: the centre line is green; in tune, the whole row is green ---------- */
#gnwTunerNeedle.gnw-mt-ladder {
  display: flex; justify-content: center; align-items: flex-end; gap: 4px; width: 100%; box-sizing: border-box; height: auto; padding: 6px 8px;
  background: var(--gnw-mt-glass); border: 2px solid #000; border-radius: 8px; box-shadow: inset 0 3px 6px rgba(0,0,0,.8);
}
#gnwTunerNeedle.gnw-mt-ladder > i { display: block; width: 7px; height: 12px; border-radius: 2px; background: rgba(255,243,184,.10); box-shadow: inset 0 0 0 1px rgba(255,243,184,.12); }
#gnwTunerNeedle.gnw-mt-ladder > i[data-mid="true"] { height: 20px; background: rgba(123,227,154,.30); box-shadow: inset 0 0 0 1px rgba(123,227,154,.45); }
#gnwTunerNeedle.gnw-mt-ladder > i[data-lit="true"] { background: var(--gnw-mt-lit); box-shadow: 0 0 6px 2px rgba(213,168,63,.75); }
#gnwTunerNeedle.gnw-mt-ladder > i[data-mid="true"][data-lit="true"],
#gnwTunerNeedle.gnw-mt-ladder[data-state="in-tune"] > i { background: var(--gnw-mt-green); box-shadow: 0 0 7px 2px rgba(47,158,87,.75); }

/* while it is being dragged the small metronome owns the touch */
