@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #242424;
  --muted: #777777;
  --line: #dddddd;
  --dark: #2c2c2c;
  --soft: #f5f5f5;
  --chord-bg: #e9e9e9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 16px 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.song-topbar { gap: 10px; }

.search-wrap {
  position: relative;
  flex: 1;
}

.search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 42px 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.search-wrap input::placeholder { color: #b4b4b4; }

.search-icon {
  position: absolute;
  right: 15px;
  top: 7px;
  font-size: 24px;
  color: #111;
}

.icon-button,
.back-button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 34px;
  line-height: 40px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.back-button {
  font-size: 34px;
  font-weight: 500;
}

.category-panel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 12px;
}

.category-panel.hidden,
.song-search-results.hidden { display: none; }

.category-chip {
  border: 0;
  border-radius: 10px;
  background: var(--soft);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  white-space: nowrap;
}

.category-chip.active {
  background: var(--dark);
  color: white;
}

.song-search-results {
  position: sticky;
  top: 76px;
  z-index: 19;
  margin: 0 16px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.result-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid #eee;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}

.result-item:last-child { border-bottom: 0; }
.result-item.muted { color: var(--muted); }

.home-main { padding: 10px 16px 40px; }

#status {
  color: var(--muted);
  margin: 8px 0;
}

.song-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-card,
.empty-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  margin-bottom: 24px;
  padding: 0;
  overflow: hidden;
}

.card-link {
  display: block;
  padding: 24px;
  color: inherit;
  text-decoration: none;
}

.home-card h2 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
}

.home-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.35;
}

.home-card span {
  display: inline-block;
  background: var(--dark);
  color: white;
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 16px;
  line-height: 1;
}

.song-main { padding: 10px 16px 40px; }

.song-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 24px;
  min-height: calc(100vh - 120px);
}

.song-card h1 {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
}

.transpose-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.transpose-status strong { color: var(--text); }

.transpose-status button {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}

.transpose-status button:disabled { opacity: 0.35; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.controls button {
  border: 0;
  border-radius: 7px;
  background: var(--dark);
  color: white;
  padding: 10px 13px;
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
}

.scroll-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.play-button {
  width: 45px;
  height: 45px;
  border-radius: 999px;
  border: 0;
  background: var(--dark);
  color: white;
  font-size: 24px;
  line-height: 1;
}

.scroll-row select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  background: white;
  color: var(--text);
  font-size: 16px;
}

.song-content {
  color: #727272;
  line-height: 1.85;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin-bottom: 80px;
  overflow-x: hidden;
}

.song-line {
  margin-bottom: 16px;
  line-height: 1.45;
}

.song-part {
  display: inline-block;
  vertical-align: bottom;
  margin-right: 2px;
}

.chord {
  display: inline-block;
  width: fit-content;
  color: #333;
  background: var(--chord-bg);
  border-radius: 6px;
  padding: 2px 6px;
  font-weight: 600;
  font-size: 0.78em;
  min-height: 1.2em;
  line-height: 1.1;
  margin-bottom: 2px;
}

.chord:empty { visibility: hidden; }

.lyric {
  display: block;
  white-space: pre-wrap;
}

@media (min-width: 700px) {
  body {
    max-width: 520px;
    margin: 0 auto;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
    min-height: 100vh;
  }
}

@media (max-width: 390px) {
  .topbar {
    padding-left: 12px;
    padding-right: 12px;
    gap: 8px;
  }

  .home-main,
  .song-main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .song-card,
  .card-link {
    padding: 20px;
  }

  .controls button {
    font-size: 15px;
    padding: 9px 11px;
  }
}
