@font-face {
  font-family: 'Suez One';
  src: url('../Fonts/Cousine,Varela_Round/Suez_One/SuezOne-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --chord-purple: #D23580;
  --font-scale: 1;
  font-family: system-ui, sans-serif;
}

body {
  margin: 0;
  background: #f6f7f9;
  color: #111;
}

.topbar {
  position: sticky;
  top: 0;
  background: white;
  border-bottom: 1px solid #e2e6ea;
  padding: 12px 20px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  min-width: 0;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.left {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.controls {
  display: flex;
  gap: 4px;
}

button {
  padding: 6px 12px;
  border: 1px solid #c9d2db;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

button:hover {
  background: #f0f4f8;
  border-color: #a0aec0;
}

button:active {
  transform: scale(0.98);
}

select {
  padding: 6px 10px;
  border: 1px solid #c9d2db;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  min-width: 0;
  flex: 1;
}

label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #718096;
  white-space: nowrap;
}

label select {
  margin: 0;
}

.edit-link {
  padding: 6px 10px;
  border: 1px solid #c9d2db;
  background: white;
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s;
}

.edit-link:hover {
  background: #f0f4f8;
  border-color: #a0aec0;
}

.mobile-controls {
  display: none;
  background: white;
  border-bottom: 1px solid #e2e6ea;
  padding: 8px 12px;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.mobile-controls .controls {
  display: flex;
  gap: 8px;
}

@media (max-width: 767px) {
  .topbar-right {
    display: none !important;
  }
  
  .mobile-controls {
    display: flex;
  }
  .topbar {
    padding: 4px 6px;
  }
  
  .row {
    gap: 4px;
    flex-wrap: nowrap;
  }
  
  .left {
    gap: 0;
    flex: 1 1 100px;
    min-width: 0;
  }
  
  .right {
    gap: 2px;
    flex-shrink: 0;
  }
  
  .controls {
    gap: 2px;
  }
  
  button {
    padding: 2px 4px;
    font-size: 10px;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  
  select {
    padding: 3px 4px;
    font-size: 11px;
    max-width: 100%;
  }
  
  label {
    font-size: 10px;
    gap: 2px;
    flex: 1;
    min-width: 0;
  }
  
  .edit-link {
    padding: 3px 6px;
    font-size: 10px;
    flex-shrink: 0;
  }
  
  .mobile-controls {
    padding: 6px 6px;
  }
  
  .mobile-controls .controls {
    gap: 2px;
  }
  
  .mobile-controls button {
    padding: 2px 4px;
    font-size: 10px;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .mobile-controls .edit-link {
    padding: 3px 6px;
    font-size: 10px;
  }
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
}

.metadata-panel {
  background: white;
  border: 1px solid #e2e6ea;
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.meta-title {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 700;
  color: #1a202c;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 16px;
  margin-bottom: 12px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 12px;
  font-weight: 600;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 16px;
  color: #2d3748;
  font-weight: 500;
}

.meta-value.clickable.has-tempo {
  cursor: pointer;
  transition: color 0.2s, transform 0.1s;
  user-select: none;
}

.meta-value.clickable.has-tempo:hover {
  color: var(--chord-purple);
}

.meta-value.clickable.has-tempo:active {
  transform: scale(0.95);
}

.meta-value.metronome-active {
  color: var(--chord-purple);
  font-weight: 700;
  animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.meta-links {
  display: flex;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e6ea;
}

.link-button {
  padding: 6px 14px;
  border: 1px solid #c9d2db;
  background: white;
  border-radius: 8px;
  text-decoration: none;
  color: #2d3748;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.link-button:hover {
  background: #f0f4f8;
  border-color: var(--chord-purple);
  color: var(--chord-purple);
}

.preview-container {
  background: white;
  border: 1px solid #e2e6ea;
  border-radius: 12px;
  padding: 40px 24px 40px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  overflow: visible;
}

.preview {
  overflow: visible;
  column-gap: 24px;
  column-rule: 1px solid #e2e6ea;
}

.preview.col-1 { column-count: 1; column-rule: none; }
.preview.col-2 { column-count: 2; }
.preview.col-3 { column-count: 3; }
.preview.col-4 { column-count: 4; }
.preview.col-5 { column-count: 5; }
.preview.col-6 { column-count: 6; }

.preview.rtl { direction: rtl; }
.preview.ltr { direction: ltr; }

/* Song line layout */
.song-line {
  margin-bottom: 9px;
  position: relative;
  break-inside: avoid;
}

/* container for one-or-more chords attached to a lyric character */
.chords {
  position: absolute;
  bottom: 65%; /* visually ~1px above lyrics (tuned via inspector) */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  white-space: nowrap;
  pointer-events: auto;
  z-index: 2;
}

/* Pointer slashes - RTL uses /, LTR uses \ */
.preview.rtl .chords::after {
  content: '/';
  font-size: 0.315em;
  color: var(--chord-purple);
  line-height: 1;
  margin-top: -3px;
  font-family: 'Suez One', serif;
  font-weight: 900;
  -webkit-text-stroke: 1px var(--chord-purple);
  text-stroke: 1px var(--chord-purple);
  transform: scaleX(1.3);
}

.preview.ltr .chords::after {
  content: '\\';
  font-size: 0.315em;
  color: var(--chord-purple);
  line-height: 1;
  margin-top: -3px;
  font-family: 'Suez One', serif;
  font-weight: 900;
  -webkit-text-stroke: 1px var(--chord-purple);
  text-stroke: 1px var(--chord-purple);
  transform: scaleX(1.3);
}

.ch {
  font-weight: 400;
  color: var(--chord-purple);
  direction: ltr; /* chord symbols always LTR */
  white-space: nowrap;
  font-size: 0.76em;
  line-height: 1;
  font-family: 'Suez One', serif;
}

/* Lyrics with per-char spans for insertion mapping */
.lyrics {
  font-size: calc(18px * var(--font-scale));
  line-height: 1.2; /* compact line spacing to reduce vertical gaps */
  white-space: pre-wrap;
  font-weight: 600;
  color: #000;
  font-family: 'Suez One', serif;
  padding-top: 0px;
}

.lyr-ch {
  display: inline-block;
  position: relative;
}

/* Hide placeholders in view mode */
.chord-placeholder {
  display: none;
}
