:root {
  --bg-primary: #0d1117;
  --bg-surface: #161b22;
  --bg-hover: #21262d;
  --bg-active: #2b313a;
  --border-color: #30363d;
  --border-light: #484f58;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #2f81f7;
  --accent-hover: #58a6ff;
  --accent-dim: rgba(56, 139, 253, 0.15);
  --success: #238636;
  --success-text: #3fb950;
  --tag-bg: #21262d;
  --tag-text: #c9d1d9;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.player-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon svg {
  width: 18px;
  height: 18px;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  background: rgba(35, 134, 54, 0.15);
  color: var(--success-text);
  border: 1px solid rgba(46, 160, 67, 0.3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success-text);
  box-shadow: 0 0 6px var(--success-text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  width: 240px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
}

.search-box input {
  width: 100%;
  padding: 6px 10px 6px 32px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-box input:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-active);
  border-color: var(--border-light);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.tag-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.chip {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

.chip.active {
  background: var(--accent-dim);
  color: var(--accent-hover);
  border-color: var(--accent);
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.sort-label {
  font-size: 12px;
}

.sort-controls select {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

/* Main Split View */
.content-split {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* File Browser Pane */
.browser-pane {
  width: 380px;
  min-width: 320px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
}

.pane-title {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.pane-subtitle {
  color: var(--text-muted);
}

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

.loading-state,
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.file-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.file-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.file-card.active {
  background: rgba(47, 129, 247, 0.1);
  border-color: var(--accent);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-top-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.card-download-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.type-badge.video {
  background: rgba(163, 113, 247, 0.2);
  color: #d2a8ff;
  border: 1px solid rgba(163, 113, 247, 0.4);
}

.type-badge.audio {
  background: rgba(240, 136, 62, 0.2);
  color: #ffa657;
  border: 1px solid rgba(240, 136, 62, 0.4);
}

.type-badge.recipe,
.type-badge.text {
  background: rgba(56, 139, 253, 0.2);
  color: #79c0ff;
  border: 1px solid rgba(56, 139, 253, 0.4);
}

.type-badge.image {
  background: rgba(63, 185, 80, 0.2);
  color: #7ee787;
  border: 1px solid rgba(63, 185, 80, 0.4);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.mini-tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
}

/* Stage Pane */
.stage-pane {
  flex: 1;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

.stage-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-art {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.stage-empty h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.stage-empty p {
  font-size: 13.5px;
  max-width: 360px;
  color: var(--text-muted);
}

.stage-active {
  display: flex;
  flex-direction: column;
  padding: 24px 32px;
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.media-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.media-title-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.media-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  background: var(--accent-dim);
  color: var(--accent-hover);
  border: 1px solid var(--accent);
}

.media-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.media-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Viewer Container */
.viewer-container {
  background: #000;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.viewer-container video {
  width: 100%;
  max-height: 520px;
  display: block;
  outline: none;
}

.viewer-container .audio-player-card {
  width: 100%;
  padding: 40px 32px;
  background: linear-gradient(135deg, #161b22, #0d1117);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.audio-disk {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, #30363d 30%, #161b22 70%);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.audio-disk svg {
  color: var(--accent-hover);
  width: 32px;
  height: 32px;
}

.viewer-container audio {
  width: 100%;
  max-width: 500px;
  outline: none;
}

.viewer-container img {
  max-width: 100%;
  max-height: 560px;
  object-fit: contain;
  display: block;
}

/* Markdown Reader View */
.markdown-reader {
  width: 100%;
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 32px;
  border-radius: var(--radius-lg);
  font-size: 14.5px;
  line-height: 1.65;
  overflow-y: auto;
  max-height: 560px;
}

.markdown-reader h1 {
  font-size: 22px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  color: #fff;
}

.markdown-reader h2 {
  font-size: 18px;
  margin-top: 20px;
  margin-bottom: 10px;
  color: var(--accent-hover);
}

.markdown-reader ul,
.markdown-reader ol {
  padding-left: 24px;
  margin-bottom: 14px;
}

.markdown-reader li {
  margin-bottom: 6px;
}

.markdown-reader p {
  margin-bottom: 12px;
}

.markdown-reader strong {
  color: #fff;
}

/* Details Card */
.media-details {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-label {
  width: 180px;
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-value {
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.detail-value.sha-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  word-break: break-all;
}

.detail-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Modal Dialog Styles */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-group h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-icon-modal {
  color: var(--accent);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-primary);
  transition: all 0.15s ease;
  position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.file-input-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  pointer-events: none;
}

.btn-browse-prompt,
.btn-change-file {
  pointer-events: auto;
  cursor: pointer;
}

.drop-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.drop-subtext {
  font-size: 11.5px;
  color: var(--text-muted);
}

.file-selected-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sel-filename {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-hover);
  word-break: break-all;
}

.sel-filesize {
  font-size: 12px;
  color: var(--text-secondary);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
}

/* Progress Bar */
.upload-progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-primary);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.15s ease;
}

.progress-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.progress-substatus {
  font-size: 11px;
  color: var(--text-muted);
}

.upload-result {
  font-size: 12.5px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.upload-result.success {
  background: rgba(35, 134, 54, 0.15);
  color: var(--success-text);
  border: 1px solid rgba(46, 160, 67, 0.3);
}

.upload-result.error {
  background: rgba(248, 81, 73, 0.15);
  color: #ff7b72;
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
}

/* Responsive adjustments */
@media (max-width: 800px) {
  .content-split {
    flex-direction: column;
  }
  .browser-pane {
    width: 100%;
    height: 42%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .stage-active {
    padding: 16px;
  }
}
