body { font-family: Inter, sans-serif; }

.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 3px 12px rgba(0,0,0,.04);
}

/* ── Mode buttons ── */
.mode-btn {
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.mode-btn.active {
  background: #fff;
  color: #92400e;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ── Drawbar section ── */
.drawbar-section {
  background: linear-gradient(180deg, #1a1008 0%, #0d0800 100%);
  border-radius: 0.75rem;
  padding: 14px 16px 10px;
  margin-bottom: 16px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.15);
}

.drawbar-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.drawbar-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,200,80,0.7);
}
.drawbar-presets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.drawbar-preset-btn {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid rgba(255,180,50,0.25);
  background: rgba(255,150,30,0.08);
  color: rgba(255,180,80,0.65);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.drawbar-preset-btn:hover,
.drawbar-preset-btn.active {
  background: rgba(255,160,40,0.22);
  color: rgba(255,210,100,1);
  border-color: rgba(255,160,40,0.5);
}

/* ── Drawbars row ── */
.drawbars-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: flex-end;
  padding: 4px 0 2px;
}
.drawbar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.drawbar-track {
  width: 18px;
  height: 80px;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  border: 1px solid rgba(255,150,40,0.2);
  position: relative;
  cursor: pointer;
  touch-action: none;
}
/* Colour coding: brown = 16'&8', white = quint/octave, black = upper harmonics */
.drawbar-track.col-brown { border-color: rgba(180,100,40,0.5); }
.drawbar-track.col-white { border-color: rgba(200,200,200,0.4); }
.drawbar-track.col-black { border-color: rgba(80,80,80,0.7); }

.drawbar-handle {
  position: absolute;
  left: 1px; right: 1px;
  height: 20px;
  border-radius: 3px;
  cursor: grab;
  transition: filter 0.1s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.drawbar-handle:active { cursor: grabbing; }
.drawbar-handle.col-brown { background: linear-gradient(180deg, #c07830 0%, #8b5010 100%); }
.drawbar-handle.col-white { background: linear-gradient(180deg, #f0f0f0 0%, #c0c0c0 100%); }
.drawbar-handle.col-black { background: linear-gradient(180deg, #444 0%, #222 100%); }

.drawbar-value {
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255,200,80,0.7);
  font-variant-numeric: tabular-nums;
  min-width: 14px;
  text-align: center;
}

.drawbar-names-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}
.drawbar-footage {
  font-size: 0.55rem;
  color: rgba(255,180,60,0.5);
  text-align: center;
  width: 18px;
  white-space: nowrap;
}

/* ── Organ keyboard ── */
.organ-keyboard-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  margin: 0 -4px;
}
.organ-keyboard {
  display: flex;
  position: relative;
  height: 130px;
  min-width: max-content;
  padding: 0 4px;
  user-select: none;
}

/* ── White keys ── */
.org-key-white {
  position: relative;
  width: 42px;
  height: 130px;
  background: linear-gradient(180deg, #f8f8f8 0%, #e8e8e8 85%, #d0d0d0 100%);
  border: 1px solid #bbb;
  border-top: none;
  border-radius: 0 0 5px 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
  flex-shrink: 0;
  transition: background 0.05s, transform 0.05s;
  box-shadow: 2px 4px 8px rgba(0,0,0,0.2), inset 0 -2px 4px rgba(0,0,0,0.05);
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.org-key-white:hover {
  background: linear-gradient(180deg, #fff 0%, #f0f0f0 85%, #ddd 100%);
}
.org-key-white.active {
  background: linear-gradient(180deg, #fde68a 0%, #fbbf24 85%, #d97706 100%);
  transform: translateY(2px);
  box-shadow: 1px 2px 4px rgba(0,0,0,0.2);
}
.org-key-label {
  font-size: 9px;
  font-weight: 700;
  color: #6b7280;
  line-height: 1;
}
.org-key-white.active .org-key-label { color: #92400e; }
.org-key-kb {
  font-size: 7px;
  color: #9ca3af;
  margin-top: 2px;
  font-family: monospace;
}

/* ── Black keys ── */
.org-key-black {
  position: absolute;
  width: 26px;
  height: 80px;
  background: linear-gradient(180deg, #333 0%, #111 100%);
  border-radius: 0 0 4px 4px;
  cursor: pointer;
  z-index: 2;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 5px;
  box-shadow: 2px 4px 8px rgba(0,0,0,0.5), inset 0 -2px 3px rgba(255,255,255,0.05);
  transition: background 0.05s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.org-key-black:hover {
  background: linear-gradient(180deg, #444 0%, #1a1a1a 100%);
}
.org-key-black.active {
  background: linear-gradient(180deg, #92400e 0%, #78350f 100%);
  transform: translateY(2px);
  box-shadow: 1px 2px 4px rgba(0,0,0,0.5);
}
.org-key-black .org-key-label { color: rgba(255,255,255,0.4); }
.org-key-black .org-key-kb    { color: rgba(255,255,255,0.45); }
.org-key-black.active .org-key-label { color: rgba(255,220,100,0.9); }

/* ── Active notes display ── */
.active-notes-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.active-notes-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.active-notes-display {
  font-size: 0.78rem;
  font-weight: 700;
  color: #92400e;
  min-width: 60px;
}
.sustain-hint {
  font-size: 0.65rem;
  color: #d1d5db;
  font-style: italic;
  margin-left: auto;
}

/* ── Chord preset buttons ── */
.chord-preset-btn {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.chord-preset-btn:hover { background: #fef3c7; border-color: #fbbf24; }
.chord-preset-btn.active { background: #fbbf24; color: #78350f; border-color: #f59e0b; }

/* ── Fullscreen ── */
.tool-card.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100dvh !important;
  overflow-y: auto !important;
  margin: 0 !important;
  padding: 1.5rem !important;
  box-sizing: border-box !important;
}

tbody tr:nth-child(even) { background: #f9fafb; }

@media (max-width: 480px) {
  .org-key-white { width: 34px; height: 110px; }
  .org-key-black { width: 22px; height: 66px; }
  .drawbars-row  { gap: 6px; }
  .drawbar-track { width: 15px; }
  .drawbar-footage { width: 15px; }
}
