:root {
  --cream: #fff4e6;
  --ink: #3d2a1c;
  --peach: #ff7a45;
  --grape: #7b61ff;
  --muted: #e8a07a;
  --card: #fff;
  --line: #ffe0c2;
  color-scheme: light;
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: ui-rounded, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  padding-bottom: env(safe-area-inset-bottom);
  overscroll-behavior-y: none;
}

.has-player {
  padding-bottom: calc(18rem + env(safe-area-inset-bottom));
}

.chrome { transition: transform 200ms ease; }
.chrome-up { transform: translateY(-100%); }
.chrome-down { transform: translateY(100%); }

.pull-refresh {
  position: fixed;
  z-index: 50;
  top: calc(env(safe-area-inset-top) + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--card);
  color: var(--peach);
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 1px 2px rgb(61 42 28 / 8%);
}

button, input { font: inherit; color: inherit; }

button {
  border: 0;
  cursor: pointer;
  min-height: 3rem;
  border-radius: 1rem;
  background: var(--card);
  box-shadow: 0 1px 2px rgb(61 42 28 / 8%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff4e6;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner, .wrap, .player-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.topbar-inner, .row, .track, .player-main, .seek-row, .volume-row, .crumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-right: auto;
  background: transparent;
  box-shadow: none;
  font-size: 1.5rem;
  font-weight: 800;
  min-height: 3rem;
}

.logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.65rem;
}

.bar-btn { padding: 0 0.9rem; font-weight: 800; }
.bar-btn.on { background: var(--grape); color: white; }
.peach { background: var(--peach); color: white; }

.wrap { padding-top: 1.5rem; padding-bottom: 1.5rem; }

.crumbs { font-size: 1.15rem; font-weight: 800; margin-bottom: 1.5rem; }
.crumbs button { background: transparent; box-shadow: none; min-height: 2.5rem; }
.peach-text { color: var(--peach); }
.sep { color: #ffd0b0; }

.notice {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  background: #ffe4cc;
}

.muted { color: var(--muted); font-size: 1.25rem; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 640px) {
  .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .album-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.album {
  display: block;
  text-align: left;
  padding: 0.75rem;
  border-radius: 1.5rem;
  min-height: 7rem;
}

.cover, .cover-lg, .ph {
  border-radius: 1rem;
  background: #fff1e4;
  overflow: hidden;
}

.cover { width: 4rem; height: 4rem; flex: none; }
.cover-lg { aspect-ratio: 1; margin-bottom: 0.75rem; }
.cover img, .cover-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph { display: grid; place-items: center; width: 100%; height: 100%; font-size: 1.5rem; }
.cover-lg .ph { min-height: 6rem; font-size: 2rem; background: linear-gradient(135deg, #ffe8d2, #eee6ff); }

.track-head { justify-content: space-between; margin-bottom: 0.75rem; }
.track-head h2 { margin: 0; font-size: 1.25rem; }

.search {
  width: 100%;
  min-height: 3.5rem;
  margin-bottom: 0.75rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 1rem;
  background: var(--card);
  box-shadow: 0 1px 2px rgb(61 42 28 / 8%);
  font-size: 1.1rem;
}

.search:focus { outline: 4px solid #ffd7c2; }

.track-list { display: flex; flex-direction: column; gap: 0.5rem; }

.track {
  flex-wrap: nowrap;
  background: var(--card);
  border-radius: 1.5rem;
  padding: 0.75rem;
  box-shadow: 0 1px 2px rgb(61 42 28 / 8%);
}

.track.current { box-shadow: 0 0 0 4px #ffe0cc; }
/* Heard tracks stay fully tappable. History only keeps automatic play
   from repeating them; a tap on the row starts that file again. */
.heard {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
}

.track-play {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
  text-align: left;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.titles { min-width: 0; flex: 1; }
.title { font-weight: 800; font-size: 1.1rem; line-height: 1.2; }
.sub { color: var(--muted); font-weight: 700; }
.icon-btn { min-width: 3rem; font-weight: 800; background: var(--cream); }

.panel-back {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgb(61 42 28 / 30%);
}

.panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(100%, 28rem);
  background: var(--cream);
  box-shadow: -8px 0 24px rgb(61 42 28 / 15%);
  padding: 1.25rem;
  overflow-y: auto;
}

.panel-head { justify-content: space-between; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; font-size: 1.5rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.wide { width: 100%; font-size: 1.15rem; font-weight: 800; }

.history-item, .playlist {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border-radius: 1rem;
  padding: 0.75rem;
}

.playlist .row { margin-top: 0.5rem; }
.track-line {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  padding: 0.25rem 0;
}

.form-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.form-row input {
  flex: 1;
  min-height: 3rem;
  border: 0;
  border-radius: 1rem;
  padding: 0 1rem;
  background: white;
}

.unlock {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(61 42 28 / 50%);
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
}

.player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: #fff;
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.player-main { flex-wrap: nowrap; }
.transport { display: flex; gap: 0.5rem; flex: none; }
.transport button { min-width: 3rem; font-size: 1.25rem; background: var(--cream); }
.transport .peach { background: var(--peach); color: white; }
.jump-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.jump-row button { flex: 1; min-height: 3rem; background: var(--cream); font-weight: 800; }

.continue-wrap { margin-bottom: 1.5rem; }
.continue {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem;
}
.continue .cover-lg { width: 5rem; height: 5rem; flex: none; }
.continue .sub { color: var(--muted); font-weight: 700; }

.seek-row, .volume-row { margin-top: 0.5rem; flex-wrap: nowrap; }
.time { width: 2.6rem; font-size: 0.85rem; font-weight: 800; }
.time.end { text-align: right; }
.vol-label { width: 5.5rem; font-size: 0.85rem; }

input[type="range"] {
  flex: 1;
  accent-color: var(--peach);
  height: 2rem;
}
