:root {
  --bg: #020202;
  --panel: #0b0b0b;
  --panel-2: #111111;
  --line: #2a2a2a;
  --line-soft: #1e1e1e;
  --text: #f2f2f2;
  --text-soft: #b5b5b5;
  --accent: #2ea878;
  --accent-2: #1f7c58;
  --danger: #ff5d6b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top, #090909 0%, var(--bg) 58%);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  overflow: hidden;
}

.hud-layout {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 360ms ease, transform 420ms ease;
}

body.app-enter .hud-layout {
  opacity: 0;
  transform: translateY(10px);
}

body.app-enter.app-enter-active .hud-layout {
  opacity: 1;
  transform: translateY(0);
}

input,
button {
  font-family: "IBM Plex Mono", monospace;
}

.hud-layout {
  height: 100dvh;
  padding: 14px;
  display: grid;
  gap: 10px;
  grid-template-columns: 320px 1fr;
  grid-template-rows: 152px minmax(0, 1fr);
  grid-template-areas:
    "search topnav"
    "options main";
  overflow: hidden;
}

.hud-panel {
  background: linear-gradient(180deg, rgba(17, 17, 17, 0.97), rgba(10, 10, 10, 0.95));
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 10px rgba(0, 0, 0, 0.45);
  padding: 12px;
  overflow: hidden;
}

.panel-title {
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #efefef;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.panel-subtext {
  color: var(--text-soft);
  font-size: 12px;
}

.panel-search {
  grid-area: search;
}

.panel-options {
  grid-area: options;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.panel-topnav {
  grid-area: topnav;
}

.panel-main {
  grid-area: main;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.search-wrap {
  position: relative;
}

input[type="text"] {
  width: 100%;
  background: #050505;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  outline: none;
  padding: 9px 10px;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(46, 168, 120, 0.22);
}

.manual-box {
  margin-top: 12px;
  display: grid;
  gap: 7px;
  border-top: 1px dashed var(--line-soft);
  padding-top: 10px;
}

.panel-options .manual-box {
  margin-top: 2px;
}

.manual-title {
  font-size: 12px;
  color: var(--text-soft);
}

.btn-secondary {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #151515, #0f0f0f);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 2px;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--accent);
  box-shadow: 0 0 6px rgba(46, 168, 120, 0.2);
}

.options-grid {
  display: grid;
  gap: 10px;
}

.option-row {
  display: grid;
  gap: 6px;
}

.option-row > span {
  color: var(--text-soft);
  font-size: 12px;
}

.switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.switch button {
  border: 1px solid var(--line-soft);
  background: #0a0a0a;
  color: var(--text-soft);
  padding: 8px 4px;
  border-radius: 2px;
  cursor: pointer;
}

.switch button.active {
  border-color: var(--accent);
  color: #ffffff;
  background: #101010;
  box-shadow: inset 0 0 0 1px rgba(46, 168, 120, 0.2);
}

.csv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-soft);
  font-size: 12px;
}

.csv-preview {
  margin: 0;
  border: 1px solid var(--line-soft);
  background: #050505;
  min-height: 220px;
  max-height: 48vh;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  color: #e4e4e4;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mode-tabs button {
  border: 1px solid var(--line-soft);
  background: #0a0a0a;
  color: var(--text-soft);
  border-radius: 2px;
  padding: 8px 10px;
  cursor: pointer;
}

.mode-tabs button.active {
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(46, 168, 120, 0.2);
}

.status-strip {
  display: block;
}

.disk-block {
  border: 1px solid var(--line-soft);
  background: #080808;
  border-radius: 2px;
  padding: 8px;
  width: 100%;
}

.main-path {
  font-size: 11px;
  color: #868686;
  margin-bottom: 8px;
  border-bottom: 1px dashed #202020;
  padding-bottom: 6px;
}

#breadcrumb {
  color: #8e8e8e;
  word-break: break-word;
}

.disk-head {
  display: flex;
  justify-content: space-between;
  color: var(--text-soft);
  margin-bottom: 6px;
  font-size: 12px;
}

.disk-bar-bg {
  height: 20px;
  border: 1px solid var(--line-soft);
  background: #040404;
}

.disk-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1f7c58, #2ea878);
  color: #04140d;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  transition: width 320ms ease;
}

.view {
  display: none;
  height: calc(100% - 30px);
  overflow: auto;
  min-height: 0;
}

.view.active {
  display: block;
}

.storage-info {
  position: absolute;
  right: 12px;
  top: 12px;
  width: min(360px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  border: 1px solid var(--line);
  background: rgba(7, 10, 8, 0.92);
  box-shadow: 0 0 18px rgba(46, 168, 120, 0.16);
  backdrop-filter: blur(2px);
  border-radius: 3px;
  padding: 10px;
  z-index: 5;
}

.storage-info-title {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.storage-info-body {
  font-size: 12px;
  color: #d8e6de;
  line-height: 1.45;
}

.storage-info-list {
  margin: 8px 0 0;
  padding-left: 14px;
}

.storage-info-list li {
  margin-bottom: 4px;
}

.storage-kv {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 2px 8px;
}

.storage-k {
  color: #93c7b1;
}

.explorer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.explorer-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  color: #f0f0f0;
  font-weight: 700;
}

.card-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.media-card {
  border: 1px solid var(--line-soft);
  background: #080808;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cover-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  background: #0e0e0e;
  overflow: hidden;
}

.cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 32px;
  color: #d8d8d8;
  background: linear-gradient(135deg, #1a1a1a, #101010);
}

.card-body {
  padding: 10px;
  display: grid;
  gap: 6px;
}

.card-title {
  color: #f5f5f5;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
}

.card-subtitle {
  color: var(--text-soft);
  font-size: 12px;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.card-actions button {
  flex: 1;
  margin: 0;
  border: 1px solid var(--line-soft);
  background: #101010;
  color: var(--text);
  padding: 7px;
  cursor: pointer;
  border-radius: 2px;
}

.card-actions button:hover {
  border-color: var(--accent);
}

.loading-skeleton {
  background: linear-gradient(90deg, #111111 25%, #1b1b1b 50%, #111111 75%);
  background-size: 200% 100%;
  animation: sweep 1.2s linear infinite;
}

@keyframes sweep {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.tiny-loader {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid rgba(46, 168, 120, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

.empty-state {
  border: 1px dashed var(--line-soft);
  padding: 16px;
  text-align: center;
  color: var(--text-soft);
}

.download-btn {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  border: 1px solid #2ea878;
  background: linear-gradient(180deg, #1f7c58, #1a6649);
  color: #f5fffa;
  padding: 15px 34px;
  border-radius: 3px;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(46, 168, 120, 0.25);
  z-index: 80;
}

.download-btn:hover {
  box-shadow: 0 0 15px rgba(46, 168, 120, 0.3);
}

.job-sections {
  display: grid;
  gap: 14px;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stats-kpi {
  border: 1px solid var(--line-soft);
  background: #080808;
  border-radius: 3px;
  padding: 10px;
}

.stats-kpi-label {
  color: var(--text-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stats-kpi-value {
  margin-top: 6px;
  font-size: 26px;
  color: #f5f5f5;
  font-weight: 700;
  line-height: 1;
}

.stats-kpi-sub {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 11px;
}

.chart-card {
  border: 1px solid var(--line-soft);
  background: #070707;
  border-radius: 3px;
  margin-bottom: 10px;
  padding: 10px;
}

.chart-head {
  margin-bottom: 8px;
}

.stats-canvas {
  display: block;
  width: 100%;
  height: 260px;
  background: linear-gradient(180deg, rgba(46, 168, 120, 0.04), rgba(0, 0, 0, 0));
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.selection-list {
  display: grid;
  gap: 8px;
}

.selection-row {
  border: 1px solid var(--line-soft);
  background: #0a0a0a;
  border-radius: 2px;
  padding: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.selection-text {
  color: #d8d8d8;
  font-size: 12px;
  line-height: 1.4;
}

.selection-row .btn-secondary {
  margin: 0;
  padding: 6px 10px;
  white-space: nowrap;
}

.jobs-title {
  color: #f0f0f0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  margin-bottom: 8px;
}

.job-list {
  display: grid;
  gap: 8px;
}

.job-card {
  border: 1px solid var(--line-soft);
  background: #080808;
  padding: 10px;
  border-radius: 3px;
  display: grid;
  gap: 8px;
}

.job-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.job-name {
  color: #f0f0f0;
}

.job-meta {
  color: var(--text-soft);
  font-size: 12px;
}

.badge {
  padding: 2px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  font-size: 11px;
  text-transform: uppercase;
}

.badge.running,
.badge.pending {
  border-color: #3a8d68;
  color: #cdeedf;
}

.badge.success {
  border-color: #2ea878;
  color: #dcf7eb;
}

.badge.failed {
  border-color: #ff8a97;
  color: #ffc2ca;
}

.job-progress-bg {
  height: 14px;
  border: 1px solid var(--line-soft);
  background: #050505;
}

.job-progress {
  height: 100%;
  background: linear-gradient(90deg, #1f7c58, #2ea878);
  color: #042419;
  font-size: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.job-albums {
  color: #c7c7c7;
  font-size: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-card {
  width: min(94vw, 980px);
  max-height: 78vh;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0a0a;
  border-radius: 4px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

#log-content {
  margin: 0;
  color: #ececec;
  padding: 10px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 12px;
}

.album-detail {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  align-items: start;
}

.detail-cover {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  max-height: 260px;
}

@media (max-width: 980px) {
  .hud-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(140px, 24vh) minmax(0, 1fr);
    grid-template-areas:
      "search"
      "topnav"
      "options"
      "main";
    padding: 10px;
    overflow: hidden;
    height: 100dvh;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .panel-search,
  .panel-options,
  .panel-topnav,
  .panel-main {
    min-height: initial;
  }

  .panel-main {
    min-height: 0;
    overflow: hidden;
  }

  .panel-options {
    min-height: 0;
    overflow: auto;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .card-body {
    padding: 8px;
  }

  .card-title {
    font-size: 12px;
  }

  .csv-preview {
    min-height: 120px;
    max-height: 16vh;
  }

  .view {
    height: calc(100% - 28px);
  }

  .download-btn {
    width: calc(100% - 20px);
    left: 10px;
    transform: none;
    bottom: 16px;
  }

  .album-detail {
    grid-template-columns: 1fr;
  }

  .detail-cover {
    width: min(100%, 220px);
    min-width: 0;
    max-width: 220px;
    max-height: 220px;
    margin: 0 auto;
  }
}
