/* Light or dark, whichever the browser asks for — the desktop player takes the
   same cue from the desktop portal. */
:root {
  color-scheme: light dark;

  --page: #fafafa;
  --panel: #ffffff;
  --line: #e2e2e2;
  --text: #1a1a1a;
  --secondary: #6a6a6a;
  --accent: #b3261e;
  --picked: #e8e8e8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #1c1c1c;
    --panel: #232323;
    --line: #333333;
    --text: #ececec;
    --secondary: #9a9a9a;
    --accent: #ff6b5e;
    --picked: #2e2e2e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  font: 14px/1.4 system-ui, sans-serif;
  color: var(--text);
  background: var(--page);
}

button {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
}

button:hover { border-color: var(--accent); }

.secondary { color: var(--secondary); font-size: 11px; }
.error { color: var(--accent); min-height: 1.4em; }
.spacer { flex: 1; }

/* The password box, which is all there is until there is a session. */
.login {
  display: grid;
  place-items: center;
  height: 100vh;
}

.login form {
  display: grid;
  gap: 10px;
  width: 260px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login h1 { margin: 0; font-size: 20px; }

.login input {
  font: inherit;
  color: inherit;
  padding: 6px 8px;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* Three rows: the bar, the two panes, the transport. */
.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.bar h1 { margin: 0; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; }

.panes {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 0;
}

.left {
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  padding: 5px 10px;
}

.item:hover { background: var(--picked); }
.item.selected { background: var(--picked); font-weight: 600; }

/* The border holds the picture's place in the layout, for a volume or an
   artist that has none. */
.item img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
}

.item img.empty { visibility: hidden; }
.item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .count { color: var(--secondary); font-size: 11px; }

.right {
  overflow-y: auto;
  padding: 10px 14px;
}

.right h2 { margin: 4px 0 10px; font-size: 15px; }

.tracks {
  width: 100%;
  border-collapse: collapse;
}

.tracks th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  font-weight: 600;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}

.tracks td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

.tracks .number, .tracks .time { width: 60px; color: var(--secondary); }
.tracks tr { cursor: default; }
.tracks tr.picked { background: var(--picked); }
.tracks tr.playing td { color: var(--accent); font-weight: 600; }

/* A track whose file is not on disk: listed, struck through, and skipped when
   the queue moves on. */
.tracks tr.missing td { text-decoration: line-through; color: var(--secondary); }

.transport {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.transport img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.transport .now { width: 240px; overflow: hidden; }
.transport .now div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transport audio { flex: 1; min-width: 0; }

@media (max-width: 700px) {
  .panes { grid-template-columns: 1fr; }
  .left { max-height: 35vh; border-right: none; border-bottom: 1px solid var(--line); }
  .transport .now { width: 120px; }
}
