@font-face {
  font-family: 'Open Sans';
  src: url('fonts/OpenSans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans';
  src: url('fonts/OpenSans-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes border-travel {
  to {
    --border-angle: 360deg;
  }
}

html {
  height: 100dvh;
  overflow: hidden;
}

:root {
  /* disc rOut=178, canvas=800 → scale factor 800/(178*2) ≈ 2.247 */
  --app-top-clearance: max(52px, calc(env(safe-area-inset-top, 0px) + 46px));
  --bottom-chrome-clearance: max(18px, env(safe-area-inset-bottom, 0px));
  --footer-controls-clearance: calc(max(10px, env(safe-area-inset-bottom, 0px)) + 10px);
  --tuner-bottom-controls-height: 190px;
  --tuner-vertical-reserved-space: calc(var(--app-top-clearance) + var(--tuner-bottom-controls-height) + var(--bottom-chrome-clearance));
  --strobe-size: clamp(120px, min(calc(100vw - 24px), calc(100dvh - var(--tuner-vertical-reserved-space)), 520px), 520px);
  --canvas-scale: 2.247;
}

@media (min-width: 600px) {
  :root {
    --strobe-size: clamp(120px, min(380px, calc(100dvh - var(--tuner-vertical-reserved-space))), 380px);
  }
}

body {
  background: #0a0a0a;
  color: #f0f0f0;
  font-family: 'Open Sans', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  padding: var(--app-top-clearance) 12px var(--bottom-chrome-clearance);
}

/* ── App loading spinner ─────────────────────── */
#app-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#app-loader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #4af;
  border-right-color: rgba(68, 170, 255, 0.3);
  animation: loader-spin 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  position: relative;
}

.loader-ring-inner {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: rgba(68, 170, 255, 0.5);
  border-left-color: rgba(68, 170, 255, 0.15);
  animation: loader-spin 0.6s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Inline loading spinner (reusable) ───────── */
.spinner-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 0;
}

.spinner-inline .spinner-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #4af;
  border-right-color: rgba(68, 170, 255, 0.3);
  animation: loader-spin 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  position: relative;
}

.spinner-inline .spinner-ring::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: rgba(68, 170, 255, 0.5);
  border-left-color: rgba(68, 170, 255, 0.15);
  animation: loader-spin 0.6s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

.spinner-inline .spinner-text {
  font-size: 0.72rem;
  color: #555;
  letter-spacing: 0.04em;
}

.button-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: currentColor;
  border-right-color: rgba(255, 255, 255, 0.35);
  animation: loader-spin 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  display: inline-block;
  position: relative;
}

.button-spinner::after {
  content: '';
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: currentColor;
  border-left-color: rgba(255, 255, 255, 0.25);
  animation: loader-spin 0.6s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

button.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#bg-canvas {
  display: none;
}

/* ── Strobe centered vertically ──────────────── */
#strobe-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  overflow: visible;
  transition: margin-right 0.25s cubic-bezier(0.19, 1, 0.22, 1), transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}


/* ── Bottom section pinned to bottom ─────────── */
#bottom-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 4px 0 var(--footer-controls-clearance);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  transition: margin-right 0.25s cubic-bezier(0.19, 1, 0.22, 1), transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

/* ── Strobe disc ─────────────────────────────── */
#strobe-container {
  position: relative;
  width: var(--strobe-size);
  height: var(--strobe-size);
  overflow: visible;
}

#canvas {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  width: calc(var(--strobe-size) * var(--canvas-scale));
  height: calc(var(--strobe-size) * var(--canvas-scale));
}

body:not(.mic-running) #canvas {
  animation: strobe-idle-rotate 5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes strobe-idle-rotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(-67deg);
  }
}

/* Logo floats centered over the hub — hidden until splash dismisses */
#logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26%;
  opacity: 0;
  pointer-events: none;
  filter: brightness(0) invert(1) drop-shadow(0 1px 2px rgba(0, 0, 0, 1)) drop-shadow(0 0 10px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 24px rgba(0, 0, 0, 0.6));
  transition: opacity 0.5s ease 0.3s;
}

#logo.visible {
  opacity: 0.9;
}

/* ── Panel: waveform + strings grouped ───────── */
#panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  width: var(--strobe-size);
}

#string-range-guide {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(255, 255, 255, 0.22);
  font-family: 'Open Sans', sans-serif;
  font-size: 9px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
}

.string-range-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ── Meter row: waveform full width ──────────── */
#meter-row {
  display: flex;
  width: 100%;
  overflow: hidden;
  max-height: 0;
  margin-bottom: -6px;
  opacity: 0;
  transition:
    max-height 0.25s ease-in-out,
    margin-bottom 0.25s ease-in-out,
    opacity 0.2s ease-in-out;
}

#meter-row.visible {
  max-height: 80px;
  margin-bottom: 0;
  opacity: 1;
}

#waveform {
  display: block;
  border-radius: 6px;
  background: #111;
  width: 100%;
  height: 64px;
  cursor: pointer;
  border: none;
}

/* ── String buttons ──────────────────────────── */
#strings {
  display: flex;
  gap: 8px;
}

.string-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.string-btn {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #aaa;
  font-family: 'Open Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  padding: 8px 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.btn-note-wrap {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}

.btn-note-core {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}

.btn-note-letter,
.btn-note-accidental {
  display: inline-block;
}

.btn-note-accidental {
  font-size: 0.7em;
  margin-left: 2px;
}

.btn-note-accidental.flat {
  margin-left: -3px;
}

.btn-note-oct {
  display: inline-block;
  margin-left: 2px;
  font-size: 0.5rem;
  font-weight: 400;
  color: #555;
  line-height: 1;
  transform: translateY(0.06em);
}

.string-btn:hover {
  border-color: #555;
  color: #fff;
}

.string-btn.active {
  border-color: #4af;
  color: #4af;
  background: #0d1f2d;
}

.string-btn.active .btn-note-oct {
  color: #4af;
  opacity: 0.6;
}

.btn-freq {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.5rem;
  font-weight: 400;
  color: #555;
  letter-spacing: 0.01em;
}

.string-btn.active .btn-freq {
  color: #4af;
  opacity: 0.6;
}

.btn-cents {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  min-height: 0.7em;
}

/* ── Play controls under each string ─────────── */
.play-controls {
  display: flex;
  gap: 3px;
  width: 100%;
}

.play-btn,
.repeat-btn {
  background: #141414;
  border: 1px solid #2a2a2a;
  color: #555;
  font-size: 0.9rem;
  flex: 1;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  line-height: 0;
  vertical-align: middle;
}

.play-btn:hover,
.repeat-btn:hover {
  border-color: #555;
  color: #aaa;
}

.play-btn.playing {
  border-color: #4af;
  color: #4af;
  background: #0d1f2d;
}

.repeat-btn {
  font-size: 0;
  position: relative;
}

.repeat-btn::after {
  content: '';
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: #555;
  border-right-color: #555;
  border-bottom-color: #555;
}

.repeat-btn:hover::after {
  border-top-color: #888;
  border-right-color: #888;
  border-bottom-color: #888;
}

.repeat-btn.active {
  border-color: #4af;
  background: #0d1f2d;
}

.repeat-btn.active::after {
  border-top-color: #4af;
  border-right-color: #4af;
  border-bottom-color: #4af;
  animation: drone-spin 0.9s linear infinite;
}

@keyframes drone-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Controls row: mic btn + auto toggle ──────── */
#controls-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: var(--strobe-size);
}

#mic-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

#start-btn,
#auto-row,
#low-noise-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  white-space: nowrap;
}

#start-btn,
#auto-toggle {
  position: relative;
  cursor: pointer;
}

#auto-toggle {
  width: 34px;
  height: 19px;
}

#auto-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: #2a2a2a;
  border-radius: 9px;
  transition: background 0.2s;
  border: 1px solid #333;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: #666;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

#auto-toggle input:checked+.toggle-track {
  background: #0d1f2d;
  border-color: #4af;
}

#auto-toggle input:checked+.toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: #4af;
}

#auto-label,
#low-noise-label,
#mic-label {
  color: #666;
  transition: color 0.2s;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#auto-label.on,
#low-noise-label.on,
#start-btn.recording #mic-label {
  color: #4af;
}

#auto-row:hover #auto-label {
  color: #fff;
}

#tuning-label {
  font-size: 0.72rem;
  color: #fff;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  user-select: none;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  line-height: 1.25;
  padding: 0 0 1px;
}

#start-btn {
  background: none;
  border: none;
  color: #666;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.65rem;
  padding: 0;
  letter-spacing: 0.04em;
  transition: color 0.15s;
  margin-top: 2px;
}


#start-btn:hover #mic-label {
  color: #fff;
}

#start-btn:focus {
  outline: none;
}

#start-btn.recording {
  color: #4af;
}

.mic-toggle-track {
  position: relative;
  width: 34px;
  height: 19px;
  background: #2a2a2a;
  border-radius: 9px;
  transition: background 0.2s;
  border: 1px solid #333;
}

.mic-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: #666;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

#start-btn.recording .mic-toggle-track {
  background: #0d1f2d;
  border-color: #4af;
}

#start-btn.recording .mic-toggle-thumb {
  transform: translateX(16px);
  background: #4af;
}

#status {
  font-size: 0.7rem;
  color: #333;
  min-height: 1em;
}

/* ── Fullscreen + visualizer buttons ──────────── */
#fullscreen-btn,
#viz-btn {
  position: fixed;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: max(10px, env(safe-area-inset-left));
  background: #1a1a1a;
  border: 1px solid #333;
  color: #666;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  z-index: 150;
}

#viz-btn {
  left: calc(max(10px, env(safe-area-inset-left)) + 46px);
  width: auto;
  min-width: 106px;
  padding: 0 11px;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

#fullscreen-btn:hover {
  border-color: #555;
  color: #fff;
}

#fullscreen-btn.active {
  border-color: #4af;
  color: #4af;
}

#viz-btn:hover {
  border-color: #4af;
  color: #fff;
}

#viz-btn.active {
  border-color: #4af;
  color: #4af;
}

.ios-app #viz-btn {
  left: max(10px, env(safe-area-inset-left));
}

/* ── Live visualizer overlay ──────────────────── */
#viz-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(68, 170, 255, 0.16), transparent 35%),
    radial-gradient(circle at 70% 25%, rgba(200, 168, 106, 0.14), transparent 24%),
    #020205;
}

#viz-overlay.active {
  display: block;
}

#viz-overlay::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(58px + max(0px, env(safe-area-inset-bottom)));
  z-index: 1;
  pointer-events: none;
  background: rgba(5, 12, 20, 0.65);
  border-top: 1px solid rgba(68, 170, 255, 0.08);
  opacity: 1;
  transition: opacity 0.3s ease;
}

#viz-overlay::before {
  content: '';
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(0px, env(safe-area-inset-bottom)) + 18px);
  width: min(118px, 20.8vw);
  height: 18px;
  z-index: 2;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.2);
  -webkit-mask: url('lumitune-color.svg') center / contain no-repeat;
  mask: url('lumitune-color.svg') center / contain no-repeat;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#viz-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.viz-chrome {
  position: absolute;
  z-index: 2;
  pointer-events: auto;
}

.viz-logo {
  position: absolute;
  z-index: 2;
  top: var(--viz-logo-top, 50%);
  left: var(--viz-logo-left, 50%);
  transform: translate(-50%, -50%);
  width: var(--viz-logo-width, calc(var(--strobe-size) * 0.26));
  max-width: 26vw;
  opacity: 0.3;
  filter: brightness(0) invert(1) drop-shadow(0 1px 2px rgba(0, 0, 0, 1)) drop-shadow(0 0 10px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 24px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

.viz-close-btn {
  left: calc(max(10px, env(safe-area-inset-left)) + 46px);
  bottom: max(10px, env(safe-area-inset-bottom));
  width: 142px;
  background: rgba(5, 12, 20, 0.68);
  border: 1px solid rgba(68, 170, 255, 0.26);
  color: rgba(210, 235, 255, 0.86);
  border-radius: 6px;
  height: 36px;
  padding: 0 12px;
  cursor: pointer;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.viz-close-btn:hover {
  border-color: #4af;
  color: #fff;
  background: rgba(20, 50, 78, 0.72);
}

.viz-controls {
  left: 50%;
  bottom: calc(max(0px, env(safe-area-inset-bottom)) + 38px);
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: calc(100vw - 28px);
}

.viz-mode-bar {
  display: flex;
  gap: 6px;
  padding: 7px;
  overflow-x: auto;
  border: 1px solid rgba(68, 170, 255, 0.20);
  border-radius: 999px;
  background: rgba(5, 12, 20, 0.68);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.viz-mode-btn,
.viz-settings-toggle {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(210, 235, 255, 0.62);
  cursor: pointer;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  padding: 8px 12px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.viz-mode-btn:hover,
.viz-settings-toggle:hover {
  color: #fff;
}

.viz-mode-btn.active,
.viz-settings-toggle.active {
  color: #04111d;
  background: linear-gradient(135deg, #8fd6ff, #4af);
  border-color: rgba(255, 255, 255, 0.28);
}

.viz-settings-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-color: rgba(68, 170, 255, 0.20);
  background: rgba(5, 12, 20, 0.68);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.viz-settings {
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(max(0px, env(safe-area-inset-bottom)) + 104px);
  display: none;
  gap: 9px;
  width: min(300px, calc(100vw - 28px));
  padding: 12px;
  border: none;
  border-radius: 6px;
  background: rgba(4, 14, 26, 0.78);
  box-shadow: inset 0 1px 0 rgba(89, 203, 255, 0.14), 0 18px 44px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.viz-settings.open {
  display: grid;
}

.viz-settings-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: rgba(190, 232, 255, 0.72);
  font-family: 'Open Sans', sans-serif;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.viz-settings-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viz-settings-reset,
.viz-settings-close {
  border: none;
  background: transparent;
  color: rgba(112, 211, 255, 0.82);
  cursor: pointer;
  font: inherit;
  font-size: 0.6rem;
}

.viz-settings-reset {
  padding: 4px 6px;
}

.viz-settings-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: rgba(170, 230, 255, 0.86);
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}

.viz-settings-reset:hover,
.viz-settings-close:hover {
  color: #fff;
}

.viz-setting-row {
  display: grid;
  grid-template-columns: 78px 1fr 34px;
  align-items: center;
  gap: 9px;
  color: rgba(220, 240, 255, 0.74);
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
}

.viz-setting-row input[type="range"] {
  width: 100%;
  height: 16px;
  accent-color: #27c9ff;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.viz-setting-row input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border: none;
  border-radius: 999px;
  background: rgba(118, 216, 255, 0.38);
}

.viz-setting-row input[type="range"]::-webkit-slider-thumb {
  margin-top: -6px;
  background: #27c9ff;
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(39, 201, 255, 0.45);
  -webkit-appearance: none;
  appearance: none;
}

.viz-setting-row input[type="range"]::-moz-range-track {
  height: 2px;
  border: none;
  border-radius: 999px;
  background: rgba(118, 216, 255, 0.38);
}

.viz-setting-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #27c9ff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(39, 201, 255, 0.45);
}

.viz-setting-value {
  color: rgba(210, 235, 255, 0.46);
  font-family: 'Open Sans', sans-serif;
  font-size: 0.68rem;
  text-align: right;
}

body.viz-mode #top-bar,
body.viz-mode #bottom-section,
body.viz-mode #strobe-wrap,
body.viz-mode #viz-btn {
  pointer-events: none;
}

body.viz-mode #fullscreen-btn {
  z-index: 950;
  pointer-events: auto;
  background: rgba(5, 12, 20, 0.68);
  border-color: rgba(68, 170, 255, 0.26);
  color: rgba(210, 235, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.viz-mode #fullscreen-btn:hover {
  border-color: #4af;
  color: #fff;
  background: rgba(20, 50, 78, 0.72);
}

body.viz-mode #fullscreen-btn.active {
  border-color: #4af;
  color: #4af;
}

body.viz-mode #fullscreen-btn,
body.viz-mode #build-info,
body.viz-mode .viz-close-btn,
body.viz-mode .viz-controls {
  opacity: 1;
  transition-duration: 0.3s;
}

@media (max-width: 520px) {
  .viz-settings {
    left: 14px;
    right: 14px;
    bottom: calc(max(0px, env(safe-area-inset-bottom)) + 102px);
    width: auto;
  }

  .viz-controls {
    align-items: stretch;
    width: calc(100vw - 28px);
  }
}

/* ── Fullscreen body state ────────────────────── */
body.is-fullscreen {
  justify-content: center;
  padding-top: 0;
}

/* ── Top bar ──────────────────────────────────── */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
  padding-top: max(6px, env(safe-area-inset-top));
  z-index: 200;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Header logo (web only) ───────────────────── */
#header-logo {
  --header-logo-green: #4f8;
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 22px;
  width: auto;
  opacity: 0.9;
  padding: 0 4px 0 5px;
  pointer-events: auto;
  flex-shrink: 0;
  isolation: isolate;
  border-radius: 999px;
}

#header-logo img {
  display: block;
  height: 100%;
  width: auto;
}

.header-logo-base,
.header-logo-hover {
  transition:
    opacity 0.45s ease,
    filter 0.45s ease,
    transform 0.45s ease;
}

.header-logo-hover {
  position: absolute;
  inset: 0 4px 0 5px;
  opacity: 0;
  filter: saturate(1);
}

#header-logo:hover .header-logo-base,
#header-logo:focus-visible .header-logo-base {
  opacity: 0.16;
  filter: blur(0.3px) saturate(0.9);
  transform: scale(0.985);
}

#header-logo:hover .header-logo-hover,
#header-logo:focus-visible .header-logo-hover {
  opacity: 1;
  filter: saturate(1.08);
  transform: scale(1.02);
  animation: headerLogoCharge 520ms cubic-bezier(.16, 1, .3, 1);
}

.ios-app #header-logo {
  display: none;
}

@keyframes headerLogoCharge {
  0% {
    opacity: 0;
    transform: scale(0.96);
    filter: saturate(0.95);
  }
  55% {
    opacity: 1;
    transform: scale(1.035);
    filter: saturate(1.14);
  }
  100% {
    opacity: 1;
    transform: scale(1.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-logo-base,
  .header-logo-hover {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Hamburger menu button ────────────────────── */
/* ── User account button ──────────────────────── */
#user-btn {
  background: transparent;
  border: none;
  color: #888;
  height: auto;
  border-radius: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.6s ease;
  padding: 0;
  position: relative;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 160px;
  gap: 7px;
}

#user-btn:hover {
  color: #fff;
  transition-duration: 0.2s;
}

body:not(.luthier-mode) #user-btn.signed-in:hover {
  color: #fff;
}

#user-btn:focus-visible {
  outline: none;
  color: #fff;
  transition-duration: 0.2s;
}

body:not(.luthier-mode) #user-btn.signed-in:focus-visible {
  color: #fff;
}

#user-btn.signed-in {
  color: #c8a86a;
}

body:not(.luthier-mode) #user-btn.signed-in {
  color: #888;
}

#user-btn .user-btn-signedout {
  display: block;
  text-transform: uppercase;
}

#user-btn .user-btn-email {
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

#user-btn .user-btn-tier {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 16px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.44rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  box-sizing: border-box;
}

#user-btn .user-btn-tier.tier-free,
#user-btn .user-btn-tier.tier-core {
  color: #c9c9c9;
  border-color: rgba(210, 210, 210, 0.2);
  background: rgba(210, 210, 210, 0.08);
}

#user-btn .user-btn-tier.tier-pro {
  color: #d7dbe2;
  border-color: rgba(215, 219, 226, 0.28);
  background: rgba(215, 219, 226, 0.12);
}

#user-btn .user-btn-tier.tier-luthier {
  color: #c8a86a;
}

#user-btn.signed-in .user-btn-signedout {
  display: none;
}

#user-btn.signed-in .user-btn-email {
  display: block;
}

#user-btn.signed-in .user-btn-tier {
  display: inline-flex;
}

body:not(.luthier-mode):not(.user-signed-in) #user-dropdown {
  display: none !important;
}

#user-account-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.topbar-separator {
  color: #fff;
  font-size: 0.68rem;
  opacity: 0.25;
  user-select: none;
}

@media (max-width: 699px) {
  .topbar-separator {
    display: none;
  }
}

#user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  min-width: 228px;
  padding: 6px;
  z-index: 200;
  flex-direction: column;
  gap: 2px;
}

#user-dropdown.open {
  display: flex;
}

.user-dd-email {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  color: #666;
  padding: 6px 8px 8px;
  border-bottom: 1px solid #2a2a2a;
  margin-bottom: 4px;
  word-break: break-all;
}

.user-dd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 8px 6px;
}

.user-dd-tier-label {
  color: #666;
  font-size: 0.72rem;
}

.user-dd-tier {
  font-size: 0.74rem;
  font-weight: 600;
}

.user-dd-tier.tier-free,
.user-dd-tier.tier-core {
  color: #c9c9c9;
}

.user-dd-tier.tier-pro {
  color: #d7dbe2;
}

.user-dd-tier.tier-luthier {
  color: #c8a86a;
}

.user-dev-tier-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 4px;
  padding: 6px 8px 8px;
  border-top: 1px solid #2a2a2a;
  border-bottom: 1px solid #2a2a2a;
}

.user-dev-tier-label {
  color: #666;
  font-size: 0.72rem;
}

.user-dev-tier-select {
  min-width: 96px;
  background: #101010;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #ddd;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.74rem;
  padding: 6px 8px;
}

.user-dev-tier-select:focus {
  outline: none;
  border-color: #4af;
}

.user-dd-item {
  background: none;
  border: none;
  color: #ccc;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  padding: 8px 8px;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.user-dd-item:hover {
  background: #2a2a2a;
  color: #fff;
}

.luth-auth-logo {
  height: 32.4px;
  width: auto;
  align-self: center;
}

.luth-auth-copy {
  margin: -4px 0 2px;
  color: #aaa;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  line-height: 1.45;
  opacity: 0.75;
  text-align: center;
}

#menu-btn {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #666;
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
  pointer-events: auto;
}

#menu-btn:hover {
  border-color: #555;
  color: #fff;
}

#menu-btn.active {
  border-color: #4af;
  color: #4af;
}

/* ── Hamburger ↔ X animation ─────────────────── */
.menu-icon .bar {
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-box: fill-box;
  transform-origin: center;
}

#menu-btn.active .bar1,
#menu-close-btn .bar1 {
  transform: translateY(5px) rotate(45deg);
}

#menu-btn.active .bar2,
#menu-close-btn .bar2 {
  opacity: 0;
  transform: scaleX(0);
}

#menu-btn.active .bar3,
#menu-close-btn .bar3 {
  transform: translateY(-5px) rotate(-45deg);
}

/* ── Menu panel ───────────────────────────────── */
#menu-panel {
  position: fixed;
  top: 52px;
  right: 12px;
  background: rgba(18, 18, 18, 0.70);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 0;
  z-index: 200;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateX(36px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
}

#menu-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.menu-section {
  padding: 8px 18px;
}

.menu-section-title {
  font-size: 0.65rem;
  color: #fff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── Accordion sections ────────────────────────────────────────────────── */
.acc-section {
  border-bottom: 1px solid #1e1e1e;
  opacity: 0.45;
  transition: opacity 0.2s;
}

.acc-section:first-child {
  border-top: 1px solid #1e1e1e;
}

.acc-section.open {
  opacity: 1;
}

.acc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  outline: none;
  padding: 12px 18px;
  cursor: pointer;
  color: inherit;
  text-align: left;
}

.acc-header .menu-section-title {
  margin: 0;
}

.acc-arrow {
  color: #666;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.38s cubic-bezier(0.34, 1.36, 0.64, 1);
}

.acc-body {
  overflow: hidden;
  height: 0;
  transition: height 0.38s cubic-bezier(0.34, 1.36, 0.64, 1);
}

.acc-content {
  padding: 0 18px 14px;
  opacity: 0;
  transition: opacity 0.22s ease-out;
}

.section-info {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.42);
  line-height: 1.5;
  padding: 5px 0 7px;
}

.preset-desc {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.5;
  padding: 6px 0 2px;
  margin-left: 10px;
}

/* ── Tuning mode label above strings ──────────────────────────────────── */
#tuning-mode-label {
  font-size: 0.62rem;
  color: #fff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 1px 0 5px;
  opacity: 0.75;
}

.tuning-mode-switch {
  margin-bottom: 10px;
}

.tuning-mode-panel {
  display: none;
}

.tuning-mode-panel.active {
  display: block;
}

.menu-divider {
  border-top: 1px solid #252525;
  margin: 4px 0;
}

.menu-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.menu-chip {
  background: #111;
  border: 1px solid #2a2a2a;
  color: #888;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.menu-chip:hover {
  border-color: #555;
  color: #aaa;
}

.menu-chip.active {
  border-color: #4af;
  color: #4af;
  background: #0d1f2d;
}

.menu-chip.locked {
  color: #888;
  background: #111;
  border-color: #2a2a2a;
}

.menu-chip.locked:hover {
  border-color: #555;
  color: #aaa;
}

.chip-tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  min-height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(215, 219, 226, 0.28);
  background: rgba(215, 219, 226, 0.12);
  color: #d7dbe2;
  font-size: 0.44rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  vertical-align: middle;
  box-sizing: border-box;
  flex-shrink: 0;
}

.menu-chip.active .chip-tier-badge,
.menu-chip:hover .chip-tier-badge {
  border-color: rgba(215, 219, 226, 0.28);
  background: rgba(215, 219, 226, 0.12);
  color: #d7dbe2;
}

body.hide-owned-pro-tags .chip-tier-badge {
  display: none;
}

body.hide-owned-luthier-tags .luth-badge {
  display: none;
}

/* Custom tuning chip — flex row containing name + edit + delete icons */
.menu-chip--custom {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip-name {
  color: #888;
}

.menu-chip.locked .chip-name,
.menu-chip.locked .chip-lock {
  color: #888;
}

.chip-edit-btn {
  color: #555;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
}

.chip-edit-btn:hover {
  color: #4af;
}

.chip-delete-btn {
  color: #555;
  font-size: 0.8rem;
  line-height: 1;
  transition: color 0.15s;
}

.chip-delete-btn:hover {
  color: #f64;
}

/* + Custom chip */
.menu-chip.chip-add {
  border-style: dashed;
  color: #444;
}

.menu-chip.chip-add:hover {
  border-color: #4af;
  color: #4af;
}

/* ── Custom tuning form ───────────────────────────────────────── */
#custom-tuning-form {
  margin-top: 10px;
  padding: 10px;
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
}

#custom-tuning-name {
  width: 100%;
  box-sizing: border-box;
  background: #111;
  border: 1px solid #333;
  border-radius: 4px;
  color: #ccc;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  padding: 6px 8px;
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.15s;
}

#custom-tuning-name:focus {
  border-color: #4af;
}

.custom-string-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.csr-fields {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
}

.csr-cents-btn {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #fff;
  font-size: 0.5rem;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 26px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: all 0.12s;
}

.csr-cents-btn:hover {
  border-color: #4af;
  color: #4af;
}

.csr-cents-btn:active {
  background: #0d1f2d;
}

.ios-app .csr-cents-btn {
  width: 28px;
  height: 36px;
  font-size: 0.65rem;
}

.csr-freq-wrap {
  display: inline-flex;
  align-items: center;
  background: #111;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0 6px 0 0;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.csr-freq-wrap:focus-within {
  border-color: #4af;
}

.csr-freq-wrap.invalid {
  border-color: #f64;
}

.csr-freq {
  width: 56px;
  background: transparent;
  border: none;
  color: #ccc;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  padding: 4px 4px 4px 6px;
  outline: none;
  box-sizing: border-box;
  -moz-appearance: textfield;
}

.csr-freq::-webkit-inner-spin-button,
.csr-freq::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.csr-unit {
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.62rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.csr-note-label {
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  min-width: 58px;
  flex-shrink: 0;
  transition: color 0.2s;
  cursor: pointer;
  user-select: none;
}

.csr-note-label:hover {
  color: #fff !important;
}

.csr-spark {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.csr-spark-end {
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
  font-family: 'Open Sans', sans-serif;
  flex-shrink: 0;
}

.csr-spark-track {
  flex: 1;
  position: relative;
  height: 14px;
  min-width: 30px;
}

.csr-spark-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: #2a2a2a;
  transform: translateY(-50%);
}

.csr-spark-track::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 6px;
  background: #3a3a3a;
  transform: translate(-50%, -50%);
}

.csr-spark-marker {
  position: absolute;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #333;
  transform: translate(-50%, -50%);
  transition: left 0.12s ease-out, background 0.2s;
  z-index: 1;
  left: 50%;
}

.csr-remove {
  background: none;
  border: none;
  color: #555;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}

.csr-remove:hover {
  color: #f64;
}

#custom-add-string {
  background: none;
  border: 1px dashed #2a2a2a;
  color: #444;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  margin-top: 2px;
  transition: all 0.15s;
}

#custom-add-string:hover {
  border-color: #4af;
  color: #4af;
}

.custom-form-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
}

#custom-cancel-btn {
  background: none;
  border: 1px solid #2a2a2a;
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

#custom-cancel-btn:hover {
  border-color: #555;
  color: #aaa;
}

#custom-save-btn {
  background: #0d1f2d;
  border: 1px solid #4af;
  color: #4af;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

#custom-save-btn:hover {
  background: #1a3a55;
}

.menu-about p {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  color: #aaa;
  margin-bottom: 6px;
  line-height: 1.55;
}

.menu-about p:last-child {
  margin-bottom: 0;
}

.contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  margin-top: 14px;
  background: #181818;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #4af;
  text-decoration: none;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  box-sizing: border-box;
}

.contact-btn:hover {
  background: #202020;
  border-color: #4af;
}

/* ── Help section ──────────────────────────────────────────────────────── */
.help-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.help-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-discs {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 4px 0;
}

.help-disc-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.help-disc-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.help-disc-label.flat {
  color: #e05555;
}

.help-disc-label.sharp {
  color: #e05555;
}

.help-disc-label.intune {
  color: #5be055;
}

.help-text {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
}

.help-rule {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 7px;
}

.help-rule-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.help-rule-sub {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.45;
}

.about-luthier-block {
  border-left: 2px solid rgba(200, 168, 106, 0.4);
  padding-left: 10px;
  color: #c8a86a !important;
}

.about-luthier-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #c8a86a;
  background: rgba(200, 168, 106, 0.1);
  border: 1px solid rgba(200, 168, 106, 0.3);
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 5px;
  vertical-align: middle;
}

.menu-copyright {
  text-align: center;
  color: #444 !important;
  font-size: 0.68rem !important;
  margin-top: 14px !important;
}

.menu-logo {
  display: block;
  width: clamp(80px, 50%, 140px);
  margin: 12px auto 14px;
  opacity: 0.85;
}

/* ── Precision info ──────────────────────────── */
.info-btn {
  background: none;
  border: none;
  color: #777;
  cursor: pointer;
  padding: 0 0 0 3px;
  vertical-align: middle;
  transition: color 0.15s;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.info-btn:hover,
.info-btn.active {
  color: #4af;
}

.info-text {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.42);
  line-height: 1.5;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}

.info-text.visible {
  max-height: 120px;
  opacity: 1;
  padding: 5px 0 7px;
}

.detector-desc {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.42);
  line-height: 1.6;
  padding: 6px 0 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 6px;
}

.detector-desc strong {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.detector-desc-pro {
  color: rgba(100, 220, 100, 0.6);
}

.detector-desc-con {
  color: rgba(220, 160, 80, 0.6);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}

.settings-row+.settings-row {
  margin-top: 6px;
}

.settings-row-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.settings-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  color: #aaa;
  user-select: none;
  white-space: nowrap;
}

.settings-toggle {
  position: relative;
  width: 34px;
  height: 19px;
  cursor: pointer;
  flex-shrink: 0;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.settings-toggle input:checked+.toggle-track {
  background: #0d1f2d;
  border-color: #4af;
}

.settings-toggle input:checked+.toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: #4af;
}

/* ── Mode switch (wave / eq) ─────────────────── */
.mode-switch {
  display: flex;
  gap: 2px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 5px;
  padding: 2px;
}

.mode-switch-wrap {
  flex-wrap: wrap;
  width: 100%;
}

.mode-switch-wrap .mode-btn {
  flex: 1 1 calc(33.333% - 2px);
  min-width: 0;
  text-align: center;
}

.mode-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.05em;
}

.mode-btn.active {
  background: #1a1a1a;
  color: #4af;
  border: 1px solid #2a4a6a;
}

.mode-btn:not(.active):hover {
  color: #aaa;
}

/* ── A4 reference input ────────────────────────── */
.a4-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 5px;
  padding: 2px 4px;
}

.a4-step {
  background: transparent;
  border: none;
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  line-height: 1;
  padding: 2px 5px;
  cursor: pointer;
  transition: color 0.1s;
  user-select: none;
}

.a4-step:hover {
  color: #4af;
}

#a4-input {
  width: 36px;
  background: transparent;
  border: none;
  color: #4af;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  padding: 3px 0;
  text-align: right;
  -moz-appearance: textfield;
  letter-spacing: 0.05em;
}

#a4-input::-webkit-inner-spin-button,
#a4-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

#a4-input:focus {
  outline: none;
}

.a4-unit {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  color: #555;
  letter-spacing: 0.05em;
  padding-left: 2px;
  user-select: none;
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 400px) {
  .string-btn {
    padding: 8px 4px;
    font-size: 1.1rem;
  }

  .play-btn,
  .repeat-btn {
    height: 24px;
    font-size: 0.75rem;
  }

  #strings {
    gap: 5px;
  }
}

/* ── Build info (fixed bottom-left) ────────── */
#build-info {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: calc(max(10px, env(safe-area-inset-left)) + 46px + 143px + 10px);
  font-family: 'Open Sans', sans-serif;
  font-size: 0.65rem;
  color: #aaa;
  opacity: 0.5;
  pointer-events: none;
  z-index: 200;
  line-height: 36px;
  transition: transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

body.viz-mode #build-info {
  left: calc(max(10px, env(safe-area-inset-left)) + 46px + 142px + 10px);
  right: auto;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 950;
}

@media (max-width: 520px) {
  #build-info .build-ts { display: none; }
}


/* ── Touch-to-start overlay ─────────────────────────────────────────────── */
#touch-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: opacity 0.4s ease;
}

#touch-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes overlaySlideDown {
  from {
    opacity: 0;
    transform: translateY(-32px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes overlaySlideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logoGlowIn {
  0% {
    filter: drop-shadow(0 0 0px rgba(255, 0, 0, 0)) drop-shadow(0 0 0px rgba(255, 221, 0, 0));
  }

  100% {
    filter: drop-shadow(0 0 22px rgba(255, 200, 0, 0.85)) drop-shadow(0 0 60px rgba(255, 100, 0, 0.50)) drop-shadow(0 0 120px rgba(8, 215, 81, 0.28));
  }
}

@keyframes logoPulse {
  0% {
    filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.75)) drop-shadow(0 0 55px rgba(255, 80, 0, 0.45)) drop-shadow(0 0 110px rgba(8, 215, 81, 0.22));
    transform: scale(1);
  }

  33% {
    filter: drop-shadow(0 0 32px rgba(255, 200, 0, 0.90)) drop-shadow(0 0 75px rgba(255, 160, 0, 0.58)) drop-shadow(0 0 130px rgba(255, 80, 0, 0.30));
    transform: scale(1.018);
  }

  66% {
    filter: drop-shadow(0 0 28px rgba(8, 215, 81, 0.85)) drop-shadow(0 0 70px rgba(8, 215, 81, 0.52)) drop-shadow(0 0 120px rgba(255, 200, 0, 0.26));
    transform: scale(1.025);
  }

  100% {
    filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.75)) drop-shadow(0 0 55px rgba(255, 80, 0, 0.45)) drop-shadow(0 0 110px rgba(8, 215, 81, 0.22));
    transform: scale(1);
  }
}

#overlay-logo {
  width: clamp(200px, 55vw, 360px);
  height: auto;
  user-select: none;
  pointer-events: none;
  animation: overlaySlideDown 0.7s cubic-bezier(0.22, 1, 0.36, 1) both,
    logoGlowIn 1.2s ease-out 0.5s both,
    logoPulse 4s ease-in-out 1.7s infinite;
  position: relative;
  z-index: 1;
}

#overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

#overlay-subhead {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  margin: 0;
  user-select: none;
  position: relative;
  z-index: 1;
  animation: overlaySlideDown 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

#overlay-cta {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  padding: 12px 40px;
  cursor: pointer;
  user-select: none;
  margin-top: 80px;
  position: relative;
  z-index: 1;
  transition: border-color 0.2s, color 0.2s;
  animation: overlaySlideUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

#overlay-cta:hover {
  border-color: rgba(255, 255, 255, 0.7);
}

#overlay-cta:active {
  color: #4af;
  border-color: #4af;
}

#overlay-mic-note {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  margin: 12px 0 0;
  position: relative;
  z-index: 1;
  animation: overlaySlideUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}

/* ── Swipe note carousel ─────────────────────────────────────────────────── */
.note-slide {
  position: absolute;
  top: 50%;
  left: 50%;
  /* overridden by JS */
  transform: translate(-50%, -50%);
  width: calc(var(--strobe-size) * 0.72);
  height: calc(var(--strobe-size) * 0.72);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  will-change: transform, opacity;
}

.note-slide-name {
  font-family: 'Open Sans', sans-serif;
  font-weight: 700;
  font-size: calc(var(--strobe-size) * 0.26);
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 28px rgba(255, 255, 255, 0.4);
  user-select: none;
}

/* ── iOS App overrides ───────────────────────────────────────────────────
   All rules below are scoped to .ios-app (set on <html> by config.js when
   window.Capacitor is present). The web version is unaffected.
   ─────────────────────────────────────────────────────────────────────── */

/* Prevent horizontal scroll on iOS */
.ios-app,
.ios-app body {
  overflow-x: hidden;
}

.ios-app {
  --ios-font-family: "Open Sans", sans-serif;
}

.ios-app.ipad-app body {
  --ipad-menu-panel-width: min(456px, calc(100vw - 36px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  --ipad-luthier-panel-width: min(58vw, 560px);
  --ipad-side-occupied: 0px;
  --strobe-size: clamp(280px, min(calc((100vw - var(--ipad-side-occupied) - 56px) * 0.58), calc(100dvh - var(--tuner-vertical-reserved-space)), 560px), 560px);
}

.ios-app.ipad-app body.menu-open-ipad:not(.luthier-mode) {
  --ipad-side-occupied: var(--ipad-menu-panel-width);
}

.ios-app.ipad-app body.luthier-mode {
  --ipad-side-occupied: var(--ipad-luthier-panel-width);
}

.ios-app body,
.ios-app body *,
.ios-app button,
.ios-app input,
.ios-app select,
.ios-app textarea {
  font-family: var(--ios-font-family) !important;
}

.ios-app #top-bar {
  justify-content: flex-end;
}

.ios-app:not(.ipad-app) #top-bar {
  background: transparent;
  border-bottom: none;
}

.ios-app:not(.ipad-app) #acc-luthier,
.ios-app:not(.ipad-app) .topbar-separator {
  display: none !important;
}

.ios-app #top-bar-btns {
  gap: 12px;
}

.ios-app body.menu-open #user-account-wrap,
.ios-app body.menu-open .topbar-separator {
  opacity: 0.5;
  pointer-events: none;
}

.ios-app .topbar-separator {
  display: inline;
  font-size: 15px;
  margin: 0 2px;
}

/* Right-side menu panel to match the web app */
.ios-app #menu-panel {
  display: block;
  position: fixed;
  top: calc(max(6px, env(safe-area-inset-top)) + 46px);
  left: auto;
  right: max(10px, env(safe-area-inset-right));
  bottom: auto;
  width: min(340px, calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height: calc(100dvh - max(64px, calc(env(safe-area-inset-top) + 58px)) - env(safe-area-inset-bottom));
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: rgba(18, 18, 18, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateX(36px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
  z-index: 300;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ios-app #menu-panel.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Close button — shown on iOS when menu is open (display toggled by JS) */
#menu-close-row {
  display: none;
  position: fixed;
  top: max(6px, env(safe-area-inset-top));
  left: auto;
  right: max(10px, env(safe-area-inset-right));
  z-index: 400;
}

.ios-app #menu-close-btn {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #666;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  padding: 0;
}

.ios-app #menu-close-btn:active {
  border-color: #4af;
  color: #4af;
}

/* Larger section padding */
.ios-app .menu-section {
  padding: 12px 22px;
}

/* Larger fonts */
.ios-app #tuning-label {
  font-size: 17px;
  line-height: 1.35;
}

.ios-app #tuning-mode-label {
  font-size: 15px;
}

.ios-app .menu-section-title {
  font-size: 15px;
}

.ios-app .acc-header {
  padding-top: 14px;
  padding-bottom: 14px;
}

.ios-app .settings-label {
  font-size: 17px;
}

.ios-app .menu-about p {
  font-size: 17px;
}

.ios-app .section-info,
.ios-app .preset-desc {
  font-size: 16px;
  line-height: 1.55;
}

.ios-app .menu-chip {
  font-size: 17px;
}

.ios-app .mode-btn {
  font-size: 17px;
}

.ios-app #a4-input,
.ios-app .a4-unit {
  font-size: 17px;
}

/* Bigger hit targets */
.ios-app .menu-chip {
  padding: 10px 16px;
  border-radius: 8px;
}

.ios-app .mode-btn {
  padding: 8px 14px;
  border-radius: 6px;
}

.ios-app .settings-row {
  padding: 10px 0;
  gap: 16px;
}

.ios-app .settings-row+.settings-row {
  margin-top: 2px;
}

.ios-app .a4-step {
  font-size: 1.1rem;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ios-app .settings-toggle {
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.ios-app .settings-toggle .toggle-track {
  border-radius: 13px;
}

.ios-app .settings-toggle .toggle-thumb {
  width: 18px;
  height: 18px;
}

.ios-app .settings-toggle input:checked+.toggle-track .toggle-thumb {
  transform: translateX(20px);
}

/* Main tuner — iOS sizing */
.ios-app #string-range-guide {
  font-size: 15px;
}

.ios-app .string-btn {
  box-sizing: border-box;
  font-size: 2.15rem;
  min-height: 86px;
  padding: 11px 4px 9px;
}

.ios-app:not(.ipad-app) .string-btn {
  min-height: 108px;
  padding: 14px 8px 12px;
  justify-content: space-between;
}

.ios-app .btn-note-oct {
  font-size: 15px;
}

.ios-app .btn-freq {
  font-size: 15px;
}

.ios-app .btn-cents {
  font-size: 17px;
}

.ios-app #start-btn,
.ios-app #auto-row,
.ios-app #low-noise-row {
  font-size: 17px;
}

.ios-app .play-btn,
.ios-app .repeat-btn {
  height: 30px;
  font-size: 17px;
}

/* Custom tuning form — iOS sizing */
.ios-app #custom-tuning-name {
  font-size: 17px;
  padding: 9px 10px;
}

.ios-app .csr-freq {
  font-size: 17px;
  padding: 7px 6px 7px 8px;
  width: 70px;
}

.ios-app .csr-fields {
  gap: 6px;
}

.ios-app .csr-note-label {
  font-size: 17px;
  min-width: 72px;
}

.ios-app #custom-add-string {
  font-size: 17px;
  padding: 9px 12px;
}

.ios-app #custom-save-btn,
.ios-app #custom-cancel-btn {
  font-size: 17px;
  padding: 8px 18px;
}

.ios-app #build-info {
  font-size: 15px;
}

.ios-app:not(.ipad-app) #build-info {
  font-size: 9px;
}

.ios-app .luth-auth-copy,
.ios-app #user-btn,
.ios-app .luth-session-select,
.ios-app .luth-new-btn,
.ios-app .luth-session-name,
.ios-app .luth-hero-export-btn,
.ios-app .luth-photo-upload-btn,
.ios-app .luth-note-add-btn,
.ios-app .luth-specs-input,
.ios-app .luth-inst-field,
.ios-app .luth-scale-preset,
.ios-app .luth-scale-inputs .a4-input-wrap input,
.ios-app .luth-capture-btn,
.ios-app .luth-picker-loading,
.ios-app .luth-picker-empty,
.ios-app .luth-instrument-name,
.ios-app .luth-add-instrument-btn,
.ios-app .luth-form-input,
.ios-app .luth-form-cancel,
.ios-app .luth-form-save {
  font-size: 17px;
}

.ios-app .luth-session-title-label,
.ios-app .luth-session-date,
.ios-app .luth-session-separator,
.ios-app .luth-session-measurement,
.ios-app .luth-session-updated,
.ios-app .luth-tab-btn,
.ios-app .luth-photos-loading,
.ios-app .luth-photos-empty,
.ios-app .luth-photo-label,
.ios-app .luth-notes-empty,
.ios-app .luth-note-ts,
.ios-app .luth-specs-group-label,
.ios-app .luth-specs-label,
.ios-app .luth-title,
.ios-app .luth-badge,
.ios-app .luth-inst-gauges-toggle,
.ios-app .luth-inst-detail-label,
.ios-app .luth-inst-gauge-num,
.ios-app .luth-inst-gauge-chip,
.ios-app .luth-saddle-display-label,
.ios-app .luth-segment-btn,
.ios-app .luth-scale-label,
.ios-app .luth-scale-unit,
.ios-app .luth-table-header span,
.ios-app .luth-open,
.ios-app .luth-harmonic,
.ios-app .luth-delta,
.ios-app .luth-saddle,
.ios-app .luth-awaiting,
.ios-app .luth-info-label,
.ios-app .luth-info-value,
.ios-app .luth-instrument-meta,
.ios-app .luth-instrument-desc,
.ios-app .luth-new-form-error,
.ios-app .luth-sign-out-btn,
.ios-app .luth-picker-desc,
.ios-app .luth-user-email {
  font-size: 15px;
}

.ios-app .luth-inst-hero-name,
.ios-app .luth-note,
.ios-app .luth-note-body {
  font-size: 17px;
}

.ios-app .luth-session-row,
.ios-app .luth-session-meta-row,
.ios-app .luth-header,
.ios-app .luth-inst-hero-name-wrap,
.ios-app .luth-photos-toolbar,
.ios-app .luth-notes-list,
.ios-app .luth-specs-form,
.ios-app .luth-picker-body,
.ios-app .luth-footer {
  padding-left: 20px;
  padding-right: 20px;
}

.ios-app .luth-tab-btn {
  padding-top: 12px;
  padding-bottom: 12px;
}

.ios-app .luth-row {
  padding-top: 11px;
  padding-bottom: 11px;
}

.ios-app .luth-capture-btn,
.ios-app .luth-new-btn,
.ios-app .luth-hero-export-btn,
.ios-app .luth-photo-upload-btn,
.ios-app .luth-note-add-btn,
.ios-app .luth-add-instrument-btn,
.ios-app .luth-form-cancel,
.ios-app .luth-form-save {
  min-height: 36px;
}

.ios-app .info-btn {
  min-width: 24px;
  min-height: 24px;
  padding-left: 6px;
  align-items: center;
  justify-content: center;
}

.ios-app .info-btn svg {
  width: 18px;
  height: 18px;
}

.ios-app .info-text,
.ios-app .detector-desc {
  font-size: 15px;
  line-height: 1.55;
}

.ios-app #user-dropdown {
  min-width: 220px;
  padding: 8px;
  gap: 4px;
}

.ios-app .user-dd-email {
  font-size: 17px;
  line-height: 1.45;
  padding: 10px 10px 12px;
}

.ios-app .user-dd-item {
  font-size: 17px;
  padding: 10px;
  min-height: 40px;
}

.ios-app .chip-edit-btn svg {
  width: 12px;
  height: 12px;
}

.ios-app #user-btn {
  max-width: 220px;
  letter-spacing: 0.05em;
  padding: 4px 2px;
}

.ios-app .premium-accent .acc-header .menu-section-title {
  font-size: 15px;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.ios-app .premium-accent .acc-header .luth-badge {
  font-size: 13px;
  letter-spacing: 0.06em;
  min-height: 24px;
  padding: 0 8px;
}

.ios-app .chip-delete-btn {
  font-size: 0.9rem;
}

/* ── Luthier Mode ────────────────────────────────────────────────────────── */
#top-bar-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  flex-shrink: 0;
}

.luthier-menu-btn {
  display: none;
  margin-top: 10px;
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #888;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.8rem;
  font-family: 'Open Sans', sans-serif;
  gap: 8px;
}

.luthier-menu-btn:hover {
  border-color: #555;
  color: #fff;
}

body.luthier-mode .luthier-menu-btn {
  border-color: #4af;
  color: #4af;
}

.luthier-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #c8a86a;
}

/* Inline badge alignment in menu titles and settings labels */
.menu-section-title .luth-badge,
.settings-label .luth-badge {
  vertical-align: middle;
  margin-left: 6px;
  position: relative;
  top: -1px;
}

/* Premium accent for Luthier Mode section */
.premium-accent {
  opacity: 1 !important;
}

.premium-accent .acc-header {
  color: #cea661;
  background: #1b1600;
}

.premium-accent .acc-body {
  background: #221a00;
}

.premium-accent .acc-header .menu-section-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.625rem;
  letter-spacing: 1.1px;
  font-weight: 400;
  text-transform: uppercase;
}

.premium-accent .acc-header .luth-badge {
  background: #2c2505;
  border-color: rgba(206, 166, 97, 0.19);
  font-size: 0.5rem;
  letter-spacing: 1.28px;
}

.premium-accent.open .acc-header {
  color: #cea661;
}

.premium-btn {
  background: #cea661 !important;
  border-color: #cea661 !important;
  color: #1b1600 !important;
}

.premium-btn:hover {
  background: #d9b575 !important;
  border-color: #d9b575 !important;
  color: #1b1600 !important;
}

@media (min-width: 700px) {
  .luthier-menu-btn {
    display: flex;
  }
}

/* Panel — fixed right column, hidden by default */
#luthier-panel {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 52px;
  right: 0;
  width: 480px;
  height: calc(100dvh - 52px);
  background: #0e0e0e;
  border-left: 1px solid #1e1e1e;
  overflow: hidden;
  overflow-x: hidden;
  z-index: 100;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1), visibility 0.35s;
}

body.luthier-mode #luthier-panel {
  transform: translateX(0);
  visibility: visible;
}

body.luthier-mode #menu-panel.open~#luthier-panel {
  opacity: 0.5;
  filter: blur(6px);
  pointer-events: none;
  transition: opacity 0.6s, filter 0.6s, transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Shift existing content left when panel is open */
body.luthier-mode #strobe-wrap,
body.luthier-mode #bottom-section {
  margin-right: 480px;
  transition: margin-right 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

body.luthier-mode #bg-canvas {
  right: 480px;
}

.ios-app.ipad-app #menu-panel {
  right: max(18px, env(safe-area-inset-right));
  width: var(--ipad-menu-panel-width);
}

.ios-app.ipad-app #menu-close-row {
  right: max(18px, env(safe-area-inset-right));
}

.ios-app #luthier-panel {
  top: calc(max(6px, env(safe-area-inset-top)) + 46px);
  height: calc(100dvh - max(58px, calc(env(safe-area-inset-top) + 46px)));
}

.ios-app.ipad-app #panel {
  width: min(calc(var(--strobe-size) + 140px), calc(100vw - var(--ipad-side-occupied) - 72px));
}

.ios-app.ipad-app #strings {
  gap: 10px;
}

.ios-app.ipad-app .string-btn {
  font-size: 2.3rem;
  min-height: 118px;
  padding: 14px 8px 12px;
  justify-content: space-between;
}

.ios-app.ipad-app body.menu-open-ipad:not(.luthier-mode) #strobe-wrap,
.ios-app.ipad-app body.menu-open-ipad:not(.luthier-mode) #bottom-section {
  margin-right: var(--ipad-menu-panel-width);
  transform: none;
}

.ios-app.ipad-app #luthier-panel {
  width: var(--ipad-luthier-panel-width);
}

.ios-app.ipad-app body.luthier-mode #strobe-wrap,
.ios-app.ipad-app body.luthier-mode #bottom-section {
  margin-right: var(--ipad-luthier-panel-width);
}

.ios-app.ipad-app body.luthier-mode #bg-canvas {
  right: var(--ipad-luthier-panel-width);
}

@media (min-width: 744px) and (max-width: 1023px) {
  .ios-app.ipad-app {
    --strobe-size: min(42vw, 360px);
  }

  .ios-app.ipad-app body {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }
  .ios-app.ipad-app #luthier-panel {
    border-left-color: #252525;
  }

  .ios-app.ipad-app .luth-inst-details {
    gap: 8px 14px;
  }

  .ios-app.ipad-app #tuning-label {
    font-size: 18px;
  }

  .ios-app.ipad-app #tuning-mode-label,
  .ios-app.ipad-app .menu-section-title {
    font-size: 16px;
  }

  .ios-app.ipad-app .settings-label,
  .ios-app.ipad-app .menu-about p,
  .ios-app.ipad-app .section-info,
  .ios-app.ipad-app .preset-desc,
  .ios-app.ipad-app .menu-chip,
  .ios-app.ipad-app .mode-btn,
  .ios-app.ipad-app #start-btn,
  .ios-app.ipad-app #auto-row,
  .ios-app.ipad-app #low-noise-row,
  .ios-app.ipad-app #custom-tuning-name,
  .ios-app.ipad-app .csr-freq,
  .ios-app.ipad-app .csr-note-label,
  .ios-app.ipad-app #custom-add-string,
  .ios-app.ipad-app #custom-save-btn,
  .ios-app.ipad-app #custom-cancel-btn {
    font-size: 18px;
  }

  .ios-app.ipad-app #a4-input,
  .ios-app.ipad-app .a4-unit,
  .ios-app.ipad-app .btn-note-oct,
  .ios-app.ipad-app .btn-freq,
  .ios-app.ipad-app .btn-cents,
  .ios-app.ipad-app #build-info {
    font-size: 16px;
  }

  .ios-app.ipad-app .luth-inst-details .luth-inst-gauges-row {
    flex-wrap: wrap;
  }

  .ios-app.ipad-app .luth-table-header,
  .ios-app.ipad-app .luth-row {
    grid-template-columns: 42px 1fr 1fr 1fr 1fr auto;
    column-gap: 8px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .ios-app.ipad-app .luth-capture-btn {
    min-height: 34px;
    padding: 6px 8px;
  }

  .ios-app.ipad-app .luth-back-btn,
  .ios-app.ipad-app .luth-inst-hero-name,
  .ios-app.ipad-app .luth-hero-export-btn,
  .ios-app.ipad-app .luth-session-select,
  .ios-app.ipad-app .luth-new-btn,
  .ios-app.ipad-app .luth-delete-session-btn,
  .ios-app.ipad-app .luth-scale-preset,
  .ios-app.ipad-app .luth-scale-inputs .a4-input-wrap input,
  .ios-app.ipad-app .luth-cscale-toggle,
  .ios-app.ipad-app .luth-note,
  .ios-app.ipad-app .luth-open,
  .ios-app.ipad-app .luth-harmonic,
  .ios-app.ipad-app .luth-delta,
  .ios-app.ipad-app .luth-saddle,
  .ios-app.ipad-app .luth-awaiting,
  .ios-app.ipad-app .luth-inst-field {
    font-size: 17px;
  }

  .ios-app.ipad-app .luth-tab-btn,
  .ios-app.ipad-app .luth-session-title-label,
  .ios-app.ipad-app .luth-session-date,
  .ios-app.ipad-app .luth-session-measurement,
  .ios-app.ipad-app .luth-session-updated,
  .ios-app.ipad-app .luth-scale-label,
  .ios-app.ipad-app .luth-scale-unit,
  .ios-app.ipad-app .luth-cscale-toggle-label,
  .ios-app.ipad-app .luth-table-header span,
  .ios-app.ipad-app .luth-inst-detail-label,
  .ios-app.ipad-app .luth-badge {
    font-size: 15px;
  }

  .ios-app.ipad-app .luth-header,
  .ios-app.ipad-app .luth-inst-hero-name-wrap,
  .ios-app.ipad-app .luth-scale-row,
  .ios-app.ipad-app .luth-session-row,
  .ios-app.ipad-app .luth-session-meta-row,
  .ios-app.ipad-app .luth-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .ios-app.ipad-app .luth-new-form-two,
  .ios-app.ipad-app .luth-new-form-scale,
  .ios-app.ipad-app .luth-cscale-add-row {
    grid-template-columns: 1fr;
  }

  .ios-app.ipad-app .linst-gauges-grid {
    flex-wrap: wrap;
  }

  .ios-app.ipad-app .luth-photos-grid {
    grid-template-columns: 1fr;
  }
}

/* View Transitions API — spring feel */
@supports (view-transition-name: none) {

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 0.25s;
    animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
  }
}

/* ── Luthier session row ──────────────────────────────────────────────── */
.luth-session-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.luth-session-select {
  flex: 1;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 5px;
  color: #aaa;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  height: 32px;
  padding: 0 8px;
  cursor: pointer;
  min-width: 0;
  box-sizing: border-box;
}

.luth-session-select:focus {
  outline: none;
  border-color: #4af;
}

.luth-new-btn {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 5px;
  color: #666;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  height: 32px;
  padding: 0 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s;
  flex-shrink: 0;
  box-sizing: border-box;
}

.luth-new-btn:hover {
  border-color: #555;
  color: #ccc;
}

.luth-session-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 18px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.luth-session-title-wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.luth-session-title-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.luth-session-title-icon {
  align-items: center;
  background: none;
  border: none;
  color: #555;
  display: inline-flex;
  flex-shrink: 0;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: color 0.12s;
}

.luth-session-title-icon:hover {
  color: #888;
}

.luth-session-title-icon:focus {
  outline: none;
  color: #4af;
}

.luth-session-title-label {
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.luth-session-name {
  background: transparent;
  border: none;
  border-bottom: 1px solid #222;
  color: #ccc;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 0;
  width: 100%;
  min-width: 0;
}

.luth-session-name::placeholder {
  color: #333;
}

.luth-session-name:focus {
  outline: none;
  border-bottom-color: #4af;
}

.luth-session-submeta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.luth-session-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}

.luth-session-date {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.65rem;
  color: #444;
  white-space: nowrap;
}

.luth-session-separator {
  color: #333;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.62rem;
}

.luth-session-measurement {
  color: #444;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.65rem;
  white-space: nowrap;
}

.luth-session-updated {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.6rem;
  color: #333;
  white-space: nowrap;
}

/* ── Luthier panel internals ──────────────────────────────────────────── */

/* Instrument hero header */
.luth-inst-hero {
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.38);
  position: relative;
  z-index: 3;
}

.luth-inst-hero-top,
.luth-header.luth-inst-hero-top {
  border-bottom: none;
  margin-bottom: 0;
}

.luth-inst-hero-name-wrap {
  padding: 10px 18px;
}

.luth-inst-hero-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
}

.luth-inst-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.luth-hero-export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 600;
  background: none;
  border: 1px solid #3a3a3a;
  border-radius: 5px;
  color: #8c8c8c;
  min-height: 30px;
  padding: 0 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.luth-hero-export-btn:hover {
  background: #1a1a1a;
  border-color: #525252;
  color: #fff;
}

.luth-inst-hero-name {
  font-size: 1.23rem;
  font-weight: 700;
  line-height: 1.1;
  color: #c8a86a;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  min-height: 24px;
  padding: 0 4px;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s;
}

.luth-inst-hero-name:hover {
  border-color: #333;
  background: #161616;
}

.luth-inst-hero-name:focus {
  outline: none;
  border-color: #4af;
  background: #161616;
}

.luth-inst-hero-name::placeholder {
  color: #444;
}

.luth-inst-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  color: #8c8c8c;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.luth-inst-close-btn:hover {
  background: #161616;
  border-color: #525252;
  color: #fff;
}

.luth-inst-detail-view {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.luth-view-stack {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
}

.luth-inst-detail-view.is-entering {
  animation: luthInstSlideIn 0.34s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.luth-inst-detail-view.is-exiting {
  animation: luthInstSlideOut 0.34s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes luthInstSlideIn {
  from {
    opacity: 0;
    transform: translateX(22px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes luthInstSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(22px);
  }
}

/* Tab bar */
.luth-tabs {
  display: flex;
  border-bottom: 1px solid #1e1e1e;
  flex-shrink: 0;
  background: #111;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.52);
  position: sticky;
  top: 0;
  z-index: 2;
}

.luth-tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.12s, border-color 0.12s;
}

.luth-tab-btn.active {
  color: #c8a86a;
  border-bottom-color: #c8a86a;
}

.luth-tab-btn:hover:not(.active) {
  color: #888;
}

/* Tab panes */
.luth-tab-pane {
  overflow: visible;
  flex: none;
  display: flex;
  flex-direction: column;
}

/* Relief tab */
.luth-relief-wrap {
  display: flex;
  flex: 1;
  padding: 0;
}

.luth-relief-container {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  padding: 14px 18px 24px;
}

.luth-relief-intro {
  color: #b6b6b6;
  font-size: 0.8rem;
  line-height: 1.65;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.95), rgba(14, 14, 14, 0.95));
  border: 1px solid #1f1f1f;
  border-radius: 8px;
  padding: 14px 15px;
}

.luth-relief-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.luth-relief-add-btn {
  display: inline-block;
  background: none;
  border: 1px dashed #2a2a2a;
  border-radius: 6px;
  color: #4af;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.luth-relief-add-btn:hover {
  border-color: #4af;
}

.luth-relief-status {
  min-height: 1em;
  color: #666;
  font-size: 0.72rem;
}

.luth-relief-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.luth-relief-empty {
  font-size: 0.78rem;
  color: #444;
  padding: 24px 0;
  text-align: center;
}

.luth-relief-card {
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 8px;
  padding: 12px;
}

.luth-relief-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.luth-relief-card-title {
  color: #d8d8d8;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.luth-relief-card-ts {
  color: #777;
  font-size: 0.72rem;
  margin-top: 3px;
}

.luth-relief-del {
  background: none;
  border: none;
  color: #555;
  font-size: 1.1rem;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.12s;
  flex-shrink: 0;
}

.luth-relief-del:hover {
  color: #e05555;
}

.luth-relief-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

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

.luth-relief-field-wide {
  grid-column: 1 / -1;
}

.luth-relief-label {
  color: #777;
  font-size: 0.72rem;
}

.luth-relief-input,
.luth-relief-textarea {
  width: 100%;
  background: #101010;
  border: 1px solid #232323;
  border-radius: 6px;
  color: #d3d3d3;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  padding: 9px 10px;
  transition: border-color 0.12s, background 0.12s;
}

.luth-relief-input:hover,
.luth-relief-textarea:hover {
  border-color: #2f2f2f;
}

.luth-relief-input:focus,
.luth-relief-textarea:focus {
  outline: none;
  border-color: #4af;
  background: #121212;
}

.luth-relief-textarea {
  min-height: 88px;
  line-height: 1.55;
  resize: vertical;
}

.luth-relief-tips {
  background: rgba(200, 168, 106, 0.08);
  border: 1px solid rgba(200, 168, 106, 0.16);
  border-radius: 8px;
  padding: 14px 15px;
}

.luth-relief-tips-title {
  color: #c8a86a;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.luth-relief-tips-list {
  margin-left: 18px;
  color: #b7b0a3;
  font-size: 0.77rem;
  line-height: 1.6;
}

.luth-relief-tips-list li + li {
  margin-top: 5px;
}

.luth-relief-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}

.luth-relief-footer-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.luth-relief-display-switch {
  width: 100%;
}

.luth-relief-display-switch .luth-relief-display-btn {
  min-height: 38px;
  font-size: 0.63rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Photos tab */
.luth-photos-toolbar {
  padding: 12px 18px 0;
  flex-shrink: 0;
}

.luth-photo-upload-btn {
  display: inline-block;
  background: none;
  border: 1px dashed #2a2a2a;
  border-radius: 6px;
  color: #4af;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.luth-photo-upload-btn:hover {
  border-color: #4af;
}

.luth-photos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px 18px 18px;
}

.luth-photos-loading,
.luth-photos-empty {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: #444;
  padding: 24px 0;
  text-align: center;
}

.luth-photo-card {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #141414;
  border: 1px solid #1e1e1e;
  cursor: pointer;
}

.luth-photo-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.luth-photo-label {
  font-size: 0.68rem;
  color: #666;
  padding: 4px 8px 5px;
}

.luth-photo-del {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.65);
  border: none;
  color: #777;
  font-size: 1rem;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.12s;
}

.luth-photo-del:hover {
  color: #e05555;
}

/* Lightbox */
.luth-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
}

.luth-lightbox-stage {
  position: relative;
  width: min(96vw, 1320px);
  height: min(92vh, 920px);
  overflow: hidden;
  perspective: 1200px;
  z-index: 1;
  pointer-events: none;
}

.luth-lightbox img {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 4px;
  transition: transform 0.42s cubic-bezier(0.22, 0.9, 0.2, 1), opacity 0.42s ease;
  transform-origin: center center;
  z-index: 1;
  pointer-events: none;
}

.luth-lightbox img.is-active {
  opacity: 1;
  transform: translateX(0) rotateY(0deg) scale(1);
  z-index: 3;
}

.luth-lightbox img.is-entering.from-right {
  opacity: 0;
  transform: translateX(18%) rotateY(-18deg) scale(0.9);
  z-index: 4;
}

.luth-lightbox img.is-entering.from-left {
  opacity: 0;
  transform: translateX(-18%) rotateY(18deg) scale(0.9);
  z-index: 4;
}

.luth-lightbox img.is-leaving.to-left {
  opacity: 0;
  transform: translateX(-20%) rotateY(20deg) scale(0.9);
  z-index: 2;
}

.luth-lightbox img.is-leaving.to-right {
  opacity: 0;
  transform: translateX(20%) rotateY(-20deg) scale(0.9);
  z-index: 2;
}

.luth-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.72);
  color: #cfcfcf;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
  z-index: 6;
}

.luth-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.72);
  color: #cfcfcf;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
  z-index: 7;
}

.luth-lightbox-close:hover {
  background: rgba(28, 28, 28, 0.9);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  transform: scale(1.04);
}

.luth-lightbox-nav:hover {
  background: rgba(28, 28, 28, 0.9);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  transform: translateY(-50%) scale(1.04);
}

.luth-lightbox-nav[hidden] {
  display: none;
}

.luth-lightbox-prev {
  left: 20px;
}

.luth-lightbox-next {
  right: 20px;
}

.luth-lightbox-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  z-index: 6;
  margin-top: 8px;
}

.luth-lightbox-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}

.luth-lightbox-dot:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: scale(1.15);
}

.luth-lightbox-dot.active {
  background: #fff;
  transform: scale(1.2);
}

/* Notes tab */
.luth-notes-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0;
}

.luth-note-add-btn {
  display: inline-block;
  background: none;
  border: 1px dashed #2a2a2a;
  border-radius: 6px;
  color: #4af;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.luth-note-add-btn:hover {
  border-color: #4af;
}

.luth-notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 18px 16px;
  overflow-y: auto;
  flex: 1;
}

.luth-notes-add-row {
  padding-top: 4px;
}

.luth-notes-empty {
  font-size: 0.78rem;
  color: #444;
  padding: 24px 0;
  text-align: center;
}

.luth-note-card {
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 10px 12px 8px;
  transition: border-color 0.12s;
}

.luth-note-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.luth-note-ts {
  flex: 1;
  font-size: 0.72rem;
  color: #888;
  font-family: 'Open Sans', sans-serif;
}

.luth-note-del {
  background: none;
  border: none;
  color: #555;
  font-size: 1.1rem;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.12s;
  flex-shrink: 0;
}

.luth-note-del:hover {
  color: #e05555;
}

.luth-note-body {
  width: 100%;
  min-height: 80px;
  background: transparent;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  color: #ccc;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  line-height: 1.6;
  padding: 8px 10px;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.12s;
}

.luth-note-body:focus {
  outline: none;
  border-color: #2a2a2a;
}

.luth-note-body::placeholder {
  color: #2a2a2a;
}

@keyframes luth-note-flash {
  0% {
    border-color: #2a4a2a;
    box-shadow: 0 0 0 1px #2a4a2a;
  }

  60% {
    border-color: #2a4a2a;
    box-shadow: 0 0 0 1px #2a4a2a;
  }

  100% {
    border-color: #1e1e1e;
    box-shadow: none;
  }
}

.luth-note-saved {
  animation: luth-note-flash 1.2s ease-out forwards;
}

/* Specs tab */
.luth-specs-form {
  padding: 14px 18px 24px;
  overflow-y: auto;
}

.luth-specs-group {
  margin-bottom: 20px;
}

.luth-specs-group-label {
  font-size: 0.68rem;
  color: #c8a86a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #1e1e1e;
}

.luth-specs-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.luth-specs-label {
  font-size: 0.72rem;
  color: #555;
}

.luth-specs-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #ccc;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  padding: 3px 6px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.12s, background 0.12s;
}

.luth-specs-input:hover {
  border-color: #2a2a2a;
  background: #141414;
}

.luth-specs-input:focus {
  outline: none;
  border-color: #4af;
  background: #141414;
}

.luth-specs-input::placeholder {
  color: #333;
}

.luth-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
  min-height: 34px;
  box-sizing: border-box;
}

.luth-header-main,
.luth-header-meta {
  display: flex;
  align-items: center;
  min-height: 30px;
}

.luth-header-main {
  min-width: 0;
}

.luth-header-meta {
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.luth-panel-header {
  background: #1c1c1c;
  border-bottom: 1px solid #2a2a2a;
  position: relative;
  z-index: 3;
}

.luth-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  line-height: 1;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.luth-title-button {
  min-height: 30px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.luth-title-chevron {
  flex: none;
  color: #666;
  transform: translateY(0.5px);
}
.luth-badge,
#user-btn .user-btn-tier.tier-luthier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.5rem;
  line-height: 1;
  font-weight: 600;
  color: #c8a86a;
  background: rgba(200, 168, 106, 0.1);
  border: 1px solid rgba(200, 168, 106, 0.3);
  border-radius: 999px;
  min-height: 18px;
  padding: 0 7px;
  letter-spacing: 0.08em;
  box-sizing: border-box;
  vertical-align: middle;
}

/* Instrument details grid at top of measurement view */
.luth-inst-details {
  background: #1c1c1c;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 18px 14px;
  border-bottom: 1px solid #2a2a2a;
  align-items: stretch;
}

.luth-inst-detail-item {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.luth-inst-detail-item-gauges {
  align-items: center;
}

.luth-inst-gauges-disclosure {
  display: flex;
  align-items: center;
}

.luth-inst-gauges-disclosure[open] {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.luth-inst-gauges-toggle {
  align-items: center;
  color: #666;
  cursor: pointer;
  display: inline-flex;
  gap: 4px;
  list-style: none;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  user-select: none;
}

.luth-inst-gauges-toggle::-webkit-details-marker {
  display: none;
}

.luth-inst-gauges-chevron {
  flex-shrink: 0;
  transition: transform 0.16s ease;
}

.luth-inst-gauges-range {
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.luth-inst-gauges-range-arrow {
  flex-shrink: 0;
}

.luth-inst-gauges-edit {
  align-items: center;
  color: #666;
  display: inline-flex;
  flex-shrink: 0;
  gap: 3px;
  padding: 0 6px;
}

.luth-inst-gauges-disclosure[open] .luth-inst-gauges-toggle {
  color: #fff;
}

.luth-inst-gauges-disclosure[open] .luth-inst-gauges-chevron {
  transform: rotate(180deg);
}

.luth-inst-gauges-disclosure[open] .luth-inst-gauges-edit {
  color: #fff;
}

.luth-inst-details .luth-inst-gauges-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  width: 100%;
}

.luth-inst-detail-label {
  font-size: 0.72rem;
  color: #555;
  white-space: nowrap;
  line-height: 1;
}

.luth-inst-field {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #ccc;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  padding: 2px 5px;
  width: auto;
  box-sizing: border-box;
  transition: border-color 0.12s, background 0.12s;
  min-width: 0;
}

.luth-inst-detail-item .luth-inst-field {
  flex: 0 1 auto;
}

.luth-inst-detail-item .luth-inst-field[data-field="body_style"] {
  min-width: 160px;
}

.luth-inst-field:hover {
  border-color: #2a2a2a;
  background: #141414;
}

.luth-inst-field:focus {
  outline: none;
  border-color: #4af;
  background: #141414;
}

.luth-inst-field::placeholder {
  color: #333;
}

.luth-inst-field:-webkit-autofill,
.luth-inst-field:-webkit-autofill:hover,
.luth-inst-field:-webkit-autofill:focus,
.luth-form-input:-webkit-autofill,
.luth-form-input:-webkit-autofill:hover,
.luth-form-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e8e8e8;
  box-shadow: 0 0 0 1000px #1a1a1a inset;
  transition: background-color 9999s ease-out 0s;
}

.luth-inst-field[type="number"] {
  -moz-appearance: textfield;
}

.luth-inst-field[type="number"]::-webkit-outer-spin-button,
.luth-inst-field[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

select.luth-inst-field {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

select.luth-inst-field option {
  background: #1a1a1a;
}

.luth-inst-gauge-num {
  font-size: 0.68rem;
  color: #444;
  min-width: 10px;
  text-align: right;
}

.luth-inst-gauge-chip {
  background: #181818;
  border: 1px solid #252525;
  border-radius: 4px;
  color: #ccc;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  padding: 2px 4px;
  width: 42px;
  text-align: center;
  transition: border-color 0.12s;
}

.luth-inst-gauge-chip:focus {
  outline: none;
  border-color: #4af;
}

.luth-scale-row {
  background: #181818;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
}

.luth-scale-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.luth-scale-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  color: #666;
  flex-shrink: 0;
}

.luth-scale-preset {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 5px;
  color: #666;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.68rem;
  padding: 4px 6px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.luth-scale-preset:focus {
  outline: none;
  border-color: #4af;
}

.luth-scale-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.luth-scale-inputs .a4-input-wrap input {
  width: 60px;
  background: transparent;
  border: none;
  color: #4af;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  padding: 2px 4px;
  text-align: right;
  -moz-appearance: textfield;
}

.luth-scale-inputs .a4-input-wrap input::-webkit-outer-spin-button,
.luth-scale-inputs .a4-input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.luth-scale-inputs .a4-input-wrap input:focus {
  outline: none;
}

.luth-scale-unit {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.68rem;
  color: #555;
}

.luth-scale-sep {
  color: #333;
  font-size: 0.8rem;
  padding: 0 2px;
}

/* Column grid: String | Open | Harmonic | Delta | Saddle | Action */
.luth-table-header,
.luth-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr 1fr auto;
  align-items: center;
  column-gap: 12px;
  padding: 0 18px;
}

.luth-table-header {
  padding-top: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.luth-table-header span {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.6rem;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.luth-row {
  padding-top: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid #141414;
  cursor: pointer;
  transition: background 0.12s;
}

.luth-row:hover {
  background: #141414;
}

.luth-row.active {
  background: #161410;
}

.luth-note {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #aaa;
}

.luth-row.active .luth-note {
  color: #c8a86a;
}

.luth-open,
.luth-harmonic,
.luth-delta,
.luth-saddle {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  color: #555;
}

.luth-saddle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.luth-saddle-dir {
  font-size: 1.6em;
  line-height: 1;
}

.luth-measure-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #2e2e2e;
  border-radius: 6px;
  background: #141414;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s, color 0.12s, background 0.12s, box-shadow 0.12s;
}

.luth-measure-btn.is-empty {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  color: #8a8a8a;
  letter-spacing: 0.01em;
}

.luth-measure-btn.is-filled {
  color: #b8b8b8;
}

.luth-row.active .luth-measure-btn.is-filled {
  color: #d0d0d0;
}

.luth-measure-btn:hover {
  border-color: #c8a86a;
  color: #e2d3b7;
  background: #191612;
}

.luth-measure-btn.active {
  border-color: #c8a86a;
  color: #c8a86a;
  background: rgba(200, 168, 106, 0.08);
  box-shadow: inset 0 0 0 1px rgba(200, 168, 106, 0.08);
}

.luth-awaiting {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  color: #3a3a3a;
  font-style: italic;
}

/* Footer info cards */
.luth-info-cards {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.luth-info-card {
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.luth-info-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.65rem;
  color: #555;
}

.luth-info-value {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #aaa;
}


.luth-action {
  display: flex;
  justify-content: flex-end;
}

.luth-capture-btn {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 5px;
  color: #888;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.luth-capture-btn:hover {
  border-color: #c8a86a;
  color: #c8a86a;
}

.luth-capture-btn.active {
  border-color: #c8a86a;
  color: #c8a86a;
  background: rgba(200, 168, 106, 0.08);
}

.luth-reset-btn {
  background: none;
  border: none;
  color: #444;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.12s;
}

.luth-reset-btn:hover {
  color: #e05555;
}

/* Footer */
.luth-footer {
  padding: 14px 18px;
  margin-top: auto;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.luth-saddle-display-wrap {
  margin-bottom: 12px;
}

.luth-saddle-display-label {
  display: block;
  margin-bottom: 8px;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.luth-saddle-display-switch {
  width: 100%;
}

.luth-saddle-display-switch .luth-saddle-display-btn {
  min-height: 38px;
  font-size: 0.63rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.luth-segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.luth-segment-btn {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  background: #151515;
  color: #8c8c8c;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.luth-segment-btn:hover {
  border-color: #c8a86a;
  color: #d6c39d;
}

.luth-segment-btn.active {
  border-color: #c8a86a;
  background: rgba(200, 168, 106, 0.08);
  color: #c8a86a;
}

#luthier-clear-all {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #555;
  height: 32px;
  padding: 0 14px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  width: 100%;
  box-sizing: border-box;
}

#luthier-clear-all:hover {
  border-color: #e05555;
  color: #e05555;
}


/* ── Auth overlay ───────────────────────────────────────────────────────── */
#luthier-auth-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 300;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

body.luthier-auth-mode #luthier-auth-overlay.active:not([hidden]) {
  display: flex;
}

body.luthier-auth-mode #luthier-auth-overlay.active:not([hidden]) {
  animation: luthAuthFadeIn 0.18s ease-out both;
}

body:not(.luthier-auth-mode) #luthier-auth-overlay,
#touch-overlay:not(.hidden)~#luthier-auth-overlay {
  display: none !important;
}

.luth-auth-card {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03);
  padding: 32px;
  width: 340px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform-origin: center;
}

body.luthier-auth-mode #luthier-auth-overlay.active:not([hidden]) .luth-auth-card {
  animation: luthAuthScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes luthAuthFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes luthAuthScaleIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {

  .luth-inst-detail-view.is-entering,
  .luth-inst-detail-view.is-exiting,
  body.luthier-auth-mode #luthier-auth-overlay.active:not([hidden]),
  body.luthier-auth-mode #luthier-auth-overlay.active:not([hidden]) .luth-auth-card {
    animation: none;
  }
}

.luth-auth-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}

.luth-auth-tabs {
  display: flex;
  gap: 4px;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 3px;
}

.luth-auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: #666;
  padding: 7px 0;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  transition: background 0.12s, color 0.12s;
}

.luth-auth-tab.active {
  background: #2a2a2a;
  color: #fff;
}

.luth-auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.luth-auth-input {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #e8e8e8;
  padding: 10px 12px;
  border-radius: 7px;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.875rem;
  width: 100%;
  box-sizing: border-box;
  transition: box-shadow 0.6s ease;
}

.luth-auth-input:hover {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75);
  transition-duration: 0.2s;
}

.luth-auth-input:focus {
  outline: none;
  border-color: #4af;
  box-shadow: 0 0 0 1px rgba(68, 170, 255, 0.6);
  transition-duration: 0.2s;
}

.luth-auth-input:-webkit-autofill,
.luth-auth-input:-webkit-autofill:hover,
.luth-auth-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e8e8e8;
  box-shadow: 0 0 0 1000px #1a1a1a inset;
  caret-color: #e8e8e8;
}

.luth-auth-password-wrap {
  position: relative;
}

.luth-auth-password-wrap .luth-auth-input {
  padding-right: 58px;
}

.luth-auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px;
  text-transform: uppercase;
}

.luth-auth-password-toggle:hover,
.luth-auth-password-toggle:focus-visible {
  color: #fff;
}

.luth-auth-password-toggle:focus-visible {
  outline: 1px solid #4af;
  outline-offset: 2px;
  border-radius: 4px;
}

.luth-auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  color: #888;
  user-select: none;
}

.luth-auth-remember input {
  appearance: none;
  background: #141414;
  border: 1px solid #333;
  border-radius: 4px;
  cursor: pointer;
  height: 14px;
  position: relative;
  width: 14px;
}

.luth-auth-remember input:checked {
  background: #4af;
  border-color: #4af;
}

.luth-auth-remember input:checked::after {
  border: solid #111;
  border-width: 0 2px 2px 0;
  content: '';
  height: 7px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -58%) rotate(45deg);
  width: 4px;
}

.luth-auth-remember input:focus-visible {
  outline: 1px solid #4af;
  outline-offset: 2px;
}

.luth-auth-remember.hidden {
  display: none;
}

.luth-auth-forgot {
  background: none;
  border: none;
  color: #4af;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  transition: opacity 0.12s;
}

.luth-auth-forgot:hover {
  opacity: 0.75;
}

.luth-auth-error {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  min-height: 18px;
  line-height: 1.3;
}

.luth-auth-submit {
  background: #4af;
  color: #000;
  border: none;
  padding: 11px;
  border-radius: 7px;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.12s;
}

.luth-auth-submit:hover {
  opacity: 0.9;
}

.luth-auth-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

.luth-auth-close {
  background: none;
  border: none;
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  text-align: center;
  transition: color 0.12s;
}

.luth-auth-close:hover {
  color: #888;
}

/* ── Instrument picker (inside luthier panel) ───────────────────────────── */
.luth-picker-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow: hidden;
  padding: 14px 18px 18px;
}

.luth-instrument-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.luth-picker-loading {
  color: #555;
  font-size: 0.82rem;
  text-align: center;
  padding: 24px 0;
}

.luth-picker-empty {
  color: #555;
  font-size: 0.82rem;
  text-align: center;
  padding: 24px 0;
  line-height: 1.6;
}

.luth-instrument-card {
  background: #151515;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 14px 16px;
  cursor: default;
  transition: border-color 0.12s, background 0.12s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.luth-instrument-card:hover {
  border-color: #3a3a3a;
  background: #1a1a1a;
}

.luth-instrument-card-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.luth-instrument-del-btn {
  background: none;
  border: none;
  color: #333;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.12s, background 0.12s;
}

.luth-instrument-del-btn:hover {
  color: #e05555;
  background: rgba(224, 85, 85, 0.1);
}

.luth-instrument-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e8e8e8;
}

.luth-instrument-meta {
  font-size: 0.72rem;
  color: #666;
  margin-top: 4px;
  line-height: 1.4;
}

.luth-instrument-desc {
  font-size: 0.72rem;
  color: #555;
  margin-top: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.luth-add-instrument-btn {
  background: none;
  border: 1px dashed #2a2a2a;
  border-radius: 7px;
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}

.luth-add-instrument-btn:hover {
  border-color: #444;
  color: #888;
}

/* New instrument form */
.luth-new-instrument-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 14px;
  background: #151515;
  border: 1px solid #222;
  border-radius: 8px;
  flex-shrink: 0;
}

.luth-new-instrument-form>*+* {
  margin-top: 4px;
}

.luth-new-form-row {
  display: flex;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

.luth-new-form-stack {
  flex-direction: column;
  gap: 4px;
}

.luth-new-form-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

.luth-new-form-three {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

.luth-form-input {
  -webkit-appearance: none;
  appearance: none;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #e8e8e8;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  padding: 8px 10px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.12s;
}

.luth-form-input:focus {
  outline: none;
  border-color: #4af;
}

.luth-form-input::placeholder {
  color: #444;
}

.luth-form-textarea {
  resize: vertical;
  min-height: 60px;
}

select.luth-form-input option {
  background: #1a1a1a;
}

.luth-new-form-error {
  font-size: 0.78rem;
  color: #e05555;
}

.luth-new-form-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  padding-top: 0;
}

.luth-form-cancel {
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #666;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.luth-form-cancel:hover {
  border-color: #444;
  color: #999;
}

.luth-form-save {
  background: #4af;
  border: none;
  border-radius: 6px;
  color: #000;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 16px;
  cursor: pointer;
  transition: opacity 0.12s;
}

.luth-form-save:hover {
  opacity: 0.88;
}

.luth-form-save:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Sign out + back links */
.luth-sign-out-btn {
  background: none;
  border: none;
  color: #444;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 6px 0 0;
  text-align: center;
  transition: color 0.12s;
  flex-shrink: 0;
}

.luth-sign-out-btn:hover {
  color: #888;
}

/* Back button in intonation panel header */
.luth-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.luth-back-btn {
  justify-content: flex-start;
  color: #fff;
  transition: color 0.12s, opacity 0.12s;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.luth-back-btn:hover {
  opacity: 0.8;
}

.luth-instrument-label {
  font-size: 0.78rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* Picker description + sign-out row */
.luth-picker-desc {
  font-size: 0.78rem;
  color: #555;
  line-height: 1.5;
  margin: 0 0 4px;
  flex-shrink: 0;
}

.luth-sign-out-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 4px;
}

.luth-user-email {
  font-size: 0.72rem;
  color: #444;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* New instrument form — scale + gauge */
.luth-new-form-scale {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

.linst-scale-input-wrap {
  display: flex;
  gap: 0;
}

.linst-scale-input-wrap .luth-form-input {
  width: 80px;
  border-radius: 6px 0 0 6px;
  text-align: center;
}

.linst-scale-unit-btn {
  background: #222;
  border: 1px solid #2a2a2a;
  border-left: none;
  border-radius: 0 6px 6px 0;
  color: #4af;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.linst-scale-unit-btn:hover {
  background: #2a2a2a;
  color: #6cf;
}

.luth-new-form-count {
  display: flex;
  align-items: center;
  gap: 4px;
}

.linst-field-label {
  font-size: 0.78rem;
  color: #666;
  white-space: nowrap;
}

.linst-gauges-label {
  font-size: 0.78rem;
  color: #666;
  margin-bottom: 0;
  width: 100%;
}

.linst-gauges-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
  width: 100%;
}

.linst-gauge-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.linst-gauge-num {
  font-size: 0.72rem;
  color: #555;
  width: 14px;
  text-align: right;
  flex-shrink: 0;
}

.linst-gauge-item .luth-form-input {
  width: 44px;
  text-align: center;
  padding: 7px 4px;
}


/* Delete session button */
.luth-delete-session-btn {
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #444;
  font-size: 1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.12s, color 0.12s;
}

.luth-delete-session-btn:hover {
  border-color: #e05555;
  color: #e05555;
}

/* ── Custom scale length manager ────────────────────────────────────────── */
.luth-cscale-section {
  flex-shrink: 0;
  padding-bottom: 4px;
}

.luth-cscale-toggle {
  background: none;
  border: none;
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.74rem;
  cursor: pointer;
  padding: 0;
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.12s;
}

.luth-cscale-toggle:hover {
  color: #888;
}

.luth-cscale-toggle[aria-expanded="true"] {
  color: #fff;
}

.luth-cscale-toggle[aria-expanded="true"] .luth-cscale-chevron {
  transform: rotate(180deg);
}

.luth-cscale-toggle-label {
  line-height: 1;
}

.luth-cscale-chevron {
  flex-shrink: 0;
  transition: transform 0.16s ease;
}

.luth-cscale-manager {
  margin: 4px 18px 0;
  background: #111;
  border: 1px solid #222;
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.luth-cscale-empty {
  font-size: 0.75rem;
  color: #444;
  padding: 4px 0;
}

.luth-cscale-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #1e1e1e;
}

.luth-cscale-item:last-child {
  border-bottom: none;
}

.luth-cscale-name-val {
  font-size: 0.8rem;
  color: #ccc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.luth-cscale-mm-val {
  font-size: 0.75rem;
  color: #666;
  white-space: nowrap;
  font-family: 'Open Sans', sans-serif;
}

.luth-cscale-edit-btn,
.luth-cscale-del-btn,
.luth-cscale-save-btn,
.luth-cscale-cancel-btn {
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 3px 8px;
  transition: border-color 0.12s, color 0.12s;
}

.luth-cscale-edit-btn {
  color: #666;
}

.luth-cscale-edit-btn:hover {
  border-color: #555;
  color: #ccc;
}

.luth-cscale-del-btn {
  color: #555;
}

.luth-cscale-del-btn:hover {
  border-color: #e05555;
  color: #e05555;
}

.luth-cscale-save-btn {
  color: #4af;
  border-color: #1a3a5a;
}

.luth-cscale-save-btn:hover {
  border-color: #4af;
}

.luth-cscale-cancel-btn {
  color: #555;
}

.luth-cscale-cancel-btn:hover {
  color: #888;
}

/* Edit mode spans full row */
.luth-cscale-item:has(.luth-cscale-ei-name) {
  grid-template-columns: 1fr 88px 88px auto auto;
}

.luth-cscale-add-row {
  display: grid;
  grid-template-columns: 1fr 88px 88px auto;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid #1e1e1e;
}

.luth-cscale-unit-wrap {
  align-items: center;
  background: transparent;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  box-sizing: border-box;
  display: inline-flex;
  min-width: 0;
  padding-right: 6px;
}

.luth-cscale-unit-wrap:focus-within {
  border-color: #4af;
}

.luth-cscale-unit-wrap .luth-form-input {
  background: transparent;
  border: none;
  min-width: 0;
  padding-right: 4px;
}

.luth-cscale-unit-wrap .luth-form-input:focus {
  outline: none;
}

.luth-cscale-unit-tag {
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.68rem;
  flex-shrink: 0;
  text-transform: lowercase;
}

.luth-cscale-add-btn {
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #666;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 7px 10px;
  transition: border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.luth-cscale-add-btn:hover {
  border-color: #4af;
  color: #4af;
}

/* ── Share mode (read-only public view) ──────────────────────────────────── */

body.share-mode #top-bar,
body.share-mode #bottom-section,
body.share-mode #strobe-wrap,
body.share-mode #touch-overlay,
body.share-mode #bg-canvas,
body.share-mode #fullscreen-btn,
body.share-mode #viz-btn,
body.share-mode #viz-overlay,
body.share-mode #build-info,
body.share-mode #menu-panel,
body.share-mode #menu-close-row,
body.share-mode #luthier-auth-overlay,
body.share-mode #app-loader {
  display: none !important;
}

html.share-mode,
html:has(body.share-mode) {
  height: auto;
  min-height: 100dvh;
  overflow: auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: auto;
}

body.share-mode {
  background: #0a0a0a;
  display: block;
  height: auto;
  min-height: 100dvh;
  overflow: auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: auto;
  touch-action: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

body.share-mode #luthier-panel {
  display: block;
  position: static;
  visibility: visible;
  transform: none;
  width: 100%;
  height: auto;
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
  overflow: visible;
  border-left: none;
  transition: none;
}

body.share-pdf-mode #luthier-panel {
  max-width: 940px;
  background: #ddd;
}

html.share-pdf-mode,
html:has(body.share-pdf-mode),
body.share-pdf-mode {
  background: #ddd !important;
}

body.share-pdf-mode .luth-tabs,
body.share-pdf-mode .share-footer {
  display: none !important;
}

body.share-pdf-mode .share-header {
  background: #fff;
  border: 1px solid #ddd7cb;
  border-radius: 14px;
  padding: 28px 24px 22px;
  margin-bottom: 18px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.06);
}

body.share-pdf-mode .share-title {
  color: #171717;
}

body.share-pdf-mode .share-meta,
body.share-pdf-mode .share-detail-label,
body.share-pdf-mode .share-session-name,
body.share-pdf-mode .share-empty,
body.share-pdf-mode .share-pdf-section-title,
body.share-pdf-mode .share-pdf-session-meta,
body.share-pdf-mode .share-relief-card-ts,
body.share-pdf-mode .share-relief-label,
body.share-pdf-mode .luth-specs-label,
body.share-pdf-mode .luth-photo-label {
  color: #666;
}

body.share-pdf-mode .share-detail-value,
body.share-pdf-mode .share-specs-value,
body.share-pdf-mode .share-note-body,
body.share-pdf-mode .share-pdf-session-title,
body.share-pdf-mode .share-relief-card-title,
body.share-pdf-mode .share-relief-value,
body.share-pdf-mode .luth-note,
body.share-pdf-mode .luth-open,
body.share-pdf-mode .luth-harmonic,
body.share-pdf-mode .luth-delta,
body.share-pdf-mode .luth-saddle {
  color: #171717;
}

body.share-pdf-mode .luth-table-header {
  color: #7a7a7a;
  border-bottom-color: #e1ddd4;
}

body.share-pdf-mode .luth-row {
  border-bottom-color: #efebe3;
}

body.share-pdf-mode .share-pdf-block,
body.share-pdf-mode .share-note-card,
body.share-pdf-mode .luth-photo-card,
body.share-pdf-mode .luth-specs-group,
body.share-pdf-mode .share-relief-card {
  background: #fff;
  border-color: #ddd7cb;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.04);
}

body.share-mode .luth-tab-pane {
  overflow: visible;
  display: block;
}

.share-loading,
.share-error {
  text-align: center;
  padding: 80px 20px;
  color: #aaa;
  font-family: 'Open Sans', sans-serif;
  font-size: 1rem;
}

.share-error {
  color: #e05555;
}

.share-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0 20px;
  border-bottom: 1px solid #222;
  margin-bottom: 0;
  text-align: center;
}

body.share-mode .luth-tabs {
  margin-bottom: 16px;
}

body.share-mode .luth-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0;
}

.share-logo {
  width: 360px;
  height: auto;
}

.share-logo-link {
  display: inline-flex;
  line-height: 0;
}

.share-title {
  margin: 0;
  font-family: 'Open Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: #eee;
}

.share-meta {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  color: #888;
  margin-top: 2px;
}

.share-details {
  margin-bottom: 16px;
}

.share-detail-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 4px 0;
}

.share-detail-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  color: #888;
  min-width: 100px;
  flex-shrink: 0;
}

.share-detail-value {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  color: #ddd;
}

.share-session-row {
  margin: 12px 0;
}

.share-session-name {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  color: #aaa;
}

.share-scale {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.share-relief-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.share-relief-card {
  background: #141414;
  border: 1px solid #242424;
  border-radius: 10px;
  padding: 14px 16px;
}

.share-relief-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.share-relief-card-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ddd;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.share-relief-card-ts {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.76rem;
  color: #888;
}

.share-relief-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.share-relief-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.share-relief-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.share-relief-value {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  color: #ddd;
  line-height: 1.5;
  white-space: pre-wrap;
}

.share-empty {
  text-align: center;
  padding: 40px 16px;
  color: #666;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
}

.share-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 28px 0 8px;
  color: #555;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
}

.share-footer a {
  color: #777;
  text-decoration: none;
}

.share-footer a:hover {
  color: #4af;
}

.share-pdf-actions {
  display: block;
  margin-bottom: 16px;
}

.share-pdf-banner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.share-pdf-banner-kicker {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6f6655;
}

.share-pdf-banner-copy {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  color: #7a7366;
  text-align: right;
}

.share-pdf-print-btn {
  width: 100%;
  border: 1px solid #8f8f8f;
  border-radius: 7px;
  background: #9a9a9a;
  color: #fff;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.82rem;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.share-pdf-print-btn:hover {
  background: #888;
  border-color: #7d7d7d;
  color: #fff;
}

.share-pdf-document {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 52px;
}

.share-pdf-block {
  border: 1px solid #202020;
  border-radius: 10px;
  padding: 16px 18px;
  background: #0d0d0d;
  break-inside: avoid;
}

.share-pdf-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding: 0 2px 18px;
  color: #777;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
}

.share-pdf-footer-page {
  min-width: 56px;
  text-align: right;
}

.share-pdf-section-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a8a8a;
  margin-bottom: 12px;
}

.share-pdf-session+.share-pdf-session {
  margin-top: 14px;
}

.share-pdf-session-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 10px;
}

.share-pdf-session-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.96rem;
  font-weight: 600;
  color: #efefef;
}

.share-pdf-session-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  color: #9a9a9a;
}

.share-pdf-table-header {
  margin-top: 0;
}

.share-pdf-rows,
.share-pdf-block .luth-photos-grid,
.share-pdf-block .luth-notes-list,
.share-pdf-block .luth-specs-group,
.share-pdf-block .share-relief-card {
  break-inside: avoid;
}

body.share-pdf-mode .luth-photos-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

body.share-pdf-mode .luth-photo-card {
  cursor: default;
}

body.share-pdf-mode .luth-photo-card img {
  aspect-ratio: 4 / 3;
  max-height: 180px;
}

@media print {

  html.share-pdf-mode,
  body.share-pdf-mode {
    background: #fff !important;
    color: #111 !important;
  }

  body.share-pdf-mode #luthier-panel {
    max-width: none;
    padding: 0;
  }

  body.share-pdf-mode .share-pdf-actions {
    display: none !important;
  }

  body.share-pdf-mode .share-pdf-banner {
    display: none !important;
  }

  body.share-pdf-mode .share-pdf-document {
    padding-bottom: 0;
  }

  body.share-pdf-mode .share-header {
    border-bottom-color: #d8d8d8;
    padding-top: 0;
  }

  body.share-pdf-mode .share-title,
  body.share-pdf-mode .share-detail-value,
  body.share-pdf-mode .share-specs-value,
  body.share-pdf-mode .share-note-body,
  body.share-pdf-mode .share-pdf-session-title,
  body.share-pdf-mode .share-relief-card-title,
  body.share-pdf-mode .share-relief-value,
  body.share-pdf-mode .luth-note,
  body.share-pdf-mode .luth-open,
  body.share-pdf-mode .luth-harmonic,
  body.share-pdf-mode .luth-delta,
  body.share-pdf-mode .luth-saddle {
    color: #111 !important;
  }

  body.share-pdf-mode .share-meta,
  body.share-pdf-mode .share-detail-label,
  body.share-pdf-mode .share-pdf-section-title,
  body.share-pdf-mode .share-pdf-session-meta,
  body.share-pdf-mode .share-session-name,
  body.share-pdf-mode .share-empty,
  body.share-pdf-mode .share-relief-card-ts,
  body.share-pdf-mode .share-relief-label,
  body.share-pdf-mode .luth-specs-label {
    color: #555 !important;
  }

  body.share-pdf-mode .share-pdf-block,
  body.share-pdf-mode .share-note-card,
  body.share-pdf-mode .luth-photo-card,
  body.share-pdf-mode .luth-specs-group,
  body.share-pdf-mode .share-relief-card {
    background: #fff !important;
    border-color: #d8d8d8 !important;
    box-shadow: none !important;
  }

  body.share-pdf-mode .share-footer,
  body.share-pdf-mode .luth-tabs {
    display: none !important;
  }

  body.share-pdf-mode .share-pdf-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0 18mm 8mm;
    color: #555;
    font-size: 10pt;
  }

  body.share-pdf-mode .share-pdf-footer-page::before {
    content: "Page " counter(page);
  }

  body.share-pdf-mode .luth-table-header,
  body.share-pdf-mode .luth-row {
    break-inside: avoid;
  }
}

@media (max-width: 700px) {
  .share-relief-grid {
    grid-template-columns: 1fr;
  }
}

.share-note-body {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  color: #ddd;
  padding: 8px 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.share-note-card {
  cursor: default;
}

.share-note-card:hover {
  border-color: #333;
}

.share-specs-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.share-specs-value {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  color: #ddd;
}

/* Share popover (luthier mode) */

.share-popover {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: linear-gradient(180deg, #171512 0%, #13110f 100%);
  border: 1px solid #3d3528;
  border-radius: 10px;
  padding: 12px;
  z-index: 1000;
  min-width: 320px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.share-popover-url-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}

.share-popover-url {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  color: #d8c5a1;
  word-break: break-all;
  padding: 10px 12px;
  background: #0f0d0b;
  border: 1px solid #2a241c;
  border-radius: 8px;
  flex: 1;
}

.share-popover-icon-btn {
  align-items: center;
  background: #1f1a14;
  border: 1px solid #4f4330;
  border-radius: 8px;
  color: #c9a45f;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 42px;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.share-popover-actions {
  display: flex;
  gap: 8px;
}

.share-popover-text-btn,
.share-popover-unshare {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #4f4330;
  border-radius: 8px;
  background: #1a1611;
  color: #d2c9bb;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.share-popover-icon-btn:hover,
.share-popover-text-btn:hover {
  background: #2a2218;
  border-color: #c9a45f;
  color: #e1bd78;
}

.share-popover-unshare {
  border-color: #5a4734;
  color: #d7b98d;
}

.share-popover-unshare:hover {
  background: #2d2117;
  border-color: #d3a45d;
  color: #f0cd90;
}

/* ── Upgrade overlay — 3-card pricing ──────────────────────────────── */

.upgrade-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.upgrade-overlay[hidden] {
  display: none !important;
}

.upgrade-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 820px;
  width: 100%;
}

.upgrade-close {
  position: absolute;
  top: -8px;
  right: -4px;
  background: none;
  border: none;
  color: #888;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.15s;
}
.upgrade-close:hover { color: #fff; }

.upgrade-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
  margin: 0;
}

.upgrade-subheading {
  font-size: 0.82rem;
  color: #666;
  margin: -12px 0 0;
}

/* ── Card grid ────────────────────────────────────────────────────── */

.upgrade-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}

.upgrade-card {
  position: relative;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.upgrade-card:hover {
  border-color: #3a3a3a;
}

.upgrade-card.tier-pro {
  border-color: #a0a8b444;
  box-shadow: 0 0 0 1px rgba(160, 168, 180, 0.08), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.upgrade-card.tier-pro:hover {
  border-color: #a0a8b488;
}

.upgrade-card.tier-luthier {
  border-color: #c8a86a44;
  box-shadow: 0 0 0 1px rgba(200, 168, 106, 0.08), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.upgrade-card.tier-luthier:hover {
  border-color: #c8a86a88;
}

/* ── Badge ────────────────────────────────────────────────────────── */

.upgrade-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #a0a8b4;
  color: #111;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ── Card header ──────────────────────────────────────────────────── */

.upgrade-card-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upgrade-tier-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tier-pro .upgrade-tier-name { color: #a0a8b4; }
.tier-luthier .upgrade-tier-name { color: #c8a86a; }

.upgrade-price {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.upgrade-period {
  font-size: 0.78rem;
  color: #666;
}

/* ── Feature list ─────────────────────────────────────────────────── */

.upgrade-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.upgrade-features li {
  font-size: 0.82rem;
  color: #bbb;
  padding-left: 18px;
  position: relative;
  line-height: 1.4;
}

.upgrade-features li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: #5a5;
  font-weight: 700;
  font-size: 0.78rem;
}

.tier-pro .upgrade-features li::before { color: #a0a8b4; }
.tier-luthier .upgrade-features li::before { color: #c8a86a; }

/* ── CTA button ───────────────────────────────────────────────────── */

.upgrade-cta {
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #1a1a1a;
  color: #888;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Open Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.upgrade-cta:disabled {
  cursor: default;
  opacity: 0.6;
}

.upgrade-cta-primary {
  background: #a0a8b4;
  border-color: #a0a8b4;
  color: #111;
}

.upgrade-cta-primary:hover:not(:disabled) {
  background: #b0b8c4;
  border-color: #b0b8c4;
  transform: translateY(-1px);
}

.tier-luthier .upgrade-cta-primary {
  background: #c8a86a;
  border-color: #c8a86a;
}

.tier-luthier .upgrade-cta-primary:hover:not(:disabled) {
  background: #d4b87a;
  border-color: #d4b87a;
}

/* ── Mobile: stack cards ──────────────────────────────────────────── */

@media (max-width: 680px) {
  .upgrade-cards {
    grid-template-columns: 1fr;
    max-width: 340px;
  }
  .upgrade-shell {
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.luth-scroll-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 860px) {
  .luth-relief-grid {
    grid-template-columns: 1fr;
  }

  .luth-relief-field-wide {
    grid-column: auto;
  }
}
