*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F6F3EF;
  --bg2: #EDE9E3;
  --surface: #FEFCFA;
  --text: #1C1917;
  --text2: #78716C;
  --text3: #A8A29E;
  --accent: #D4573A;
  --accent-hover: #BE4E34;
  --accent-light: #FEF2EE;
  --border: #E7E1DA;
  --radius: 14px;
  --radius-sm: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: 52px;
  --mini-h: 64px;
  --header-h: 56px;
  /* Humanist sans first (Avenir ships on iOS/macOS); then SF for other Apple surfaces */
  --font-body: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  letter-spacing: -0.012em;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  font-size: inherit;
  -webkit-tap-highlight-color: transparent;
}

input[type="text"] {
  font-family: inherit;
  font-size: 16px;
  border: none;
  outline: none;
  background: var(--bg);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  width: 100%;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: none;
  margin-top: -6px;
}

#app {
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ===== WELCOME ===== */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
}

#welcome {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
html.music-returning #welcome {
  display: none !important;
}
#welcome.leaving {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}
.welcome-inner {
  text-align: center;
  padding: 40px 32px;
  max-width: 360px;
}
.welcome-note {
  width: 72px;
  height: 72px;
  margin: 0 auto 28px;
  color: var(--accent);
}
.welcome-note svg { width: 100%; height: 100%; }
.welcome-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.welcome-sub {
  color: var(--text2);
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 36px;
}
.welcome-note-text {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text3);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 40px;
  border-radius: 100px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-accent:active {
  background: var(--accent-hover);
  transform: scale(0.97);
}
.btn-sm { padding: 10px 24px; font-size: 14px; }
.btn-danger { background: #DC2626; }
.btn-danger:active { background: #B91C1C; }
.modal-confirm p {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

.text-btn {
  color: var(--accent);
  font-weight: 500;
  font-size: 15px;
  padding: 8px 16px;
}

/* ===== MAIN LAYOUT ===== */
#main {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  z-index: 5;
  padding-top: var(--safe-top);
}
html.music-returning #main,
#main.main-ready {
  display: flex !important;
}

/* ===== HEADER ===== */
#header {
  flex-shrink: 0;
  padding: 0 20px;
  padding-top: 50px;
  margin-bottom: 30px;
  height: var(--header-h);
}
#header-main, #header-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
#header-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
#detail-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  padding: 0 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
  flex-shrink: 0;
}
.icon-btn:active { background: var(--bg2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ===== CONTENT ===== */
#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.view {
  display: none;
  padding: 0 0 12px;
  min-height: 100%;
}
.view.active { display: block; }

/* ===== TRACK LIST ===== */
.track-list {
  padding: 0 8px;
}
.track-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: background 0.12s;
  cursor: pointer;
  position: relative;
}
.track-row:active { background: var(--bg2); }
.track-row.playing { background: var(--accent-light); }
.track-row.playing .track-title { color: var(--accent); font-weight: 600; }

.track-art {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
}
.track-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.track-art svg { width: 22px; height: 22px; }

.track-info {
  flex: 1;
  min-width: 0;
}
.track-title {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.3;
}
.track-sub {
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.3;
}
.track-dur {
  font-size: 13px;
  color: var(--text3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.track-more {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--text3);
}
.track-more:active { background: var(--border); }
.track-more svg { width: 18px; height: 18px; }

/* ===== ALBUM GRID ===== */
.album-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 8px 20px 20px;
}
.album-card {
  cursor: pointer;
  transition: transform 0.12s;
  min-width: 0;
  overflow: hidden;
}
.album-card:active { transform: scale(0.97); }

.album-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--bg2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  margin-bottom: 8px;
}
.album-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.album-art svg { width: 36px; height: 36px; }
.album-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.album-artist {
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== DETAIL VIEW ===== */
.detail-view {
  padding: 0 !important;
}
.detail-hero {
  padding: 20px 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.detail-hero-art {
  width: min(200px, 55vw);
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--bg2);
  overflow: hidden;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}
.detail-hero-art img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero-art svg { width: 48px; height: 48px; }

.detail-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.detail-sub {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 16px;
}
.detail-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.detail-play-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  padding: 10px 28px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
}
.detail-play-btn:active { background: var(--accent-hover); }
.detail-play-btn svg { width: 18px; height: 18px; fill: #fff; }
.detail-shuffle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--border);
  padding: 10px 24px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
}
.detail-shuffle-btn:active { background: var(--accent-light); }
.detail-shuffle-btn svg { width: 18px; height: 18px; fill: var(--accent); }

.detail-tracklist {
  padding: 0 8px 20px;
}

/* Playlist-specific */
.pl-delete-zone {
  padding: 20px;
  text-align: center;
}
.pl-delete-btn {
  color: #DC2626;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 24px;
}

/* ===== PLAYLIST ROW ===== */
.new-playlist-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  width: 100%;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
}
.new-pl-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.new-pl-icon svg { width: 20px; height: 20px; stroke: var(--accent); }

.playlist-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.12s;
}
.playlist-row:active { background: var(--bg2); }
.pl-art {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  flex-shrink: 0;
}
.pl-art img { width: 100%; height: 100%; object-fit: cover; }
.pl-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}
.pl-art-placeholder svg { width: 22px; height: 22px; }
.pl-info { flex: 1; min-width: 0; }
.pl-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pl-count {
  font-size: 13px;
  color: var(--text2);
}

/* ===== MINI PLAYER ===== */
#mini-player {
  flex-shrink: 0;
  background: var(--surface);
  margin: 0 8px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  cursor: pointer;
  position: relative;
}
#mini-progress-bar {
  height: 2px;
  background: var(--bg2);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}
#mini-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s linear;
}
.mini-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  height: var(--mini-h);
}
.mini-art {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
}
.mini-art img { width: 100%; height: 100%; object-fit: cover; }
.mini-art svg { width: 20px; height: 20px; }
.mini-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
#mini-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#mini-artist {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
}
.mini-btn:active { background: var(--bg2); }
.mini-btn svg { width: 22px; height: 22px; }

/* ===== TAB BAR ===== */
#tab-bar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-around;
  height: var(--tab-h);
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  color: var(--text3);
  transition: color 0.15s;
  padding: 4px 0;
}
.tab.active { color: var(--accent); }
.tab svg { width: 22px; height: 22px; }
.tab span { font-size: 10px; font-weight: 500; letter-spacing: 0.02em; }

/* ===== NOW PLAYING ===== */
.overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--safe-top);
}
.overlay-screen.open {
  transform: translateY(0);
}
.overlay-screen.np-dragging {
  transition: none;
}

.np-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  width: 100%;
  max-width: 160px;
  margin: 4px auto 0;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.np-drag-handle:active {
  cursor: grabbing;
}
.np-drag-handle::before {
  content: '';
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
}
.np-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
}
.np-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
}

.np-body {
  padding: 0 28px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.np-artwork-wrap {
  width: 100%;
  max-width: 340px;
  margin: 12px auto 32px;
}
.np-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--bg2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  box-shadow: 0 12px 48px rgba(0,0,0,0.1);
  transition: box-shadow 0.3s;
}
.np-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.np-art-placeholder { width: 50%; height: 50%; }

.np-info {
  text-align: center;
  width: 100%;
  margin-bottom: 28px;
}
#np-title {
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
#np-artist {
  font-size: 16px;
  color: var(--accent);
  font-weight: 500;
}

/* Scrubber */
.np-scrubber {
  width: 100%;
  margin-bottom: 20px;
}
.np-scrubber input[type="range"] {
  height: 4px;
  background: var(--border);
}
.np-scrubber input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4px;
}
.np-times {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text3);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* Controls */
.np-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 32px;
}
.ctrl-secondary {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text2);
}
.ctrl-secondary.active { color: var(--accent); }
.ctrl-secondary svg { width: 24px; height: 24px; }
.ctrl-main {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.ctrl-main:active { background: var(--bg2); }
.ctrl-main svg { width: 28px; height: 28px; }
.ctrl-play {
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  margin: 0 8px;
  transition: transform 0.12s;
}
.ctrl-play:active { transform: scale(0.93); }
.ctrl-play svg { width: 30px; height: 30px; }

/* Volume */
.np-volume {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}
.np-volume svg {
  width: 18px;
  height: 18px;
  color: var(--text3);
  flex-shrink: 0;
}
.np-volume input[type="range"] { height: 3px; }
.np-volume input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
}

/* Repeat one badge */
.repeat-one-badge {
  position: absolute;
  font-size: 8px;
  font-weight: 700;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ===== QUEUE ===== */
#queue-view { z-index: 55; }
.queue-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}
.queue-top h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
}

/* ===== EMPTY STATES ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
}
.empty-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  color: var(--text3);
}
.empty-icon svg { width: 100%; height: 100%; }
.empty-state h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 20px;
  line-height: 1.4;
}

/* ===== MODALS ===== */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-bg.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  z-index: 85;
  width: calc(100% - 48px);
  max-width: 340px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.modal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
.modal h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}
.modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Song picker modal */
.modal-picker {
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.modal-picker .picker-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
  flex-shrink: 0;
}
.modal-picker .picker-top h2 { margin: 0; }
.picker-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 8px 12px;
}
.picker-list::-webkit-scrollbar { display: none; }
.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}
.picker-row:active { background: var(--bg2); }
.picker-row .pick-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.picker-row.selected .pick-check {
  background: var(--accent);
  border-color: var(--accent);
}
.picker-row.selected .pick-check::after {
  content: '';
  display: block;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.picker-row .pick-info { flex: 1; min-width: 0; }
.picker-row .pick-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.picker-row .pick-sub {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Edit metadata modal */
.modal-edit {
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-edit input[type="number"] {
  font-family: inherit;
  font-size: 16px;
  border: none;
  outline: none;
  background: var(--bg);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  width: 100%;
  -moz-appearance: textfield;
}
.modal-edit input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.edit-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 14px 0 4px;
}
.edit-label:first-of-type { margin-top: 16px; }
.edit-art-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.edit-art-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
}
.edit-art-preview img { width: 100%; height: 100%; object-fit: cover; }
.edit-art-preview svg { width: 28px; height: 28px; }
.btn-outline {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: none;
  color: var(--accent);
  cursor: pointer;
}
.btn-outline:active { background: var(--accent-light); }
.text-btn-sm { font-size: 13px; padding: 4px 8px; color: #DC2626; }

#atp-list {
  max-height: 260px;
  overflow-y: auto;
}
.atp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
}
.atp-row:active { background: var(--bg2); }

/* ===== ACTION SHEET ===== */
.action-sheet {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}
.action-sheet.show { pointer-events: auto; }
.as-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.25s;
}
.action-sheet.show .as-backdrop { opacity: 1; }
.as-body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 0;
  padding-bottom: calc(12px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.action-sheet.show .as-body { transform: translateY(0); }
.as-header {
  padding: 16px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
#as-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#as-sub {
  font-size: 13px;
  color: var(--text2);
}
.as-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 20px;
  font-size: 16px;
  transition: background 0.1s;
}
.as-btn:active { background: var(--bg2); }
.as-btn.danger { color: #DC2626; }
.as-btn.cancel {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  font-weight: 600;
  color: var(--accent);
}

/* ===== ADD TO HOMESCREEN ===== */
.a2hs {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  z-index: 200;
  animation: slideUp 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}
.a2hs-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  position: relative;
}
.a2hs-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text3);
}
.a2hs-msg {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
}
.a2hs-steps {
  font-size: 14px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.a2hs-share {
  width: 18px;
  height: 18px;
  color: #007AFF;
  vertical-align: middle;
}
.a2hs-arrow {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--surface);
  margin: 0 auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
}

/* ===== IMPORT TOAST ===== */
.import-toast {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.import-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp {
  from { transform: translateY(120%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== SCROLLBAR ===== */
#content::-webkit-scrollbar,
.overlay-screen::-webkit-scrollbar,
#atp-list::-webkit-scrollbar {
  display: none;
}

/* ===== STANDALONE MODE ===== */
@media (display-mode: standalone) {
  #tab-bar {
    height: calc(var(--tab-h) + var(--safe-bottom));
  }
}

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
  .album-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 768px) {
  .album-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .np-artwork-wrap {
    max-width: 380px;
  }
}

/* ===== RANGE TRACK STYLES (cross-browser) ===== */
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
}
.np-scrubber input[type="range"]::-webkit-slider-runnable-track { height: 4px; }
.np-volume input[type="range"]::-webkit-slider-runnable-track { height: 3px; }
