:root {
  color-scheme: dark;
  font-family: Inter, Segoe UI, system-ui, sans-serif;
  background: #080b10;
  color: #f5f7fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(52, 114, 255, 0.16), transparent 28rem),
    linear-gradient(135deg, #0a0d13 0%, #10141d 56%, #090b10 100%);
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  height: 100vh;
  overflow: hidden;
}

.studio {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(300px, 1fr) auto 170px;
  gap: 14px;
  padding: 18px;
}

.topbar,
.prompt-panel,
.advanced-panel,
.output-panel,
.recent-drawer {
  background: rgba(17, 22, 32, 0.86);
  border: 1px solid rgba(125, 151, 190, 0.18);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  letter-spacing: 0;
}

h2 {
  font-size: 13px;
  text-transform: uppercase;
  color: #8fb0ff;
}

#statusLine,
#phaseLine {
  color: #91a0b8;
  font-size: 12px;
  margin-top: 4px;
}

.top-actions,
.generate-row,
.drawer-head,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(280px, 42%) minmax(320px, 1fr);
  gap: 14px;
  min-height: 0;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
  border: 1px dashed rgba(125, 168, 255, 0.5);
  border-radius: 12px;
  background: rgba(5, 8, 13, 0.72);
  overflow: hidden;
  cursor: pointer;
}

.drop-zone input {
  display: none;
}

.drop-zone span {
  z-index: 2;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.84);
  color: #b8c5dd;
}

.drop-zone.dragover {
  border-color: #73a4ff;
  box-shadow: inset 0 0 0 2px rgba(73, 126, 255, 0.25);
}

#sourcePreview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  background: #05070a;
}

.prompt-panel {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto auto;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
}

.prompt-panel label,
.advanced-panel label {
  font-size: 12px;
  color: #aebbd2;
}

textarea,
input {
  width: 100%;
  color: #f7f9ff;
  background: #080c13;
  border: 1px solid #273244;
  border-radius: 8px;
  outline: none;
}

textarea {
  resize: none;
  padding: 14px;
  line-height: 1.45;
}

input {
  margin-top: 5px;
  padding: 8px 10px;
}

textarea:focus,
input:focus {
  border-color: #4f82ff;
  box-shadow: 0 0 0 2px rgba(79, 130, 255, 0.18);
}

.generate-button,
.ghost-button {
  border: 0;
  border-radius: 8px;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
}

.generate-button {
  min-width: 150px;
  background: #3976ff;
  color: white;
  font-weight: 700;
}

.generate-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ghost-button {
  background: #182033;
  color: #dbe6ff;
}

.meter {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #080c13;
  overflow: hidden;
}

#progressBar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #3f7dff, #77e7ff);
  transition: width 0.28s ease;
}

.advanced-panel {
  padding: 14px;
  border-radius: 12px;
}

.advanced-panel.hidden {
  display: none;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.toggle-row {
  margin-top: 12px;
}

.toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toggle-row input {
  width: auto;
  margin: 0;
}

.output-panel {
  border-radius: 12px;
  overflow: hidden;
}

.output-panel.dragover {
  border-color: #72a5ff;
  box-shadow: inset 0 0 0 2px rgba(68, 128, 255, 0.35);
}

#mainVideo {
  width: 100%;
  height: 100%;
  display: block;
  background: #05070a;
}

.recent-drawer {
  border-width: 0 0 0 1px;
  border-radius: 0;
  padding: 14px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.drawer-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.recent-list {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 4px;
}

.recent-card {
  border: 1px solid #263249;
  border-radius: 8px;
  overflow: hidden;
  background: #0b1019;
  cursor: pointer;
}

.recent-card video {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #05070a;
}

.recent-meta {
  padding: 8px;
}

.recent-meta strong {
  display: block;
  font-size: 12px;
  color: #f5f7fb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-meta span {
  display: block;
  color: #8d9ab0;
  font-size: 11px;
  margin-top: 3px;
}

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

  .recent-drawer {
    display: none;
  }

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

  .advanced-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}
