:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181a1f;
  --panel-2: #20232a;
  --line: #343842;
  --text: #f4f1e8;
  --muted: #a8afbc;
  --accent: #5fb3a8;
  --accent-2: #e8bd65;
  --danger: #ee6d6a;
  --shadow: 0 16px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, textarea, select { font: inherit; }

button, input, textarea, select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111318;
  color: var(--text);
}

button {
  height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover { border-color: var(--accent); }
button:disabled { cursor: not-allowed; opacity: .45; }

.primary {
  width: 100%;
  border-color: transparent;
  background: var(--accent);
  color: #061412;
  font-weight: 700;
}

.danger:hover { border-color: var(--danger); color: var(--danger); }

.app {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #0c0d10;
}

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

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent-2);
  color: #16120a;
  font-weight: 800;
}

h1, h2, p { margin: 0; }
.brand h1 { font-size: 20px; }
.brand p, .meta, .empty p, label { color: var(--muted); }

.panel { display: grid; gap: 14px; }

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
}

input, textarea, select {
  width: 100%;
  padding: 10px 11px;
}

.dropZone {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 98px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #111318;
  color: var(--text);
  text-align: center;
  outline: none;
}

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

.dropZone.dragging,
.dropZone:focus-visible {
  border-color: var(--accent);
  background: rgba(95, 179, 168, .12);
}

textarea {
  min-height: 42px;
  resize: vertical;
  line-height: 1.5;
}

.split {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 10px;
}

.split.three { grid-template-columns: minmax(0, 1fr) 112px 88px; }

.workspace {
  min-width: 0;
  padding: 24px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px repeat(5, auto);
  gap: 10px;
  padding-bottom: 18px;
  background: var(--bg);
}

.hidden { display: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats strong {
  display: block;
  font-size: 24px;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.thumb {
  aspect-ratio: 16 / 10;
  background: var(--panel-2);
  background-size: cover;
  background-position: center;
}

.thumb.emptyThumb {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.cardBody {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.selectRow {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  color: var(--muted);
}

.selectRow input {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--accent);
}

.cardTop {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.cardTop h2 {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.rating {
  flex: 0 0 auto;
  color: var(--accent-2);
  font-size: 14px;
  white-space: nowrap;
}

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

.tag {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.promptBlock textarea { min-height: 76px; }

.actions {
  display: flex;
  gap: 8px;
}

.actions button { flex: 1; }

.empty {
  display: none;
  place-items: center;
  min-height: 45vh;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.empty.visible { display: grid; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .sidebar, .workspace { padding: 16px; }
  .stats, .cards, .split, .split.three { grid-template-columns: 1fr; }
}