:root {
  --bg-1: #0d1221;
  --bg-2: #1f1b3a;
  --card: rgba(15, 18, 36, 0.72);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f8fafc;
  --muted: #b4bed2;
  --accent: #16a34a;
  --accent-2: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(1200px 700px at -10% -10%, #2c355e 0%, transparent 50%), linear-gradient(130deg, var(--bg-1) 0%, var(--bg-2) 100%);
  font-family: Manrope, sans-serif;
  min-height: 100vh;
}

.ambient {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(transparent 96%, rgba(255, 255, 255, 0.06) 96%), linear-gradient(90deg, transparent 96%, rgba(255, 255, 255, 0.06) 96%);
  background-size: 30px 30px;
  mask-image: radial-gradient(circle at center, black 20%, transparent 75%);
  pointer-events: none;
}

.shell {
  width: min(1180px, 94vw);
  margin: 28px auto;
  position: relative;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.hero-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: clamp(62px, 6vw, 82px);
  height: clamp(62px, 6vw, 82px);
  display: block;
  filter: drop-shadow(0 14px 26px rgba(17, 74, 180, 0.24));
  flex: none;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.6vw, 2.8rem);
  font-family: "Playfair Display", serif;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.api-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.card.sale-card {
  max-width: 360px;
  font-weight: 700;
  background: #ffffff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.18);
}

.card.sale-card h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
  color: #1e40af;
}

.card.sale-card p {
  margin-top: 6px;
  font-size: 0.84rem;
  color: #1d4ed8;
  font-weight: 700;
  line-height: 1.45;
}

.card.sale-card a,
.card.sale-card a:visited {
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
}

.card.sale-card a:hover {
  color: #1e3a8a;
  text-decoration: underline;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
}

.tab.active {
  border-color: color-mix(in srgb, var(--accent) 65%, white 35%);
  background: rgba(22, 163, 74, 0.2);
}

.panel {
  display: none;
  margin-top: 14px;
}

.panel.active {
  display: block;
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid.compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.grid.compact > div {
  min-width: 0;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  backdrop-filter: blur(8px);
  padding: 16px;
}

label {
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cdd8ec;
  font-weight: 700;
}

textarea,
select,
input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.92);
  color: #cdd8ec;
  color-scheme: dark;
  padding: 10px;
  font: inherit;
}

select option {
  background: #111827;
  color: #cdd8ec;
}

input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.92);
  color: #cdd8ec;
  color-scheme: dark;
  padding: 10px;
  font: inherit;
}

select:focus,
textarea:focus,
input[type="file"]:focus {
  outline: none;
  border-color: rgba(125, 211, 252, 0.6);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.switch-row {
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.is-loading {
  opacity: 0.78;
  filter: saturate(0.9);
}

.preview {
  border: 1px dashed rgba(255, 255, 255, 0.3);
  min-height: 380px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.4);
}

.preview img,
.preview video {
  max-width: 100%;
  max-height: 520px;
  border-radius: 10px;
}

#imagePreview img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 10px;
}

#imagePreview {
  padding: 0;
  overflow: hidden;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 10px;
}

.analysis-meta {
  display: flex;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.analysis-output {
  border: 1px dashed rgba(255, 255, 255, 0.3);
  min-height: 380px;
  border-radius: 12px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  overflow: auto;
}

.video-review {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(5, 20, 40, 0.45);
}

.video-review h3 {
  margin: 0 0 8px;
}

#analysisVideoPlayer {
  width: 100%;
  max-height: 360px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #02070e;
}

.chunk-timeline {
  margin-top: 10px;
  position: relative;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(4, 17, 34, 0.85);
  overflow: hidden;
}

.chunk-segment {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border: 1px solid rgba(2, 132, 199, 0.45);
  background: rgba(14, 165, 233, 0.22);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
}

.chunk-segment.active {
  background: rgba(56, 189, 248, 0.52);
  border-color: rgba(125, 211, 252, 0.95);
}

.timing-link {
  border: 0;
  background: transparent;
  color: #93c5fd;
  cursor: pointer;
  font-weight: 700;
  padding: 0;
}

.timing-link:hover {
  text-decoration: underline;
}

.summary-point-link {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(9, 38, 68, 0.65);
  color: var(--text);
  cursor: pointer;
  padding: 8px 10px;
  margin: 4px 0;
}

.summary-point-link:hover {
  border-color: var(--line);
  background: rgba(11, 48, 84, 0.85);
}

.topic-item {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  margin: 5px 0;
  background: rgba(9, 31, 54, 0.55);
}

.topic-item.active-topic {
  border-color: rgba(125, 211, 252, 0.9);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.25) inset;
}

.analysis-answer {
  margin-bottom: 16px;
  line-height: 1.6;
}

.analysis-answer h3 {
  margin: 0 0 8px;
}

.resize-box {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.resize-box h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.status {
  margin-top: 12px;
  min-height: 24px;
  color: #fcd34d;
  font-size: 0.92rem;
  transition: color 150ms ease;
}

.status[data-state="loading"] {
  animation: pulse-status 1s ease-in-out infinite;
}

@keyframes pulse-status {
  0% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.75;
  }
}

@media (max-width: 980px) {
  .grid.two {
    grid-template-columns: 1fr;
  }

  .grid.compact {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
    align-items: start;
  }

  .hero-side {
    width: 100%;
    align-items: flex-start;
  }

  .sale-card {
    max-width: 100%;
  }
}
