:root {
  color-scheme: dark;
  --bg: #111215;
  --panel: #181a1f;
  --panel-2: #20242d;
  --panel-3: #272d37;
  --line: #313846;
  --text: #f3f5f8;
  --muted: #aeb7c7;
  --green: #57d19a;
  --blue: #6bb5ff;
  --gold: #f0be67;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(107, 181, 255, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(87, 209, 154, 0.07), transparent 24%),
    var(--bg);
  color: var(--text);
}

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

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

.sidebar {
  padding: 28px;
  border-right: 1px solid var(--line);
  background: rgba(12, 14, 18, 0.82);
  backdrop-filter: blur(12px);
}

.workspace {
  padding: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
}

.brand-block h1,
.hero-strip h2,
.empty-copy h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 34px;
  line-height: 1.05;
}

.lede {
  color: var(--muted);
  line-height: 1.6;
}

.control-stack {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.field {
  display: grid;
  gap: 8px;
}

.upload-drop {
  display: block;
  padding: 16px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  background: rgba(24, 26, 31, 0.72);
  cursor: pointer;
}

.upload-drop input {
  display: none;
}

.upload-copy strong {
  display: block;
  font-size: 15px;
}

.upload-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.reference-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.reference-chip {
  padding: 10px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.reference-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}

.reference-name {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.field span,
.status-label,
.slide-index {
  color: var(--muted);
  font-size: 13px;
}

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

input,
textarea,
select {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  padding: 13px 14px;
}

textarea {
  resize: vertical;
  min-height: 220px;
}

.grid-two,
.button-row,
.pill-row {
  display: grid;
  gap: 12px;
}

.grid-two,
.button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

button {
  min-height: 46px;
  padding: 0 16px;
  cursor: pointer;
  color: var(--text);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover:enabled {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary {
  background: linear-gradient(135deg, #6bb5ff, #57d19a);
  color: #0d1117;
  border: none;
  font-weight: 700;
}

.secondary {
  background: var(--panel-2);
}

.ghost {
  background: transparent;
}

.status-panel,
.board,
.slide-card,
.hero-strip {
  background: rgba(24, 26, 31, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-panel {
  margin-top: 18px;
  padding: 14px 16px;
}

.cost-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

#cost-text {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
}

.hero-strip {
  padding: 18px 20px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.hero-strip h2 {
  margin-top: 4px;
  font-size: clamp(24px, 2.2vw, 34px);
}

.pill-row {
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
}

.pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.board {
  margin-top: 20px;
  min-height: calc(100vh - 132px);
  padding: 18px;
}

.loading-panel {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 8px;
  background: rgba(18, 33, 28, 0.6);
  border: 1px solid rgba(87, 209, 154, 0.25);
}

.loading-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.loading-head h3 {
  margin: 0;
  font-size: 20px;
}

.loading-text {
  margin: 12px 0 0;
  color: #d8efe3;
  line-height: 1.7;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid rgba(87, 209, 154, 0.2);
  border-top-color: var(--green);
  animation: spin 0.9s linear infinite;
}

.style-summary {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 8px;
  background: rgba(17, 21, 27, 0.82);
  border: 1px solid var(--line);
}

.style-summary-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.collapsible-summary {
  padding: 0;
  overflow: hidden;
}

.style-summary-toggle {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
}

.style-summary-toggle::-webkit-details-marker {
  display: none;
}

.style-summary-toggle-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.style-summary-head h3 {
  margin: 0;
  font-size: 20px;
}

.style-summary-badge {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(87, 209, 154, 0.12);
  color: var(--green);
  font-size: 12px;
}

.style-summary-text {
  margin: 12px 0 0;
  color: #d3d9e4;
  line-height: 1.7;
  white-space: pre-wrap;
}

.collapsible-summary .style-summary-text {
  margin: 0;
  padding: 0 18px 18px;
}

.chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 140ms ease;
  margin-top: 2px;
}

.collapsible-summary[open] .chevron {
  transform: rotate(225deg);
}

.slides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.empty-state {
  place-items: center;
  min-height: 420px;
}

.empty-copy {
  text-align: center;
  max-width: 420px;
}

.empty-copy p {
  color: var(--muted);
}

.slide-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.slide-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.slide-card-head h3 {
  margin: 4px 0 0;
  font-size: 18px;
}

.slide-badge {
  align-self: start;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(107, 181, 255, 0.12);
  color: var(--blue);
}

.slide-preview-wrap {
  background: #0e1116;
  border-radius: 8px;
  overflow: hidden;
}

.slide-preview {
  width: 100%;
  background: #0d1014;
  display: grid;
  place-items: center;
  overflow: hidden;
}

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

.slide-image:not([src]) {
  display: none;
}

.slide-placeholder {
  color: #8d98ab;
  font-size: 14px;
}

.slide-copy {
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

.slide-meta {
  display: grid;
  gap: 8px;
  color: #c9d2df;
  font-size: 14px;
}

.slide-edit {
  display: grid;
  gap: 10px;
}

.slide-comment {
  min-height: 110px;
}

.slide-regenerate-btn {
  width: 100%;
}

.meta-chip {
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.has-error .meta-chip:first-child {
  border-color: rgba(240, 80, 80, 0.4);
  background: rgba(240, 80, 80, 0.08);
  color: #ffb3b3;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 12, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(100%, 520px);
  padding: 22px;
  border-radius: 8px;
  background: rgba(24, 26, 31, 0.98);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.modal-head h3 {
  margin: 0;
  font-size: 26px;
}

.icon-btn {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 22px;
  line-height: 1;
}

.modal-copy,
.modal-help {
  color: var(--muted);
  line-height: 1.6;
}

.modal-copy {
  margin: 14px 0 0;
}

.modal-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.modal-actions {
  display: grid;
}

.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

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

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-strip {
    flex-direction: column;
    align-items: start;
  }

  .pill-row {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .sidebar,
  .workspace {
    padding: 18px;
  }

  .grid-two,
  .button-row {
    grid-template-columns: 1fr;
  }

  .slides-grid {
    grid-template-columns: 1fr;
  }
}
