:root {
  --bg: #14161a;
  --surface: #1b1e24;
  --surface-2: #21252c;
  --surface-3: #262a32;
  --border: #2b2f38;
  --text: #ecedef;
  --text-muted: #8b909c;
  --amber: #f5a623;
  --amber-dim: #7a5417;
  --green: #34d399;
  --red: #f87171;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.console {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--amber);
  box-shadow: 0 0 12px rgba(245, 166, 35, 0.65);
  flex-shrink: 0;
}

.brand h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: -0.01em;
}

.onair {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.onair.active {
  opacity: 1;
  transform: translateY(0);
  color: var(--amber);
  border-color: var(--amber-dim);
  background: rgba(245, 166, 35, 0.08);
}

.onair-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.onair.active .onair-dot {
  background: var(--amber);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.6); }
  50% { box-shadow: 0 0 0 5px rgba(245, 166, 35, 0); }
}

/* ---------- Panel ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.pathbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.breadcrumb {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.breadcrumb a, .breadcrumb .crumb-current {
  color: var(--text);
  text-decoration: none;
  padding: 3px 6px;
  border-radius: 6px;
}

.breadcrumb a:hover {
  background: var(--surface-3);
  color: var(--amber);
  cursor: pointer;
}

.breadcrumb .sep {
  color: var(--text-muted);
  opacity: 0.5;
}

.pathbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.85rem;
  border-radius: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover { border-color: var(--amber-dim); color: var(--amber); }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.btn-primary {
  background: var(--amber);
  color: #1a1305;
  border-color: var(--amber);
  font-weight: 600;
}
.btn-primary:hover { background: #ffb840; color: #1a1305; }

.btn-ghost { background: transparent; }

.btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 5px 7px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.btn-icon:hover { color: var(--amber); border-color: var(--amber-dim); background: rgba(245,166,35,0.08); }
.btn-icon.danger:hover { color: var(--red); border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.08); }
.btn-icon:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

/* ---------- Dropzone ---------- */

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  margin-bottom: 6px;
}

.dropzone:hover, .dropzone:focus-visible, .dropzone.drag-over {
  border-color: var(--amber);
  background: rgba(245, 166, 35, 0.05);
  outline: none;
}

.dropzone-meter {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 4px;
  height: 26px;
  margin-bottom: 12px;
}

.dropzone-meter span {
  width: 5px;
  height: 8px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s ease;
}

.dropzone.drag-over .dropzone-meter span,
.dropzone:hover .dropzone-meter span {
  background: var(--amber);
  animation: meter 0.9s ease-in-out infinite;
}

.dropzone-meter span:nth-child(1) { animation-delay: 0s; }
.dropzone-meter span:nth-child(2) { animation-delay: 0.1s; }
.dropzone-meter span:nth-child(3) { animation-delay: 0.2s; }
.dropzone-meter span:nth-child(4) { animation-delay: 0.1s; }
.dropzone-meter span:nth-child(5) { animation-delay: 0s; }

@keyframes meter {
  0%, 100% { height: 8px; }
  50% { height: 24px; }
}

.dropzone-title {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.dropzone-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 14px;
}

/* ---------- Upload progress list ---------- */

.uploads {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
}

.upload-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.upload-item-name {
  font-family: var(--mono);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item-status { color: var(--text-muted); flex-shrink: 0; }
.upload-item-status.ok { color: var(--green); }
.upload-item-status.error { color: var(--red); }

.upload-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}

.upload-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--amber);
  transition: width 0.2s ease;
}

.upload-item.ok .upload-bar-fill { background: var(--green); }
.upload-item.error .upload-bar-fill { background: var(--red); }

/* ---------- Listing ---------- */

.listing { margin-top: 20px; }

.listing-head, .row {
  display: grid;
  grid-template-columns: 1fr 90px 150px 110px;
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
}

.listing-head {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.listing-body .row {
  border-bottom: 1px solid var(--border);
  border-radius: 6px;
}

.listing-body .row:hover { background: var(--surface-2); }

.col-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}

.name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row[data-type="dir"] .name-text { font-weight: 600; }

.icon { font-size: 1.05rem; flex-shrink: 0; width: 1.3em; text-align: center; }

.col-size, .col-modified {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.row-actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 30px 10px;
  font-size: 0.9rem;
}

.preview {
  padding: 10px 8px 18px;
  border-bottom: 1px solid var(--border);
}

.preview audio, .preview video {
  width: 100%;
  max-height: 360px;
  border-radius: 8px;
  background: #000;
}

/* ---------- Footer ---------- */

.foot {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .listing-head { display: none; }
  .row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 8px;
  }
  .col-size, .col-modified {
    display: inline-block;
  }
  .col-actions { justify-content: flex-start; margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .dropzone-meter span, .onair-dot { animation: none !important; }
}
