:root {
  color-scheme: light;
  --bg: #f5f1e9;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --text: #22211d;
  --muted: #66645e;
  --line: #ded7c9;
  --accent: #1d766f;
  --accent-dark: #12544f;
  --accent-soft: #dcefeb;
  --ink: #262f36;
  --shadow: 0 18px 55px rgba(34, 33, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.app-shell.locked {
  display: none;
}

.password-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.password-screen.unlocked {
  display: none;
}

.password-card {
  width: min(100%, 480px);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
  display: grid;
  gap: 14px;
  text-align: center;
}

.password-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
}

.password-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  padding: 0 14px;
  outline: none;
}

.password-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 118, 111, 0.16);
}

.password-error {
  min-height: 20px;
  color: #9a2d20;
  font-size: 13px;
  font-weight: 800;
}

.topbar {
  background: #ece4d4;
  border-bottom: 1px solid var(--line);
  padding: 22px 28px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
}

.brand {
  display: grid;
  gap: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.subtitle {
  color: var(--muted);
  line-height: 1.45;
  font-size: 15px;
}

.tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.tab-button,
.button {
  appearance: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  padding: 12px 16px;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.tab-button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}

.tab-button:hover,
.tab-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.button {
  background: var(--accent);
  color: white;
}

.button:hover {
  background: var(--accent-dark);
}

.button:active,
.tab-button:active {
  transform: translateY(1px);
}

.main {
  padding: 28px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.welcome-layout {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
  text-align: center;
}

.welcome-copy {
  max-width: 720px;
  display: grid;
  gap: 18px;
}

.welcome-copy h2 {
  font-size: 56px;
  line-height: 1;
  letter-spacing: 0;
}

.welcome-copy p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.65;
  font-size: 18px;
}

.welcome-copy .button {
  justify-self: center;
}

.home-layout {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 1.1fr);
  gap: 30px;
  align-items: center;
}

.home-cover {
  width: 100%;
  max-height: 640px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: #ded7c9;
}

.home-copy {
  display: grid;
  gap: 16px;
  max-width: 680px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-copy h2 {
  font-size: 52px;
  line-height: 1;
  letter-spacing: 0;
}

.home-copy p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.65;
  font-size: 17px;
}

.add-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.upload-panel,
.details-panel,
.player,
.library {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.upload-panel,
.details-panel,
.player {
  padding: 18px;
}

.upload-panel {
  display: grid;
  gap: 16px;
}

.drop-zone {
  min-height: 230px;
  border: 2px dashed #9fb6aa;
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 24px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.upload-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 28px;
  font-weight: 700;
}

.drop-title {
  font-weight: 800;
  font-size: 18px;
}

.drop-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

input[type="file"].cover-input {
  position: static;
  width: 100%;
  height: auto;
  opacity: 1;
  pointer-events: auto;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.stat-value {
  display: block;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.stat-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.save-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
  padding: 11px 12px;
}

.library-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.search {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  padding: 0 14px;
  outline: none;
}

.search:focus,
.text-field:focus,
.text-area:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 118, 111, 0.16);
}

.clear {
  background: var(--ink);
}

.clear:hover {
  background: #11171b;
}

.player {
  margin-bottom: 18px;
  display: grid;
  gap: 12px;
}

.now-playing {
  min-height: 24px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

audio {
  width: 100%;
}

.details-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  line-height: 1.45;
  padding: 24px;
}

.details-empty strong,
.empty strong {
  display: block;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 18px;
}

.details-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
}

.cover-box {
  display: grid;
  gap: 12px;
  align-content: start;
}

.cover-preview {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ece4d4;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-form {
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row label,
.form-row span {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.text-field,
.text-area {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  padding: 11px 12px;
  outline: none;
}

.text-area {
  min-height: 86px;
  resize: vertical;
}

.lyrics-area {
  min-height: 150px;
}

.details-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.library {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.song {
  min-height: 72px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}

.song:hover,
.song.active {
  border-color: var(--accent);
  background: #f7fffd;
}

.play-button {
  appearance: none;
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
  flex: 0 0 auto;
  cursor: pointer;
  font: inherit;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.play-button:hover {
  background: var(--accent);
  color: white;
}

.play-button:active {
  transform: scale(0.96);
}

.song-name {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.song-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.song-index {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .topbar,
  .home-layout,
  .add-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    width: 100%;
  }

  .tab-button {
    flex: 1 1 140px;
  }

  .home-layout {
    min-height: auto;
    align-items: start;
  }

  .home-cover {
    max-height: 520px;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .cover-preview {
    max-width: 280px;
  }
}

@media (max-width: 560px) {
  .topbar,
  .main {
    padding: 18px;
  }

  h1 {
    font-size: 30px;
  }

  .home-copy h2 {
    font-size: 38px;
  }

  .welcome-copy h2 {
    font-size: 40px;
  }

  .library-header,
  .stats {
    grid-template-columns: 1fr;
  }

  .song {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .song-index {
    grid-column: 2;
  }
}
