:root {
  --bg: #07111f;
  --bg-soft: #0e1a2b;
  --surface: rgba(10, 18, 33, 0.82);
  --surface-strong: rgba(16, 27, 46, 0.95);
  --text: #f7f3eb;
  --muted: #a7b3c7;
  --line: rgba(167, 179, 199, 0.16);
  --primary: #ff7a29;
  --primary-strong: #ff4d17;
  --secondary: #33d1c6;
  --secondary-strong: #0db0b3;
  --accent: #ffd166;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI Variable", "Aptos", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 41, 0.28), transparent 28%),
    radial-gradient(circle at top right, rgba(51, 209, 198, 0.22), transparent 22%),
    radial-gradient(circle at 50% 20%, rgba(255, 209, 102, 0.12), transparent 24%),
    linear-gradient(180deg, #07111f 0%, #0b1526 45%, #111f33 100%);
  min-height: 100vh;
}

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

.app-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 18px 14px 96px;
}

.topbar,
.section-head,
.queue-head,
.scene-card,
.toggle-row,
.channel-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar {
  margin-bottom: 18px;
}

.topbar h1,
.hero-copy h2,
.section-head h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

.topbar h1 {
  font-size: 1.75rem;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--secondary);
}

.mobile-layout {
  display: grid;
  gap: 18px;
}

.hero-card,
.preview-panel,
.panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card,
.preview-panel,
.panel {
  padding: 18px;
}

.hero-card::before,
.preview-panel::before,
.panel::before {
  content: "";
  position: absolute;
  inset: auto -30px -40px auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 122, 41, 0.2), transparent 70%);
  pointer-events: none;
}

.hero-badge,
.status-pill,
.ornament-chip,
.queue-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.78rem;
}

.hero-badge {
  padding: 9px 12px;
  background: rgba(255, 122, 41, 0.18);
  border: 1px solid rgba(255, 122, 41, 0.32);
  color: #ffd7be;
}

.hero-copy h2 {
  margin-top: 12px;
  font-size: 1.9rem;
  line-height: 1.02;
}

.hero-copy p {
  color: var(--muted);
  margin-bottom: 0;
}

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

.stat-card,
.timeline-card,
.queue-card,
.activity-card,
.scene-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.stat-card {
  padding: 14px;
}

.stat-card span,
.timeline-copy span,
.scene-card span,
.activity-card small,
.queue-card small,
.label-top,
.channel-card small {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 1.2rem;
}

.ghost-btn,
.primary-btn,
.secondary-btn,
.select-card,
.chip-button,
.link-btn {
  border: 0;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ghost-btn,
.link-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ghost-btn:hover,
.primary-btn:hover,
.secondary-btn:hover,
.select-card:hover,
.chip-button:hover,
.link-btn:hover,
.ghost-link:hover {
  transform: translateY(-1px);
}

.status-pill {
  padding: 8px 12px;
  background: rgba(51, 209, 198, 0.12);
  color: #aaf4ef;
  border: 1px solid rgba(51, 209, 198, 0.22);
}

.phone-stage {
  position: relative;
  margin-top: 16px;
  padding: 14px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)),
    #050b16;
}

.screen-glow {
  position: absolute;
  inset: 16px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(255, 122, 41, 0.25), transparent 34%),
    radial-gradient(circle at bottom right, rgba(51, 209, 198, 0.2), transparent 28%);
  filter: blur(20px);
}

.video-surface {
  position: relative;
  min-height: 480px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 122, 41, 0.16), transparent 28%),
    linear-gradient(145deg, rgba(8, 16, 26, 0.4), rgba(21, 38, 63, 0.95)),
    radial-gradient(circle at 50% 80%, rgba(255, 209, 102, 0.18), transparent 30%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.preview-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  opacity: 0.76;
  background: #050b16;
}

.video-meta,
.preview-ornaments,
.caption-stack,
.timeline-ghost {
  position: absolute;
  left: 18px;
  right: 18px;
}

.video-meta {
  top: 18px;
  display: flex;
  justify-content: space-between;
  color: #fff6e9;
}

.preview-ornaments {
  top: 66px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ornament-chip {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ornament-chip.primary {
  background: linear-gradient(135deg, rgba(255, 77, 23, 0.9), rgba(255, 122, 41, 0.85));
}

.caption-stack {
  bottom: 72px;
}

.caption-kicker {
  margin: 0 0 8px;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: #ffdbb9;
}

.caption-stack h4 {
  margin: 0 0 10px;
  font-size: 2.1rem;
  line-height: 0.94;
  max-width: 8ch;
}

.caption-stack p {
  margin: 0;
  max-width: 16ch;
  color: rgba(247, 243, 235, 0.86);
  font-size: 1rem;
}

.timeline-ghost {
  bottom: 18px;
  display: grid;
  gap: 6px;
}

.timeline-ghost span {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.timeline-ghost span:nth-child(1) {
  width: 42%;
  background: linear-gradient(90deg, var(--primary), rgba(255, 122, 41, 0.2));
}

.timeline-ghost span:nth-child(2) {
  width: 76%;
  background: linear-gradient(90deg, var(--secondary), rgba(51, 209, 198, 0.18));
}

.timeline-ghost span:nth-child(3) {
  width: 56%;
  background: linear-gradient(90deg, var(--accent), rgba(255, 209, 102, 0.18));
}

.scene-list,
.timeline-list,
.queue-list,
.activity-list,
.template-grid,
.chip-grid,
.channel-grid {
  display: grid;
  gap: 12px;
}

.scene-list {
  margin-top: 14px;
}

.scene-card,
.timeline-card,
.queue-card,
.activity-card,
.channel-card {
  padding: 14px;
}

.scene-card p,
.timeline-copy p,
.queue-card p,
.activity-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.upload-panel {
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.compact-btn {
  flex: 0 0 auto;
  min-width: 132px;
}

.helper-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.recent-uploads {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.upload-item {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-align: left;
}

.upload-item span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 15px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(51, 209, 198, 0.28);
  border-color: rgba(51, 209, 198, 0.35);
}

.full-span {
  grid-column: 1 / -1;
}

.range-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--muted);
}

.label-top {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

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

.select-card {
  padding: 14px;
  border-radius: var(--radius-lg);
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.select-card strong,
.chip-button strong,
.channel-card strong,
.timeline-copy strong,
.queue-card strong,
.activity-card strong {
  display: block;
}

.select-card small,
.chip-button span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.select-card.is-active,
.chip-button.is-active,
.channel-card.is-selected {
  border-color: rgba(255, 122, 41, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 122, 41, 0.16), rgba(255, 122, 41, 0.06)),
    rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 26px rgba(255, 77, 23, 0.16);
}

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

.chip-button {
  padding: 14px;
  border-radius: var(--radius-lg);
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.channel-card {
  display: grid;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
}

.channel-main {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.channel-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.toggle-row {
  padding: 14px 15px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.toggle-row input {
  width: 22px;
  height: 22px;
}

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

.primary-btn,
.secondary-btn {
  flex: 1;
  padding: 14px 16px;
  border-radius: 999px;
  color: white;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  box-shadow: 0 16px 30px rgba(255, 77, 23, 0.24);
}

.secondary-btn {
  background: linear-gradient(135deg, var(--secondary-strong), var(--secondary));
  box-shadow: 0 16px 30px rgba(13, 176, 179, 0.2);
}

.timeline-card {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 14px;
  align-items: start;
}

.timeline-track {
  width: 8px;
  min-height: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.timeline-copy small {
  display: inline-block;
  margin-top: 10px;
  color: #ffd7be;
}

.queue-progress {
  height: 8px;
  margin: 12px 0 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.queue-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
}

.queue-status {
  padding: 8px 10px;
  background: rgba(255, 209, 102, 0.14);
  color: #ffe4a2;
}

.activity-card small {
  display: inline-block;
  margin-top: 10px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(calc(100vw - 28px), 460px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 14, 26, 0.84);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.bottom-nav a {
  padding: 12px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
}

@media (min-width: 900px) {
  .app-shell {
    width: min(1180px, calc(100vw - 40px));
    padding: 28px 0 110px;
  }

  .mobile-layout {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
  }

  .hero-card,
  .preview-panel,
  .panel.form-panel {
    grid-column: span 1;
  }

  .hero-card {
    grid-column: 1 / -1;
  }

  .panel:nth-of-type(4),
  .panel:nth-of-type(5) {
    grid-column: span 1;
  }

  .panel:last-of-type {
    grid-column: 1 / -1;
  }

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

@media (max-width: 520px) {
  .upload-row,
  .actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .compact-btn,
  .primary-btn,
  .secondary-btn {
    width: 100%;
  }
}
