:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #12151b;
  --panel2: #0f1217;
  --text: #e6e6e6;
  --muted: #a9b0bd;
  --border: #2a2f3a;
  --accent: #6ea8fe;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 14px/1.35 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 100;
}

.overlay.hidden {
  display: none;
}

.authCard {
  width: min(460px, 92vw);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(to bottom, #12151b, #0f1217);
  padding: 16px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.5);
}

.authTitle {
  font-weight: 750;
  font-size: 18px;
  margin-bottom: 6px;
}

.authMessage {
  color: var(--muted);
  margin-bottom: 12px;
}

.authForm {
  display: grid;
  gap: 10px;
}

.authLabel {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.authInput {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}

.authActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.authBtn {
  background: linear-gradient(to bottom, rgba(110, 168, 254, 0.22), rgba(110, 168, 254, 0.12));
  border-color: rgba(110, 168, 254, 0.55);
}

.authBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, #0f1217, #0b0d10);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 650;
  letter-spacing: 0.2px;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

label {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
}

label.checkbox {
  gap: 8px;
}

select,
input[type="search"],
button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

input[type="search"] {
  width: min(340px, 48vw);
}

button {
  cursor: pointer;
}

button:hover {
  border-color: #3a4354;
}

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: calc(100vh - 52px);
}

.listPane {
  border-right: 1px solid var(--border);
  background: var(--panel2);
  display: flex;
  flex-direction: column;
}

.listHeader {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.status {
  color: var(--muted);
}

.list {
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dayGroup {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0f1217;
}

.daySummary {
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  user-select: none;
}

.daySummary::-webkit-details-marker {
  display: none;
}

.dayTitle {
  font-weight: 650;
  color: var(--text);
}

.dayCount {
  font-size: 12px;
  color: var(--muted);
}

.dayItems {
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item {
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 12px;
  background: #0f1217;
  border: 1px solid var(--border);
}

.item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(110, 168, 254, 0.25);
}

.titleRow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.path {
  color: #7f8897;
  font-size: 12px;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playerPane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.nowPlaying {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.nowPlaying .label {
  color: var(--muted);
  font-size: 12px;
}

.nowPlaying .name {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nowPlaying .meta {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player {
  width: 100%;
  max-height: calc(100vh - 210px);
  background: black;
  border: 1px solid var(--border);
  border-radius: 14px;
}

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

.download {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--panel);
}

.download:hover {
  border-color: #3a4354;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .listPane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 42vh;
  }

  .player {
    max-height: 48vh;
  }
}
