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

:root {
  --bg: #111111;
  --col-bg: #141414;
  --row-odd: #1a1a1a;
  --row-even: #1e1e1e;
  --row-selected: #2a2a2a;
  --row-playing: #1f2520;
  --row-expanded: #1c1c22;
  --accent: #c87030;
  --text: #d4d4d4;
  --text-dim: #777;
  --border: #2a2a2a;
  --col-width: 220px;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Mono", "Menlo", "Monaco", monospace;
  font-size: 13px;
}

body {
  display: flex;
}

/* --- Columns panel --- */

#columns {
  flex: 0 0 60%;
  display: flex;
  overflow: hidden;
}

.column {
  flex: 0 0 var(--col-width);
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--border);
  background: var(--col-bg);
  scrollbar-width: none;
}

.column::-webkit-scrollbar {
  display: none;
}

.column.inactive .row {
  opacity: 0.7;
}

.row {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 150ms;
  min-height: 26px;
  user-select: none;
}

.row:nth-child(odd) {
  background: var(--row-odd);
}

.row:nth-child(even) {
  background: var(--row-even);
}

.row.selected {
  background: var(--row-selected);
  border-left: 2px solid var(--accent);
  padding-left: 6px;
}

.row.playing {
  background: var(--row-playing);
}

.row.selected.playing {
  background: var(--row-selected);
}

.row.expanded .row-chevron {
  color: var(--accent);
}

.row-icon {
  flex: 0 0 16px;
  color: var(--text-dim);
  font-size: 11px;
  margin-right: 4px;
  text-align: center;
}

.row-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-chevron {
  flex: 0 0 14px;
  color: var(--text-dim);
  font-size: 18px;
  text-align: right;
}

/* --- Player panel --- */

#player {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  padding: 24px 20px 16px;
  overflow: hidden;
}

#cover-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  position: relative;
  padding-right: 44px;
}

#cover-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  position: relative;
}

#cover-art {
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  display: none;
  cursor: pointer;
}

#cover-art.visible {
  display: block;
}

#cover-placeholder {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  opacity: 0.5;
}

#cover-placeholder.hidden {
  display: none;
}

/* --- Volume (vertical, right of cover) --- */

#volume-container {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 44px;
}

#volume {
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: none;
  appearance: none;
  width: 4px;
  height: 160px;
  background: #2a2a2a;
  border-radius: 2px;
  outline: none;
}

#volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

#volume::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

#volume-display {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  text-align: center;
}

/* --- Track info --- */

#track-info {
  width: 100%;
  max-width: 320px;
  text-align: center;
  padding: 12px 0 4px;
  min-height: 44px;
}

#track-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#track-artist {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Controls --- */

#controls {
  flex: 0 0 auto;
  width: 100%;
  max-width: 320px;
}

#seek-container {
  width: 100%;
  padding: 8px 0;
  cursor: pointer;
}

#seek-bar {
  width: 100%;
  height: 4px;
  background: #2a2a2a;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

#seek-progress {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 100ms linear;
}

#time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  padding: 2px 0 12px;
}

#transport {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 4px 0 8px;
}

#transport button {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 150ms;
  line-height: 1;
}

#transport button:hover {
  background: #2a2a2a;
}

#transport button:active {
  background: #333;
}

/* --- Toast --- */

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: var(--text);
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 200;
  opacity: 0;
  transition: opacity 200ms;
  pointer-events: none;
}

#toast.visible {
  opacity: 1;
}

#toast.hidden {
  display: none;
}

/* --- Search overlay --- */

#search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 100;
}

#search-overlay.hidden {
  display: none;
}

#search-box {
  width: 520px;
  max-height: 60vh;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#search-input {
  width: 100%;
  padding: 12px 16px;
  background: #222;
  border: none;
  border-bottom: 1px solid #333;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

#search-input::placeholder {
  color: var(--text-dim);
}

#search-results {
  overflow-y: auto;
  max-height: calc(60vh - 48px);
  scrollbar-width: none;
}

#search-results::-webkit-scrollbar {
  display: none;
}

.search-result {
  padding: 6px 16px;
  cursor: pointer;
  border-bottom: 1px solid #222;
  transition: background 100ms;
}

.search-result:hover {
  background: #252525;
}

.search-result.selected {
  background: var(--row-selected);
  border-left: 2px solid var(--accent);
  padding-left: 14px;
}

.search-result-name {
  font-size: 13px;
  color: var(--text);
}

.search-result-path {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-history-item {
  color: var(--text-dim);
}

.search-history-item::before {
  content: "↻ ";
  opacity: 0.5;
}

.search-result-delete {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  padding: 4px;
  transition: opacity 100ms;
}

.search-result:hover .search-result-delete {
  opacity: 0.6;
}

.search-result-delete:hover {
  opacity: 1 !important;
  color: var(--text);
}

.search-result {
  position: relative;
}

/* --- Version --- */

#version {
  position: fixed;
  bottom: 4px;
  right: 8px;
  font-size: 9px;
  color: var(--text-dim);
  opacity: 0.4;
  pointer-events: none;
  z-index: 50;
}
