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

/* ── Tool card ── */
.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 (identical to kalimba) ── */
.mode-btn {
  padding: 5px 14px;
  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;
}
.mode-btn.active {
  background: #fff;
  color: #065f46;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ── Fullscreen button (identical to kalimba) ── */
.fullscreen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.fullscreen-btn:hover { background: #fff; color: #065f46; border-color: #6ee7b7; }
.fullscreen-btn svg { width: 15px; height: 15px; pointer-events: none; }

/* ── Layout: circle left, info panel right ── */
.cof-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 680px) {
  .cof-layout { grid-template-columns: 1fr; }
}

/* ── Circle wrap ── */
.cof-circle-wrap { width: 100%; }
#cofSvg {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
}

/* ── SVG segment styles (applied via JS classList) ── */
.cof-seg-major {
  fill: #e1f5ee;
  stroke: #0f6e56;
  stroke-width: 0.8;
  transition: fill 0.15s;
  cursor: pointer;
}
.cof-seg-major:hover { fill: #9fe1cb; }
.cof-seg-major.selected { fill: #1d9e75; }
.cof-seg-major.neighbour { fill: #9fe1cb; }
.cof-seg-major.enharmonic { fill: #c0dd97; }
.cof-seg-major.enharmonic.selected { fill: #639922; }

.cof-seg-minor {
  fill: #eeedfe;
  stroke: #534ab7;
  stroke-width: 0.8;
  transition: fill 0.15s;
  cursor: pointer;
}
.cof-seg-minor:hover { fill: #cecbf6; }
.cof-seg-minor.selected { fill: #7f77dd; }
.cof-seg-minor.neighbour { fill: #cecbf6; }

.cof-label-major {
  font-size: 16px;
  font-weight: 700;
  fill: #085041;
  pointer-events: none;
  font-family: Inter, sans-serif;
}
.cof-label-major.selected { fill: #fff; }
.cof-label-minor {
  font-size: 11px;
  font-weight: 600;
  fill: #3c3489;
  pointer-events: none;
  font-family: Inter, sans-serif;
}
.cof-label-minor.selected { fill: #fff; }

/* ── Info panel ── */
.cof-info-panel {
  min-height: 300px;
  display: flex;
  flex-direction: column;
}
.cof-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 300px;
  gap: 12px;
}
.cof-empty-icon {
  font-size: 3rem;
  color: #d1d5db;
  line-height: 1;
}

/* ── Key header ── */
.cof-key-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f3f4f6;
}
.cof-key-name {
  font-size: 2.2rem;
  font-weight: 700;
  color: #065f46;
  line-height: 1;
}
.cof-key-sub {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 4px;
}
.cof-key-badges { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.cof-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.cof-badge:hover { opacity: 0.75; }
.cof-badge-rel { background: #eeedfe; color: #3c3489; }
.cof-badge-par { background: #faeeda; color: #633806; }

/* ── Key signature symbols ── */
.cof-sig-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  min-height: 28px;
}
.cof-sig-symbol {
  font-size: 1.1rem;
  font-weight: 700;
  color: #374151;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  padding: 2px 7px;
  line-height: 1.4;
}
.cof-sig-none {
  font-size: 0.75rem;
  color: #9ca3af;
  font-style: italic;
}

/* ── Section label ── */
.cof-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* ── Diatonic chords grid ── */
.cof-chords-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (max-width: 400px) {
  .cof-chords-grid { grid-template-columns: repeat(3, 1fr); }
}
.cof-chord-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  padding: 8px 4px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.07s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.cof-chord-btn:hover { background: #f0fdf4; border-color: #6ee7b7; }
.cof-chord-btn:active { transform: scale(0.95); }
.cof-chord-btn.playing { background: #d1fae5; border-color: #059669; }
.cof-chord-btn.in-prog { background: #fffbeb; border-color: #f59e0b; }
.cof-chord-numeral {
  font-size: 0.6rem;
  font-weight: 700;
  color: #9ca3af;
  line-height: 1;
}
.cof-chord-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
  text-align: center;
}
.cof-chord-type {
  font-size: 0.58rem;
  color: #6b7280;
  line-height: 1;
}

/* ── Neighbours ── */
.cof-neighbours { display: flex; gap: 8px; flex-wrap: wrap; }
.cof-neighbour-btn {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #065f46;
  cursor: pointer;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.cof-neighbour-btn:hover { background: #f0fdf4; border-color: #6ee7b7; }

/* ── Progression builder ── */
.cof-prog-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #f3f4f6;
}
.cof-prog-controls { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.cof-prog-slots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-height: 42px;
  align-items: center;
}
.cof-prog-empty-msg {
  font-size: 0.72rem;
  color: #d1d5db;
  font-style: italic;
}
.cof-prog-slot {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #92400e;
  animation: slotPop 0.15s ease-out;
}
@keyframes slotPop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.cof-prog-slot-del {
  background: none; border: none; color: #f59e0b; cursor: pointer;
  font-size: 0.8rem; padding: 0 2px; line-height: 1;
}
.cof-prog-slot-del:hover { color: #dc2626; }
.cof-prog-slot.playing { background: #d1fae5; border-color: #059669; color: #065f46; }

.cof-prog-btn {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.cof-prog-play { background: #065f46; color: #fff; border-color: #065f46; }
.cof-prog-play:hover:not(:disabled) { background: #047857; }
.cof-prog-play:disabled { opacity: 0.4; cursor: not-allowed; }
.cof-prog-clear { background: #f9fafb; color: #374151; }
.cof-prog-clear:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }

/* ── Preset buttons ── */
.cof-preset-btn {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.cof-preset-btn:hover { background: #f0fdf4; border-color: #6ee7b7; color: #065f46; }
.cof-preset-tag {
  background: #e5e7eb;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #6b7280;
}

/* ── Reference table stripes ── */
tbody tr:nth-child(even) { background: #f9fafb; }

/* ── Fullscreen mode (identical to kalimba) ── */
.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;
}

/* ── Share button — distinct, clearly clickable ── */
.cof-share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #065f46;
  background: #f0fdf4;
  border: 1px solid #6ee7b7;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.cof-share-btn:hover { background: #d1fae5; border-color: #059669; }
@media (max-width: 639px) {
  .cof-chords-grid { grid-template-columns: repeat(4, 1fr); }
  .cof-key-name { font-size: 1.8rem; }
}

/* ── Export section ── */
.cof-export-section {
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
}
.cof-export-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #065f46;
  background: #f0fdf4;
  border: 1px solid #6ee7b7;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.cof-export-btn:hover:not(:disabled) { background: #d1fae5; border-color: #059669; }
.cof-export-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cof-export-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.cof-export-tag {
  background: #d1fae5;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #065f46;
}
.cof-export-btn:disabled .cof-export-tag {
  background: #e5e7eb;
  color: #9ca3af;
}

/* ── Print styles ── */
@media print {
  body * { visibility: hidden !important; }
  #cof-print-area, #cof-print-area * { visibility: visible !important; }
  #cof-print-area {
    position: fixed !important;
    inset: 0 !important;
    padding: 24px !important;
    background: #fff !important;
    z-index: 99999 !important;
  }
}
