:root {
  --white: #ffffff;
  --light-shadow: #f0f0f0;
  --dark-shadow: #b8b8b8;
  --black: #111111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--white);
  color: #222;
}

.top-header {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid #e5e5e5;
  background: linear-gradient(to bottom, #ffffff, #fbfbfb);
}

.top-header h1 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 72px);
}

.sidebar {
  border-right: 1px solid #ececec;
  background: repeating-linear-gradient(
    to bottom,
    #ffffff,
    #ffffff 40px,
    #fcfcfc 40px,
    #fcfcfc 80px
  );
  padding: 28px 20px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.piano-key {
  appearance: none;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font-size: 1.05rem;
  text-align: left;
  padding: 22px 18px;
  min-height: 96px;
  width: 100%;
  cursor: pointer;
  position: relative;
  margin: 0;
}

.piano-key + .piano-key {
  border-top: 0;
}

.piano-key:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 100%;
  transform: translateY(-50%);
  width: 33.33%;
  height: 50%;
  background: #000;
  pointer-events: none;
  z-index: 2;
}

.piano-key:hover {
  background: #f8f8f8;
}

.piano-key:active {
  background: #efefef;
}

.content {
  padding: 36px;
  background: radial-gradient(circle at top right, #ffffff 10%, #f9f9f9 90%);
}

.screen-panel,
.new-song-section,
.song-form-wrapper {
  max-width: 680px;
  padding: 28px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #ededed;
  box-shadow:
    10px 10px 20px #d1d1d1,
    -10px -10px 20px #ffffff;
  margin-bottom: 24px;
}

.new-song-section {
  text-align: center;
}

.empty-text {
  margin: 0;
  min-height: 24px;
}

.emoji-song-button {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid #d7d7d7;
  background: linear-gradient(145deg, #ffffff, #f2f2f2);
  font-size: 2.2rem;
  cursor: pointer;
  box-shadow:
    8px 8px 16px #cfcfcf,
    -8px -8px 16px #ffffff;
  transition: transform 0.2s ease;
}

.emoji-song-button:hover {
  transform: scale(1.05);
}

.song-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.song-form input,
.song-form textarea {
  width: 100%;
  border: 1px solid #d7d7d7;
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
}

.submit-song {
  margin-top: 8px;
  border: 1px solid #222;
  border-radius: 10px;
  background: #111;
  color: #fff;
  padding: 12px 16px;
  font-size: 1rem;
  cursor: pointer;
}

.songbook-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.song-card {
  border: 1px solid #e4e4e4;
  border-radius: 12px;
  padding: 14px;
  background: #fbfbfb;
  box-shadow: 5px 5px 10px #e0e0e0;
  cursor: pointer;
}

.song-context-menu {
  position: absolute;
  z-index: 1200;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  min-width: 180px;
  overflow: hidden;
}

.song-context-menu button {
  border: 0;
  background: #fff;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
}

.song-context-menu button:hover {
  background: #f2f2f2;
}

.song-card h4 {
  margin: 0 0 6px;
}

.song-card p {
  margin: 0;
  color: #555;
}

.song-detail-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.song-detail-panel {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 14px;
  padding: 24px;
  background: #fff;
  border: 1px solid #e6e6e6;
}

.close-song-detail {
  border: 1px solid #222;
  border-radius: 10px;
  background: #111;
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
}

.song-detail-artist {
  color: #666;
  margin-top: 4px;
}

.song-detail-lyrics {
  margin: 16px 0 0;
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.45;
}

.hidden {
  display: none;
}

.confirm-modal.hidden {
  display: none;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1300;
  padding: 20px;
}

.confirm-panel {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  padding: 20px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #ececec;
  }
}

.song-detail {
  margin-top: 20px;
  border-top: 1px solid #ececec;
  padding-top: 16px;
}

.detail-artist {
  margin-top: -8px;
  color: #666;
}

.chord-picker {
  margin: 12px 0;
}

.chord-picker input {
  width: 100%;
  border: 1px solid #d7d7d7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 6px;
}

.chord-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  max-height: 180px;
  overflow: auto;
}

.chord-chip {
  border: 1px solid #cacaca;
  background: #fff;
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
}

.chord-chip:hover {
  background: #111;
  color: #fff;
}

.lyrics-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lyrics-editor-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.lyrics-token {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  cursor: pointer;
  gap: 4px;
}

.token-chord {
  min-height: 16px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #173cad;
  display: block;
  line-height: 1;
  padding: 0;
  border: 0;
  background: transparent;
}

.detail-help {
  color: #666;
  font-size: 0.95rem;
}


.song-detail-chord-workspace {
  margin-top: 12px;
  position: relative;
}

.lyrics-editor {
  gap: 16px;
}

.chord-editor-panel {
  position: absolute;
  z-index: 4;
  width: 250px;
  border: 1px solid #e4e4e4;
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
  margin: 8px 0 14px;
  display: grid;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}


.chord-editor-panel.hidden {
  display: none;
}
.chord-editor-row {
  display: grid;
  gap: 2px;
}

.chord-editor-row label {
  font-size: 0.88rem;
}

.chord-editor-row select {
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.92rem;
}

#save-token-chord.submit-song {
  margin-top: 2px;
  padding: 8px 10px;
  font-size: 0.92rem;
}

.detail-help {
  margin: 10px 0;
  color: #555;
}

.sections-editor {
  margin-top: 10px;
}

.sections-type-picker {
  margin-top: 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 12px;
}

.sections-type-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sections-type-actions button {
  border: 1px solid #aaa;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.song-detail-lyrics {
  display: grid;
  gap: 10px;
}

.lyrics-section-card {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffffff;
}

.lyrics-section-card p {
  margin: 0;
  line-height: 1.5;
}

.lyrics-section-card p + p {
  margin-top: 4px;
}

.section-introduccion {
  background: #bdf5c0;
}

.section-estrofa {
  background: #c8deff;
}

.section-estribillo {
  background: #ffc9c9;
}

.section-puente {
  background: #fff2a8;
}
