/* K&J Music — gold (#C9A227 / #E8C86A) on black (#000 / #0d0d0d).
   Mobile-first for iPhone Safari. Big touch targets, dark throughout. */
* { box-sizing: border-box; }

:root {
  --gold: #C9A227;
  --gold-light: #E8C86A;
  --gold-dim: #8a6d1a;
  --black: #000;
  --bg: #0d0d0d;
  --card: #1a1a1a;
  --card2: #242424;
  --text: #f5f5f5;
  --muted: #b3b3b3;
  --grey: #777;
  --playing-bg: #3a2f07; /* gold-tinted highlight for the playing row */
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--black);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 14px calc(96px + env(safe-area-inset-bottom));
  background: var(--black);
}

.hidden { display: none !important; }

/* Bilingual labels: Arabic runs right-to-left inside an English (LTR) page.
   .ar marks every Arabic span so it renders RTL and wraps cleanly. */
.ar { direction: rtl; unicode-bidi: isolate; }

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 6px;
}
.header .logo { border-radius: 12px; border: 2px solid var(--gold); }
.header h1 {
  margin: 0;
  font-size: 28px;
  color: var(--gold-light);
  letter-spacing: 0.5px;
}

/* Hint + demo bars */
.hint-bar, .demo-note {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.4;
}
.hint-bar {
  background: var(--card);
  border: 1px solid var(--gold);
  color: var(--text);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.hint-close {
  background: none;
  border: none;
  color: var(--gold-light);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}
.demo-note {
  background: #2a2103;
  border: 1px solid var(--gold-dim);
  color: var(--gold-light);
  text-align: center;
}

/* Screens */
.screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 0; }
.screen h2 { color: var(--gold-light); font-size: 24px; margin: 0 0 8px; }
.screen p { font-size: 17px; line-height: 1.5; color: var(--muted); }

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: var(--muted);
  background: var(--card);
  border: 1px solid #333;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.25;
}
/* Bilingual tab: English on the first line, Arabic on the second. */
.tab .en { display: block; }
.tab .ar { display: block; font-size: 12px; font-weight: 600; opacity: 0.85; }
.tab.active {
  color: var(--black);
  background: var(--gold);
  border-color: var(--gold);
}

/* View bar */
.view-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 10px;
  min-height: 40px;
}
.view-title { font-size: 19px; font-weight: 800; color: var(--gold-light); }
.view-count { font-size: 15px; color: var(--muted); }
.sort-wrap { margin-left: auto; font-size: 15px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sort-wrap select {
  font-size: 16px;
  font-family: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--gold-dim);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 16px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  border: none;
}
.btn-gold { background: var(--gold); color: var(--black); }
.btn-ghost { background: var(--card); color: var(--gold-light); border: 1px solid var(--gold-dim); }
.btn-small { padding: 9px 14px; font-size: 15px; }
.btn:disabled { opacity: 0.45; cursor: default; }

/* Song list */
.view { flex: 1; }
.song-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.song-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid #2c2c2c;
  border-radius: 14px;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.song-row .row-main { flex: 1; min-width: 0; }
.song-row .row-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-row .row-artist { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.song-row .row-note { font-size: 13px; color: var(--gold-light); margin-top: 2px; }
.song-row .row-playing { color: var(--gold-light); font-weight: 800; font-size: 18px; }
/* Playing row: gold background + bold gold title + gold note (like JAMZ v1.5). */
.song-row.playing { background: var(--playing-bg); border-color: var(--gold); }
.song-row.playing .row-title { color: var(--gold-light); }
.song-row.playing .row-note { color: var(--gold-light); }
/* Missing songs: greyed out, not playable. */
.song-row.missing { opacity: 0.45; cursor: default; }
.song-row.missing .row-title { color: var(--grey); }
.song-row .fav-btn, .song-row .mini-btn {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--gold-light);
  font-size: 22px;
  padding: 8px 4px;
  cursor: pointer;
  font-family: inherit;
}
.song-row .fav-btn.faved { color: var(--gold); }
.song-row .mini-btn { font-size: 15px; font-weight: 700; color: var(--muted); }

.artist-row, .playlist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  background: var(--card);
  border: 1px solid #2c2c2c;
  border-radius: 14px;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}
.artist-row .sub, .playlist-row .sub { display: block; font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.artist-row .chev, .playlist-row .chev { margin-left: auto; color: var(--gold); font-size: 20px; }

.empty { text-align: center; color: var(--muted); font-size: 17px; padding: 32px 8px; line-height: 1.5; }
.note-box {
  background: var(--card);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  margin: 12px 0;
}
.note-box b { color: var(--gold-light); }
.search-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  font-family: inherit;
  border-radius: 14px;
  border: 2px solid var(--gold-dim);
  background: var(--card);
  color: var(--text);
  margin-bottom: 12px;
}
.search-input:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.section-title { font-size: 18px; font-weight: 800; color: var(--gold-light); margin: 18px 0 8px; }
.storage-line { font-size: 15px; color: var(--muted); margin: 4px 0 12px; }

/* Now-playing bar */
.player-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(100vw, 640px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #111;
  border-top: 2px solid var(--gold);
  z-index: 20;
}
.bar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  padding: 4px;
}
.bar-note { color: var(--gold); font-size: 22px; font-weight: 800; }
.bar-text { display: flex; flex-direction: column; min-width: 0; }
.bar-title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-artist { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-btn {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  background: var(--card);
  color: var(--gold-light);
  font-size: 20px;
  cursor: pointer;
}
.bar-play { background: var(--gold); color: var(--black); border-color: var(--gold); font-size: 22px; }

/* Player sheet */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-inner {
  width: min(100vw, 640px);
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--bg);
  border: 2px solid var(--gold);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  text-align: center;
  position: relative;
}
.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  background: var(--card);
  color: var(--gold-light);
  font-size: 18px;
  cursor: pointer;
}
.sheet-note { font-size: 64px; color: var(--gold); line-height: 1; }
.sheet-title { font-size: 24px; color: var(--gold-light); margin: 12px 0 4px; }
.sheet-artist { font-size: 17px; color: var(--muted); margin: 0 0 16px; }
.seek-row { display: flex; align-items: center; gap: 10px; }
.seek-row .time { font-size: 14px; color: var(--muted); min-width: 38px; }
#seekBar { flex: 1; accent-color: var(--gold); height: 28px; }
.controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 18px 0 6px; }
.ctl-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  background: var(--card);
  color: var(--gold-light);
  font-size: 24px;
  cursor: pointer;
}
.ctl-btn.on { background: var(--gold); color: var(--black); border-color: var(--gold); }
.ctl-play { width: 72px; height: 72px; font-size: 30px; background: var(--gold); color: var(--black); border-color: var(--gold); }
.mode-line { font-size: 14px; color: var(--muted); margin: 4px 0 14px; }
.sheet-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.save-status { font-size: 15px; color: var(--gold-light); min-height: 20px; margin: 8px 0 0; }

/* EQ */
.eq-box {
  margin-top: 18px;
  text-align: left;
  background: var(--card);
  border: 1px solid #2c2c2c;
  border-radius: 14px;
  padding: 12px 14px;
}
.eq-box summary { font-size: 18px; font-weight: 800; color: var(--gold-light); cursor: pointer; padding: 4px 0; }
.eq-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.eq-preset {
  padding: 9px 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid var(--gold-dim);
  background: var(--bg);
  color: var(--gold-light);
  cursor: pointer;
}
.eq-preset.on { background: var(--gold); color: var(--black); border-color: var(--gold); }
.eq-sliders { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 6px; margin: 6px 0 12px; }
.eq-band { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.eq-band input[type="range"] { writing-mode: vertical-lr; direction: rtl; width: 28px; height: 96px; accent-color: var(--gold); }
.eq-band .eq-val { font-size: 12px; color: var(--muted); }
.eq-band .eq-freq { font-size: 12px; color: var(--gold-light); font-weight: 700; }
.eq-note { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
