/* Base styling */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  max-width: 900px;
  margin: 30px auto;
  padding: 0 15px 40px;
  background-color: #fefefe;
  color: #222;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1 {
  text-align: center;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
  font-size: 2.4rem;
  margin-top: -10px;
}

h2 {
  text-align: center;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  font-size: 1.6rem;
}

h3 {
  max-width: 356px;
  margin: 0 auto;

  text-align: center;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 50px;
  font-size: 0.7rem;
  margin-top: 50px;
}

p {
  font-size: 1rem;
  color: #555;
  margin-bottom: 20px;
  line-height: 1.8;
}

/* Controls Section */
#controls,
#progressionControls {
  text-align: center;
  margin-bottom: 30px;
}

label {
  font-weight: 600;
  margin-right: 8px;
  color: #555;
}

select {
  font-size: 1rem;
  padding: 6px 10px;
  border: 1.8px solid #ccc;
  border-radius: 6px;
  min-width: 120px;
  transition: border-color 0.3s ease;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: #f9d342;
  box-shadow: 0 0 5px #f9d342aa;
}

button#generateProgressionBtn {
  background-color: #f9d342;
  border: none;
  padding: 10px 22px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  color: #222;
  box-shadow: 0 4px 8px #f9d342cc;
  transition: background-color 0.25s ease;
}

button#generateProgressionBtn:hover,
button#generateProgressionBtn:focus {
  background-color: #d6b931;
  box-shadow: 0 5px 12px #d6b931cc;
  outline: none;
}

/* Progression display */
#progressionDisplay {
  font-size: 1.2rem;
  text-align: center;
  margin-bottom: 30px;
  background: #fff;
  border-radius: 10px;
  padding: 18px 24px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  user-select: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
}

/* Individual chord in progression */
.progression-chord {
  background: #f9d342;
  color: #222;
  font-weight: 700;
  min-width: 75px;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 10px #f9d342cc;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.3s ease;
}

.progression-chord:hover {
  background-color: #d6b931;
  box-shadow: 0 5px 15px #d6b931cc;
}

.progression-degree {
  font-size: 0.85rem;
  color: #444;
  margin-bottom: 6px;
}

/* Chord diagrams container */
#chordContainer {
  margin-top: 10px;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
}

/* Individual chord diagram */
.chord-diagram {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.1);
  padding: 22px 18px 24px;
  user-select: none;
  width: 280px;
  transition: box-shadow 0.3s ease;
}

.chord-diagram:hover {
  box-shadow: 0 10px 30px rgba(249, 211, 66, 0.6);
}

.chord-diagram > strong {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 12px;
  color: #222;
}

/* Piano SVG text styling */
.chord-diagram svg text {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 600;
  user-select: none;
}

/* Scale keyboard container */
#scaleKeyboard {
  text-align: center;
  margin-bottom: 30px;
}

#scaleKeyboard > div {
  display: inline-block;
  user-select: none;
  text-align: center;
}

#scaleKeyboard > div > div {
  margin-top: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: #444;
}

/* Piano keys styles (if using custom div keys instead of SVG) */
.white-key {
  width: 40px;
  height: 160px;
  background: white;
  border: 1px solid #bbb;
  border-radius: 0 0 6px 6px;
  box-shadow: inset 0 -6px 8px -6px rgba(0, 0, 0, 0.15);
  margin: 0 2px 0 2px;
  display: inline-block;
  position: relative;
  cursor: default;
}

.white-key.highlighted {
  background-color: #f9d342;
  box-shadow: 0 0 12px #f9d342aa;
}

.black-key {
  width: 26px;
  height: 100px;
  background: black;
  border-radius: 4px;
  margin: 0 -13px 0 -13px;
  box-shadow: 0 4px 6px #0008;
  position: relative;
  display: inline-block;
  vertical-align: top;
  cursor: default;
}

.black-key.highlighted {
  background-color: #f9d342;
  box-shadow: 0 0 12px #f9d342aa;
  border-color: #f9d342;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  body {
    max-width: 95%;
    padding: 0 10px 30px;
  }
  #chordContainer {
    flex-wrap: wrap; /* allow wrapping */
    flex-direction: row; /* keep row direction */
    justify-content: center; /* center items */
    align-items: flex-start; /* align items at the top */
  }

  .chord-diagram {
    width: 95%;
  }
  #progressionDisplay {
    font-size: 1rem;
  }
  button#generateProgressionBtn {
    width: 100%;
    max-width: 280px;
    margin-top: 12px;
  }
  select {
    min-width: 100px;
    margin-bottom: 8px;
  }
}

#buttonsWrapper {
  text-align: center;
  margin-top: 20px;
}

body.dark {
  background-color: #121212;
  color: #eee;
}

body.dark h1,
body.dark h2,
body.dark h3,
body.dark p,
body.dark label,
body.dark .progression-degree,
body.dark .chord-diagram > strong {
  color: #eee;
}

body.dark #progressionDisplay,
body.dark .chord-diagram {
  background-color: #1e1e1e;
  box-shadow: 0 5px 15px rgba(255, 255, 255, 0.05);
}

body.dark .progression-chord {
  background-color: #333;
  color: #f9d342;
  box-shadow: 0 4px 10px #f9d34255;
}

body.dark .progression-chord:hover {
  background-color: #444;
  box-shadow: 0 5px 15px #f9d342aa;
}

body.dark .white-key {
  background-color: #ddd;
}

body.dark .black-key {
  background-color: #000;
}

.center-wrapper {
  height: 10vh; /* full screen height */
  display: flex;
  justify-content: center;
  align-items: center;
}

.center-wrapper button {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  background-color: #f9d342;
  color: #222;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background-color 0.25s ease;
}

.center-wrapper button:hover {
  background-color: #d6b931;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

#allScaleChordsContainer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
#allScaleChordsContainer > div {
  border: 1px solid #ccc;
  padding: 1rem;
  flex: 1 1 250px;
  background: #fafafa;
}

/* Container for chord diagrams */
.chord-diagram {
  cursor: pointer;
  border: 2px solid #ccc;
  border-radius: 8px;
  padding: 12px;
  margin: 8px;
  background: #fafafa;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  user-select: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  max-width: 280px;
}

.chord-diagram strong {
  display: block;
  margin-bottom: 8px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 600;
  color: #333;
}

.chord-diagram:hover {
  border-color: #f9d342;
  box-shadow: 0 4px 10px rgba(249, 211, 66, 0.5);
  background: #fff8dc;
}

/* Progression chord buttons */
.progression-chord {
  cursor: pointer;
  display: inline-block;
  padding: 10px 14px;
  margin: 6px 6px 6px 0;
  border: 2px solid #bbb;
  border-radius: 6px;
  background: #f5f5f5;
  text-align: center;
  min-width: 60px;
  user-select: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 500;
  color: #444;
}

.progression-chord > div:first-child {
  font-size: 0.85em;
  color: #666;
  margin-bottom: 4px;
}

.progression-chord:hover {
  background-color: #f9d342;
  border-color: #f9d342;
  color: #222;
}

/* Optional: show pressed state */
.progression-chord:active,
.chord-diagram:active {
  transform: scale(0.97);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Make sure SVG fits inside chord diagram */
.chord-diagram svg {
  display: block;
  margin: 0 auto;
  user-select: none;
}

#mute-button {
  padding: 8px 16px;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin: 8px;
  transition: background-color 0.2s ease;
}

#mute-button:hover {
  background-color: #555;
}

:root {
  --card-scale: 1;
}

.chord-card {
  padding: calc(10px * var(--card-scale));
  width: calc(220px * var(--card-scale));
  font-size: calc(14px * var(--card-scale));
  transition: all 0.2s ease;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  box-sizing: border-box;
  display: inline-block;
  text-align: center; /* center content including svg */
}

.chord-card strong {
  font-size: calc(16px * var(--card-scale));
  display: block;
  margin-bottom: calc(6px * var(--card-scale));
}

/* SVG scales with card but no transform scale wrapper */
.chord-card svg {
  width: 90%; /* slightly less than card width to fit nicely */
  height: auto;
  margin: 0 auto; /* center horizontally */
  display: block;
}

.chord-card text {
  font-size: calc(14px * var(--card-scale));
}

/* Remove transform scale on this wrapper */
.scaled-svg-wrapper {
  transform: none;
  display: block;
  margin: 0 auto;
}

/* Responsive adjustments for chord cards */
