:root {
  color-scheme: dark;
  --bg: #0a0b0d;
  --panel: #12151a;
  --panel-raised: #181c22;
  --line: #2a3038;
  --muted: #929ba8;
  --text: #f4f6f8;
  --accent: #c8ff3d;
  --accent-ink: #101500;
  --danger: #ff756f;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 300px;
  margin: 0;
  background:
    radial-gradient(circle at 80% -10%, rgb(200 255 61 / 10%), transparent 35rem),
    var(--bg);
  color: var(--text);
}

button,
select,
input {
  font: inherit;
}

button,
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101318;
  color: var(--text);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

.masthead,
main,
footer {
  width: min(1560px, calc(100% - 40px));
  margin-inline: auto;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 44px 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.summary {
  margin: 12px 0 0;
  color: var(--muted);
}

.prompt-panel,
.sync-panel {
  border: 1px solid var(--line);
  background: rgb(18 21 26 / 90%);
  box-shadow: 0 20px 60px rgb(0 0 0 / 18%);
}

.prompt-panel {
  border-radius: var(--radius) var(--radius) 0 0;
  padding: clamp(18px, 3vw, 30px);
}

.prompt-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-filter {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c0e12;
}

.mode-filter button {
  min-width: 58px;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.mode-filter button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.prompt-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.prompt-select-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prompt-select-label select {
  width: 100%;
  padding: 11px 40px 11px 12px;
  text-transform: none;
}

.icon-button {
  width: 43px;
  height: 43px;
  font-size: 1.15rem;
}

.prompt-content {
  display: flex;
  align-items: flex-start;
  gap: clamp(18px, 3vw, 34px);
  margin-top: 24px;
}

.prompt-image-panel {
  flex: 0 0 min(28vw, 280px);
  margin: 0;
}

.prompt-image-open {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border-color: rgb(255 255 255 / 18%);
  background: #08090b;
}

.prompt-image-open img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.prompt-image-panel figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

.prompt-text {
  max-width: 110ch;
  margin: 10px 0 16px;
  font-family: ui-serif, Georgia, serif;
  font-size: clamp(1.05rem, 1.65vw, 1.45rem);
  line-height: 1.55;
}

.prompt-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.mode-badge {
  display: inline-flex;
  padding: 5px 10px;
  border: 1px solid rgb(103 194 255 / 48%);
  border-radius: 999px;
  color: #67c2ff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.mode-badge[data-mode="i2v"] {
  border-color: rgb(200 255 61 / 48%);
  color: var(--accent);
}

.image-dialog {
  width: min(94vw, 1400px);
  max-width: none;
  max-height: 94vh;
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #060708;
  box-shadow: 0 30px 100px rgb(0 0 0 / 70%);
}

.image-dialog::backdrop {
  background: rgb(0 0 0 / 82%);
  backdrop-filter: blur(7px);
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: calc(94vh - 2px);
  border-radius: inherit;
  object-fit: contain;
}

.image-dialog-close {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-color: rgb(255 255 255 / 25%);
  border-radius: 50%;
  background: rgb(10 11 13 / 78%);
  font-size: 1.35rem;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
}

.sync-panel {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  padding: 13px clamp(16px, 3vw, 28px);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  backdrop-filter: blur(16px);
}

.toggle,
.audio-select {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.toggle input {
  accent-color: var(--accent);
}

.audio-select select {
  max-width: 170px;
  padding: 7px 9px;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  padding: 8px 14px;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
}

.timeline {
  display: grid;
  grid-template-columns: 60px minmax(120px, 1fr) 60px;
  align-items: center;
  flex: 1 1 320px;
  gap: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  text-align: center;
}

.timeline input {
  width: 100%;
  accent-color: var(--accent);
}

.sync-status {
  min-width: 84px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 18px;
}

.result-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 18px 14px;
}

.card-header h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.card-subtitle {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.status-badge[data-status="complete"] {
  border-color: rgb(200 255 61 / 45%);
  color: var(--accent);
}

.status-badge[data-status="failed"] {
  border-color: rgb(255 117 111 / 45%);
  color: var(--danger);
}

.video-frame {
  position: relative;
  display: grid;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  border-block: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgb(200 255 61 / 6%), transparent 44%),
    #090b0e;
}

.video-frame video {
  width: 100%;
  height: 100%;
  background: #060708;
  object-fit: contain;
}

.load-video {
  position: absolute;
  inset: 50% auto auto 50%;
  padding: 10px 14px;
  transform: translate(-50%, -50%);
  border-color: rgb(255 255 255 / 25%);
  background: rgb(10 11 13 / 78%);
  box-shadow: 0 10px 30px rgb(0 0 0 / 35%);
  backdrop-filter: blur(8px);
}

.load-video[hidden] {
  display: none;
}

.unavailable {
  padding: 26px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.unavailable strong {
  display: block;
  margin-bottom: 5px;
  color: var(--danger);
}

.card-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
}

.card-details div {
  min-width: 0;
  padding: 11px 13px;
  background: var(--panel-raised);
}

.card-details dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.card-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

.empty-state,
.fatal-error {
  padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state h2,
.fatal-error h2 {
  color: var(--text);
}

footer {
  padding: 28px 0 42px;
  color: var(--muted);
  font-size: 0.75rem;
}

@media (max-width: 700px) {
  .masthead,
  main,
  footer {
    width: min(100% - 24px, 1560px);
  }

  .masthead {
    align-items: flex-start;
    padding-top: 28px;
  }

  .masthead .secondary-button {
    padding-inline: 10px;
  }

  .sync-panel {
    position: static;
  }

  .prompt-content {
    display: block;
  }

  .prompt-filter-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .prompt-image-panel {
    width: min(100%, 360px);
    margin-bottom: 18px;
  }

  .sync-status {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
