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

:root {
  --bg: #0f0f14;
  --surface: #18181f;
  --surface-light: #272732;
  --surface-hover: #2f2f3b;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --accent: #06b6d4;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0,0,0,0.35);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-light: #f1f5f9;
  --surface-hover: #e2e8f0;
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-dark: #4338ca;
  --accent: #0891b2;
  --text: #0f172a;
  --text-muted: #64748b;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --shadow: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-x pan-y;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* Views */
.view {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  animation: fadeIn 0.25s ease;
}
.view.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login */
.login-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 24px;
  min-height: 100%;
}
.login-container img {
  width: 160px;
  height: 160px;
  object-fit: contain;
}
.login-container h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}
.login-container .logo {
  font-size: 4rem;
}
.login-status {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-light);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
}
.login-status.offline {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}
[data-theme="light"] .login-status.offline {
  color: #991b1b;
  background: rgba(220, 38, 38, 0.08);
}
.avatar-initial {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--surface-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 auto;
  text-transform: uppercase;
}
.avatar-edit-label {
  display: inline-flex;
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.avatar-edit-label:hover {
  background: var(--primary-light);
}
.input {
  width: 100%;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-light);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input:hover {
  background: var(--surface-hover);
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
[data-theme="light"] .input:focus {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.btn {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn:not(:disabled):active { transform: translateY(1px); }
.btn:not(:disabled):hover {
  background: var(--primary-light);
  box-shadow: var(--shadow-sm);
}
.btn-secondary {
  background: var(--surface-light);
  color: var(--text);
}
.btn-secondary:not(:disabled):hover {
  background: var(--surface-hover);
}
.btn-danger { background: var(--danger); }
.btn-danger:not(:disabled):hover { background: #f87171; }
.btn-success { background: var(--success); }
.btn-success:not(:disabled):hover { background: #4ade80; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:not(:disabled):hover { background: #22d3ee; }
[data-theme="light"] .btn-accent { color: #fff; }
.btn-full { width: 100%; max-width: 320px; }

/* App Layout */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: max(16px, env(safe-area-inset-top)) 20px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-light);
  z-index: 10;
}
.app-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  letter-spacing: -0.02em;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.app-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}
.app-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0 max(12px, constant(safe-area-inset-bottom));
  padding: 8px 0 max(12px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--surface-light);
  z-index: 10;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.app-nav::-webkit-scrollbar { display: none; }
.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}
.nav-btn.active {
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.1);
}
[data-theme="light"] .nav-btn.active {
  background: rgba(79, 70, 229, 0.08);
}

/* Theme toggle */
.theme-toggle {
  background: var(--surface-light);
  border: 1px solid var(--surface-light);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.theme-toggle:hover {
  background: var(--surface-hover);
}
.theme-toggle:active { transform: translateY(1px); }

/* Search */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.search-bar .input { flex: 1; max-width: none; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--surface-light);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
}
.card:active { transform: scale(0.99); }
.card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
}
.card-title { font-weight: 700; font-size: 1.1rem; margin-bottom: 6px; letter-spacing: -0.01em; }
.card-meta { color: var(--text-muted); font-size: 0.9rem; }
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.card-actions .btn {
  padding: 8px 14px;
  font-size: 0.9rem;
  flex: 1;
}

/* Badges */
.sync-badge,
.meta-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.sync-badge.synced {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}
.sync-badge.local {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}
.meta-badge {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
  margin-left: 6px;
}
[data-theme="light"] .meta-badge {
  color: var(--primary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  backdrop-filter: blur(4px);
}
[data-theme="light"] .modal-overlay {
  background: rgba(0,0,0,0.4);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 16px; }
.modal .input { max-width: none; margin-bottom: 12px; }
.modal .btn-full { max-width: none; margin-top: 8px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Chart tag */
.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface-light);
  font-size: 0.9rem;
  margin-right: 6px;
  margin-top: 6px;
}
.tag.primary {
  background: var(--primary);
  color: white;
}

/* PDF Viewer */
.pdf-viewer {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  display: none;
  flex-direction: column;
}
.pdf-viewer.active { display: flex; }
.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-light);
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  z-index: 3;
}
.pdf-toolbar .btn {
  padding: 8px 14px;
  font-size: 0.95rem;
}
.pdf-title {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: center;
}
.pdf-container {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--bg);
  touch-action: pan-y pinch-zoom;
}
.pdf-container iframe, .pdf-container embed {
  width: 100%;
  height: 100%;
  border: none;
}
.pdf-container canvas {
  transform-origin: top center;
  transition: transform 0.15s ease-out;
}
.pdf-swipe-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: pan-y;
  pointer-events: none;
}
.pdf-container {
  will-change: auto;
}
.pdf-container.animating {
  will-change: transform, opacity;
}
.pdf-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.scroll-speed {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}
.scroll-speed input[type="range"] {
  width: 80px;
}

/* Lyrics-only view */
.lyrics-view {
  padding: 24px 20px max(80px, env(safe-area-inset-bottom));
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  touch-action: pan-y pinch-zoom;
}
.lyrics-view p {
  margin: 0 0 0.6em 0;
}
.lyrics-view .lyrics-section {
  font-weight: 700;
  font-size: 1.15em;
  margin: 0.8em 0 0.2em 0;
  color: var(--text);
}
.lyrics-view .lyrics-section:first-child {
  margin-top: 0;
}
.lyrics-view .lyrics-line {
  margin: 0 0 0.1em 0;
}
.lyrics-view br {
  content: '';
  display: block;
  margin: 0.3em 0;
}

.btn-active {
  background: var(--primary-light);
  color: #fff;
}

/* Empty state */
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}
.empty-icon {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  color: var(--text-muted);
}

/* Set list builder */
.setlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--surface-light);
  box-shadow: var(--shadow);
}
.setlist-item .handle {
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: grab;
}
.setlist-item .info { flex: 1; }
.setlist-item .remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.setlist-item .remove:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Selection list for adding to setlist */
.select-list {
  max-height: 50vh;
  overflow-y: auto;
}
.select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
}
.select-item:hover { background: var(--surface-light); }
.select-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

/* Responsive */
@media (max-width: 400px) {
  .app-header h2 { font-size: 1.25rem; }
  .btn { padding: 12px 18px; }
  .nav-btn { font-size: 0.7rem; padding: 6px 4px; }
  .app-nav { gap: 2px; }
}

@media (max-width: 600px) {
  .header-actions .btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
  .header-actions .theme-toggle {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

/* Form group */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* Chord Chart Viewer */
.chart-viewer {
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
}
@media (max-width: 400px) {
  .chart-viewer { padding: 12px; }
  .chart-chord { font-size: 1.15rem; }
  .chart-lyric-row { font-size: 1.15rem; line-height: 1.55; }
  .chart-section-name { font-size: 1.1rem; }
}
.chart-section {
  margin-bottom: 20px;
}
.chart-section-name {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  margin-bottom: 14px;
  color: var(--text);
}
.chart-pair {
  margin-bottom: 14px;
}
.chart-chord-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  min-height: 24px;
}
.chart-chord {
  font-weight: 700;
  color: var(--primary-light);
  font-size: 1.35rem;
  white-space: nowrap;
}
.chart-lyric-row {
  font-size: 1.3rem;
  line-height: 1.6;
  color: var(--text);
  word-break: normal;
  overflow-wrap: break-word;
}
.chart-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid var(--surface-light);
}
.chart-meta-bar .key-badge {
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 700;
}

/* Key selector */
.key-select {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--surface-light);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

/* Confirm Modal */
.confirm-modal {
  text-align: center;
  padding: 28px 24px;
}
.confirm-modal h3 {
  margin-bottom: 8px;
}
.confirm-modal p {
  color: var(--text-muted);
  margin-bottom: 20px;
}
.confirm-actions {
  display: flex;
  gap: 10px;
}
.confirm-actions .btn {
  flex: 1;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 200;
  pointer-events: none;
  box-shadow: var(--shadow);
  border: 1px solid var(--surface-light);
  max-width: min(90vw, 360px);
  text-align: center;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.update-prompt {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary, #6c5ce7);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 201;
  cursor: pointer;
  box-shadow: var(--shadow);
  max-width: min(90vw, 360px);
  text-align: center;
  pointer-events: none;
}
.update-prompt.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Password show/hide toggle */
.pass-wrap { position: relative; display: flex; width: 100%; max-width: 320px; }
.pass-wrap .input { padding-right: 58px; width: 100%; max-width: none; }
.pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-light);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px;
  transition: background 0.2s, color 0.2s;
}
.pass-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}



/* Slide animations for setlist viewer */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100%); opacity: 0; }
}
@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.slide-in-right { animation: slideInRight 0.3s ease-out forwards; }
.slide-in-left  { animation: slideInLeft  0.3s ease-out forwards; }
.slide-out-right { animation: slideOutRight 0.3s ease-out forwards; }
.slide-out-left  { animation: slideOutLeft  0.3s ease-out forwards; }

.home-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.home-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--surface-light);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.home-tile:hover {
  background: var(--surface-hover);
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.home-tile:active { transform: scale(0.97); }

.nns-scale { display: flex; flex-direction: column; gap: 6px; font-size: 1rem; }
.nns-scale div { padding: 6px 10px; border-radius: 8px; background: var(--surface-light); }
.nns-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: 1rem; }
.nns-grid > div { padding: 10px 4px; border-radius: 8px; background: var(--surface-light); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nns-grid > div.header { background: var(--primary); color: white; font-weight: 600; }
.nns-grid .nns-num { font-size: 1.1rem; font-weight: 700; }
.nns-grid .nns-chord { font-size: 1rem; opacity: 0.9; }

/* Swipe hint arrows */
.swipe-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 3;
}
.swipe-hint.show { opacity: 0.4; }
.swipe-hint-left  { left: 20px; }
.swipe-hint-right { right: 20px; }


/* ===================== TUNER ===================== */
.tuner-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
  overflow-y: auto;
}

.tuner-display {
  position: relative;
  width: min(280px, 70vw);
  height: min(280px, 70vw);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.tuner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 8px solid var(--surface-light);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tuner-ring.in-tune {
  border-color: var(--success);
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
  animation: tunerPulse 1.2s ease-in-out infinite;
}

.tuner-ring.sharp {
  border-color: var(--warning);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.tuner-ring.flat {
  border-color: var(--danger);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

@keyframes tunerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.tuner-needle {
  position: absolute;
  width: 4px;
  height: 42%;
  bottom: 50%;
  left: 50%;
  margin-left: -2px;
  background: linear-gradient(to top, var(--primary), var(--accent));
  border-radius: 2px;
  transform-origin: bottom center;
  transform: rotate(-45deg);
  transition: transform 0.08s ease-out;
  z-index: 2;
}

.tuner-needle::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.tuner-center {
  position: relative;
  z-index: 3;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tuner-note {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.tuner-freq {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.tuner-cents {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 4px;
  min-height: 1.4em;
}

.tuner-controls {
  width: 100%;
  max-width: 360px;
}

.tuner-section {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.tuner-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.tuner-tone-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.tuner-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.tuner-presets .btn {
  padding: 10px 4px;
  font-size: 0.85rem;
}

.tuner-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-light);
  outline: none;
  margin-top: 8px;
}

.tuner-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.tuner-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

@media (max-width: 360px) {
  .tuner-note { font-size: 3rem; }
  .tuner-presets { grid-template-columns: repeat(3, 1fr); }
}
