:root {
  color-scheme: dark;
  --bg: #111319;
  --panel: rgba(28, 31, 40, 0.86);
  --panel-solid: #1b1f29;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f7fb;
  --muted: #9aa3b5;
  --accent: #ffcf5a;
  --accent-2: #48d6b5;
  --danger: #ff7a7a;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 207, 90, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(72, 214, 181, 0.14), transparent 34%),
    radial-gradient(circle at 45% -20%, #303746, transparent 42%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
}

.player-stage,
.side-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.player-stage {
  min-width: 0;
  border-radius: 8px;
  padding: 22px;
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto auto;
  gap: 18px;
}

.topbar,
.now-playing,
.controls,
.section-title,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1;
}

h2 {
  font-size: 16px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stats span,
.section-title span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  white-space: nowrap;
}

.screen-wrap {
  position: relative;
  min-height: 360px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #07090d;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #07090d;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 207, 90, 0.11), transparent 50%),
    linear-gradient(315deg, rgba(72, 214, 181, 0.13), transparent 54%),
    #0b0e14;
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #151515;
  font-size: 30px;
  font-weight: 900;
}

.empty-state h2 {
  font-size: 24px;
}

.empty-state p {
  max-width: 540px;
  color: var(--muted);
  line-height: 1.7;
}

.now-playing {
  min-height: 66px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

#currentTitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 68vw;
}

.controls {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.folder-btn,
.text-btn,
.mini-btn,
.icon-btn {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-btn {
  background: var(--accent);
  color: #171717;
}

.ghost-btn,
.icon-btn,
.mini-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.primary-btn:hover,
.ghost-btn:hover,
.folder-btn:hover,
.text-btn:hover,
.mini-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.side-panel {
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.panel-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.panel-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.file-drop {
  margin-top: 14px;
  min-height: 156px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.file-drop.dragging {
  border-color: var(--accent-2);
  background: rgba(72, 214, 181, 0.1);
}

.file-drop input,
.folder-btn input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-2);
  font-size: 24px;
}

.file-drop small {
  color: var(--muted);
}

.folder-btn,
.text-btn {
  width: 100%;
  margin-top: 10px;
  display: grid;
  place-items: center;
  text-align: center;
}

.folder-btn {
  background: rgba(72, 214, 181, 0.15);
  border: 1px solid rgba(72, 214, 181, 0.32);
}

.text-btn {
  background: transparent;
  border: 1px solid var(--line);
}

.switch-row {
  min-height: 42px;
  color: #dce2ee;
}

.switch-row input {
  width: 46px;
  height: 25px;
  accent-color: var(--accent-2);
}

.playlist-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.playlist {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  overflow: auto;
  max-height: 42vh;
  padding-right: 4px;
}

.playlist-item {
  min-height: 44px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #dfe5ef;
}

.playlist-item.active {
  border-color: rgba(255, 207, 90, 0.62);
  background: rgba(255, 207, 90, 0.1);
}

.playlist-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-item button {
  border: 0;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  color: #151515;
  background: var(--accent);
}

.mini-btn {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
}

.icon-btn {
  width: 44px;
  flex: 0 0 auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 5;
  border-radius: 8px;
  padding: 12px 16px;
  color: #151515;
  background: var(--accent);
  box-shadow: var(--shadow);
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .player-stage {
    grid-template-rows: auto auto auto auto;
  }

  .side-panel {
    min-height: auto;
  }

  .playlist {
    max-height: 300px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
  }

  .player-stage,
  .side-panel {
    padding: 14px;
  }

  .topbar,
  .now-playing {
    align-items: flex-start;
    flex-direction: column;
  }

  .screen-wrap {
    min-height: 220px;
  }

  .controls > button {
    width: 100%;
  }

  #currentTitle {
    max-width: calc(100vw - 72px);
  }
}
