:root {
  --bg-deep: #080b11;
  --bg-panel: #101622;
  --bg-elevated: #172033;
  --border-subtle: rgba(120, 148, 196, 0.16);
  --border-strong: rgba(120, 148, 196, 0.34);

  --text-main: #f3f7ff;
  --text-muted: #93a4c3;
  --text-dim: #5e6f8e;

  --emerald: #10f5a8;
  --cyan: #00d4ff;
  --amber: #ffb020;
  --coral: #ff5666;

  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
}

body {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 25%, #121b2d 0%, var(--bg-deep) 74%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1020px;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  gap: 7px;
}

/* Top Control Bar */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(16, 22, 34, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 11px;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 0 0 2px rgba(94, 111, 142, 0.25);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.status-dot.live {
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
}

.status-dot.tone {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.brand-name {
  font-weight: 800;
  font-size: 0.94rem;
  letter-spacing: 0.08em;
}

.brand-accent {
  color: var(--emerald);
}

.pwa-badge {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: var(--emerald);
  background: rgba(16, 245, 168, 0.13);
  border: 1px solid rgba(16, 245, 168, 0.4);
  border-radius: 999px;
  padding: 2px 7px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex: 0 1 auto;
}

.select-wrap select,
.modal-body select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 26px 7px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 52%, calc(100% - 8px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.select-wrap select:focus,
.modal-body select:focus {
  outline: none;
  border-color: var(--cyan);
}

.a4-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.step-btn {
  background: transparent;
  border: none;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text-muted);
  cursor: pointer;
}

.step-btn:hover,
.step-btn:active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.a4-readout {
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  padding: 6px 9px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.a4-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.pill-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-main);
}

.pill-btn.active {
  background: rgba(16, 245, 168, 0.15);
  border-color: rgba(16, 245, 168, 0.58);
  color: var(--emerald);
}

.install-btn {
  background: rgba(0, 212, 255, 0.15);
  border-color: rgba(0, 212, 255, 0.5);
  color: var(--cyan);
}

.icon-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

/* PWA Awareness Banner */
.pwa-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(90deg, rgba(16, 245, 168, 0.12) 0%, rgba(0, 212, 255, 0.12) 100%);
  border: 1px solid rgba(0, 212, 255, 0.38);
  border-radius: var(--radius-md);
  padding: 7px 10px;
}

.pwa-banner-info {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.pwa-banner-icon {
  border-radius: 7px;
  flex-shrink: 0;
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pwa-banner-text strong {
  font-size: 0.82rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-banner-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pwa-banner-btn {
  background: var(--emerald);
  color: #06140f;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.pwa-banner-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 6px;
  font-size: 0.88rem;
  cursor: pointer;
}

/* Main Gauge Stage */
.gauge-stage {
  position: relative;
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  min-height: 150px;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at 50% 42%, rgba(22, 34, 58, 0.76) 0%, rgba(9, 13, 21, 0.95) 80%);
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 36px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gauge-stage.strum-mode-active {
  border-color: rgba(255, 176, 32, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 176, 32, 0.14), 0 14px 36px rgba(0, 0, 0, 0.5), 0 0 22px rgba(255, 176, 32, 0.14);
}

/* Clearly Marked Strum Mode Active Banner */
.strum-active-banner {
  position: absolute;
  top: 9px;
  left: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  background: rgba(24, 20, 14, 0.92);
  border: 1.5px solid rgba(255, 176, 32, 0.72);
  border-radius: 11px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(10px);
}

.strum-banner-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffe3aa;
  min-width: 0;
}

.strum-banner-badge strong {
  color: var(--amber);
  font-weight: 900;
}

.strum-live-dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  animation: strumPulse 1.4s ease-in-out infinite;
}

@keyframes strumPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.52;
    transform: scale(0.84);
  }
}

.strum-exit-btn {
  flex-shrink: 0;
  background: var(--amber);
  color: #191003;
  border: none;
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 0.77rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.14s ease, transform 0.1s ease;
}

.strum-exit-btn:hover {
  filter: brightness(1.08);
}

.strum-exit-btn:active {
  transform: scale(0.97);
}

/* Non-Default Calibration / Sweetened Active Chips & Main-Screen Capo Quick-Picker */
.calib-chips {
  position: absolute;
  top: 9px;
  left: 10px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  pointer-events: none;
}

.gauge-stage.strum-mode-active .calib-chips {
  top: 52px;
}

.capo-quick-wrap {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.gauge-stage.strum-mode-active .capo-quick-wrap {
  top: 52px;
}

.capo-quick-bar {
  display: inline-flex;
  align-items: stretch;
  background: rgba(16, 23, 38, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.capo-quick-wrap.active .capo-quick-bar {
  border-color: rgba(255, 176, 32, 0.72);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42), 0 0 12px rgba(255, 176, 32, 0.18);
}

.capo-quick-btn {
  background: transparent;
  border: none;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.capo-quick-btn:hover {
  color: var(--text-main);
}

.capo-quick-wrap.active .capo-quick-btn {
  color: #ffd074;
}

.capo-quick-clear {
  background: rgba(255, 176, 32, 0.18);
  border: none;
  border-left: 1px solid rgba(255, 176, 32, 0.42);
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 900;
  color: #ffd074;
  cursor: pointer;
}

.capo-quick-clear:hover {
  background: rgba(255, 176, 32, 0.32);
}

.capo-popover {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  background: rgba(14, 20, 33, 0.97);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.58);
  max-width: calc(100vw - 36px);
  overflow-x: auto;
}

.capo-fret-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 5px 8px;
  min-width: 28px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}

.capo-fret-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.capo-fret-btn.active {
  background: rgba(255, 176, 32, 0.22);
  border-color: var(--amber);
  color: #ffd074;
}

.calib-chip {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 23, 38, 0.9);
  border: 1px solid rgba(0, 212, 255, 0.55);
  color: var(--cyan);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.calib-chip.amber {
  border-color: rgba(255, 176, 32, 0.65);
  color: #ffd074;
}

.calib-chip.emerald {
  border-color: rgba(16, 245, 168, 0.55);
  color: var(--emerald);
}

.calib-chip:hover {
  filter: brightness(1.15);
}

#tunerCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Start Overlay */
.start-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(9, 12, 18, 0.62) 0%, rgba(9, 12, 18, 0.86) 100%);
  backdrop-filter: blur(4px);
  z-index: 5;
}

.start-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  background: rgba(19, 27, 44, 0.94);
  border: 1.5px solid rgba(16, 245, 168, 0.5);
  border-radius: 22px;
  padding: 26px 34px;
  cursor: pointer;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.58), 0 0 30px rgba(16, 245, 168, 0.16);
  max-width: 88%;
  text-align: center;
}

.mic-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(16, 245, 168, 0.15);
  color: var(--emerald);
  box-shadow: 0 0 0 7px rgba(16, 245, 168, 0.07);
}

.start-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.start-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* String Selector Strip */
.strings-panel {
  flex: 0 0 auto;
  background: rgba(16, 22, 34, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 9px;
}

.strings-row {
  display: flex;
  align-items: stretch;
  justify-content: safe center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.strings-row::-webkit-scrollbar {
  display: none;
}

.string-pill {
  position: relative;
  flex: 1 1 0;
  min-width: 38px;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 3px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.string-pill.auto-pill {
  flex: 0 0 auto;
  min-width: 46px;
  padding: 7px 6px;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.string-pill.auto-pill.selected {
  background: rgba(0, 212, 255, 0.15);
  border-color: rgba(0, 212, 255, 0.6);
  color: var(--cyan);
}

.string-pill.active-detected {
  border-color: var(--cyan);
  background: rgba(0, 212, 255, 0.13);
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.18);
}

.string-pill.locked {
  border-color: var(--amber);
  background: rgba(255, 176, 32, 0.14);
}

.string-pill.in-tune-now {
  border-color: var(--emerald);
  background: rgba(16, 245, 168, 0.18);
  box-shadow: 0 0 16px rgba(16, 245, 168, 0.25);
}

.str-num {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

.str-note {
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.1;
}

.str-hz {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.tuned-check {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--emerald);
  color: #041810;
  font-size: 0.6rem;
  font-weight: 900;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 0 8px rgba(16, 245, 168, 0.6);
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.string-pill.tuned .tuned-check {
  opacity: 1;
  transform: scale(1);
}

.string-pill.clear-tuned-pill {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 6px 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  border-style: dashed;
}

.string-pill.clear-tuned-pill.all-done {
  border-style: solid;
  border-color: rgba(16, 245, 168, 0.65);
  background: rgba(16, 245, 168, 0.15);
  color: var(--emerald);
}

.chromatic-hint {
  padding: 8px 12px;
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
}

/* Bottom Bar */
.bottombar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 8px;
  background: rgba(16, 22, 34, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 11px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.action-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.action-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.primary-toggle.active {
  background: rgba(16, 245, 168, 0.15);
  border-color: rgba(16, 245, 168, 0.6);
  color: var(--emerald);
}

.rec-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-dim);
}

.primary-toggle.active .rec-led {
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.strum-toggle {
  color: var(--text-main);
}

.strum-toggle.active {
  background: rgba(255, 176, 32, 0.2);
  border-color: var(--amber);
  color: #ffd074;
  box-shadow: 0 0 14px rgba(255, 176, 32, 0.22);
}

.tone-toggle.active {
  background: rgba(0, 212, 255, 0.16);
  border-color: rgba(0, 212, 255, 0.62);
  color: var(--cyan);
}

.meter-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 80px;
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.meter-track {
  position: relative;
  height: 8px;
  background: #0b0f18;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1b6ca8 0%, var(--cyan) 55%, var(--emerald) 100%);
  transition: width 0.08s linear;
}

.meter-gate-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--amber);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 40;
}

.modal-card {
  width: 100%;
  max-width: 450px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.68);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
}

.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mono-val {
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}

.field-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--emerald);
  cursor: pointer;
}

.seg-group {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.seg-btn {
  background: transparent;
  border: none;
  padding: 6px 11px;
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.seg-btn.active {
  background: rgba(0, 212, 255, 0.18);
  color: var(--cyan);
}

.diagnostics-row {
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.74rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* PWA Modal Content */
.pwa-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.pwa-hero-icon {
  border-radius: 12px;
  flex-shrink: 0;
}

.pwa-hero-title {
  font-size: 0.98rem;
  font-weight: 800;
}

.pwa-sw-status {
  font-size: 0.78rem;
  color: var(--emerald);
  margin-top: 3px;
  font-weight: 600;
}

.pwa-native-btn {
  width: 100%;
  padding: 13px 16px;
  background: var(--emerald);
  color: #05140e;
  border: none;
  border-radius: 11px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.pwa-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-step {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: rgba(23, 32, 51, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 0.86rem;
  line-height: 1.4;
}

.pwa-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 212, 255, 0.18);
  color: var(--cyan);
  font-weight: 800;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-btn {
  border-color: rgba(0, 212, 255, 0.35);
  color: var(--cyan);
}

.help-btn:hover {
  border-color: var(--cyan);
  color: #7ee8ff;
}

.help-modal-card {
  max-width: 520px;
}

.help-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 16px 0;
}

.help-tab-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.help-tab-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.help-tab-btn.active {
  background: rgba(0, 212, 255, 0.16);
  border-color: rgba(0, 212, 255, 0.6);
  color: var(--cyan);
}

.help-body {
  gap: 11px;
}

.help-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(23, 32, 51, 0.68);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 11px 13px;
}

.help-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
}

.help-item p {
  margin: 0;
  font-size: 0.81rem;
  line-height: 1.48;
  color: var(--text-muted);
}

.help-item p strong {
  color: var(--text-main);
}

.help-item code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.1);
  padding: 1px 5px;
  border-radius: 5px;
}

.help-pill {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
}

.help-pill.emerald {
  background: rgba(16, 245, 168, 0.16);
  border: 1px solid rgba(16, 245, 168, 0.45);
  color: var(--emerald);
}

.help-pill.amber {
  background: rgba(255, 176, 32, 0.16);
  border: 1px solid rgba(255, 176, 32, 0.48);
  color: var(--amber);
}

.help-pill.cyan {
  background: rgba(0, 212, 255, 0.16);
  border: 1px solid rgba(0, 212, 255, 0.48);
  color: var(--cyan);
}

.help-pill.coral {
  background: rgba(255, 86, 102, 0.16);
  border: 1px solid rgba(255, 86, 102, 0.48);
  color: var(--coral);
}

.help-action-btn {
  margin-top: 4px;
  align-self: flex-start;
  background: rgba(255, 176, 32, 0.16);
  border: 1px solid rgba(255, 176, 32, 0.55);
  color: #ffd074;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.79rem;
  font-weight: 800;
  cursor: pointer;
}

.help-action-btn:hover {
  background: rgba(255, 176, 32, 0.25);
  border-color: var(--amber);
}

.refresh-btn {
  border-color: rgba(255, 176, 32, 0.35);
  color: var(--amber);
}

.refresh-btn:hover {
  border-color: var(--amber);
  color: #ffd074;
}

@keyframes spin360 {
  to {
    transform: rotate(360deg);
  }
}

.refresh-btn.spinning svg {
  animation: spin360 0.6s linear infinite;
}

/* Responsive & Standalone PWA Optimizations */
@media (max-width: 780px) {
  .desktop-only {
    display: none;
  }
}

@media (max-width: 560px) {
  .app-shell {
    gap: 6px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .topbar {
    gap: 5px;
    padding: 6px 8px;
  }

  .topbar-controls {
    gap: 5px;
  }

  .brand-name {
    font-size: 0.82rem;
  }

  .pwa-badge {
    padding: 2px 5px;
    font-size: 0.58rem;
  }

  .select-wrap {
    flex: 1 1 84px;
    max-width: 142px;
  }

  .select-wrap select {
    width: 100%;
    max-width: 142px;
    padding: 6px 20px 6px 7px;
    font-size: 0.77rem;
  }

  .install-btn {
    padding: 6px 8px;
    font-size: 0.75rem;
  }

  .icon-btn {
    width: 33px;
    height: 33px;
  }
}

@media (max-width: 430px) {
  .install-btn-label {
    display: none;
  }

  .install-btn {
    padding: 7px 8px;
  }
}

@media (max-width: 560px) {

  /* Two-row zero-crop bottom bar on phones & compact PWA windows:
     Row 1: slim full-width signal meter
     Row 2: 3 equal-width buttons [Start Mic] [Strum] [Tone] — never clipped! */
  .bottombar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 7px 8px;
  }

  .meter-box {
    grid-column: 1 / -1;
    grid-row: 1;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .meter-labels {
    flex: 0 0 auto;
    gap: 6px;
    font-size: 0.64rem;
    min-width: 74px;
  }

  .meter-track {
    flex: 1 1 auto;
    height: 7px;
  }

  .action-btn {
    min-width: 0;
    width: 100%;
    padding: 9px 6px;
    font-size: 0.8rem;
    gap: 5px;
  }

  .str-note {
    font-size: 1rem;
  }

  .str-hz {
    font-size: 0.62rem;
  }

  .strum-active-banner {
    padding: 5px 8px 5px 10px;
    flex-wrap: wrap;
  }

  .strum-banner-badge {
    font-size: 0.71rem;
  }

  .strum-exit-btn {
    padding: 5px 9px;
    font-size: 0.72rem;
  }
}
