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

:root {
  --bg: #fafafa;
  --fg: #262626;
  --card: #ffffff;
  --border: #262626;
  --primary: #22d3ee;
  --secondary: #fb923c;
  --muted: #e5e5e5;
  --shadow: 3px 3px 0px #262626;
  --shadow-lg: 4px 4px 0px #262626;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--fg);
  padding: 0.5rem;
  line-height: 1.4;
  font-size: 14px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* 返回上一级 */
.back-link {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--card);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--fg);
  font-size: 0.875rem;
  font-weight: 500;
  transition: transform 0.1s;
}

.back-link:hover {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--border);
}

/* Player Card - 固定在顶部 */
.player-card {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

/* Waveform */
.waveform-container {
  position: relative;
  height: 80px;
  background: var(--muted);
  border: 2px solid var(--border);
  margin-bottom: 0.5rem;
  cursor: pointer;
  overflow: hidden;
}

.waveform-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.waveform-cursor {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: var(--secondary);
  pointer-events: none;
  z-index: 10;
}

/* Time Display */
.time-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.time-main {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.time-ab {
  font-size: 0.75rem;
  color: #666;
}

.now-playing-inline {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
}

/* Controls Grid */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.btn {
  padding: 0.5rem;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 40px;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--border);
}

.btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--fg);
}

.btn-active {
  background: var(--secondary);
  color: var(--fg);
}

.btn-ab-set {
  background: #a3e635;
  color: var(--fg);
}

.btn-full {
  grid-column: span 2;
}

/* File List Card */
.file-list-card {
  background: var(--card);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.file-list-header {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Folder */
.folder-item {
  margin-bottom: 0.25rem;
}

.folder-header {
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.4rem;
  background: var(--muted);
  border: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.folder-header:hover {
  background: #d4d4d4;
}

.folder-content {
  margin-left: 0.75rem;
  margin-top: 0.25rem;
}

/* File Item */
.file-item {
  background: var(--muted);
  border: 2px solid var(--border);
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  transition: all 0.2s;
}

.mp3-item {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.mp3-item:hover {
  transform: translateX(3px);
}

.mp3-item.active {
  background: rgba(34, 211, 238, 0.2);
  box-shadow: var(--shadow);
}

.file-number {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
}

.file-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-playing {
  display: flex;
  gap: 2px;
}

.file-playing-bar {
  width: 2px;
  height: 12px;
  background: var(--primary);
  animation: pulse 1s ease-in-out infinite;
}

.file-playing-bar:nth-child(2) {
  animation-delay: 0.2s;
}

.file-playing-bar:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--muted);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
}

/* 横屏优化 */
@media (orientation: landscape) and (max-height: 600px) {
  body {
    padding: 0.25rem;
  }

  .player-card {
    padding: 0.5rem;
  }

  .waveform-container {
    height: 60px;
  }

  .controls-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.35rem;
  }

  .btn {
    padding: 0.35rem;
    font-size: 0.7rem;
    min-height: 36px;
  }

  .file-list-card {
    padding: 0.5rem;
  }

  .mp3-item {
    padding: 0.35rem;
    font-size: 0.75rem;
  }
}
