@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Figtree:wght@400;500;600;700&display=swap');

:root {
  --ink: #10141c;
  --ink-soft: #3d4656;
  --muted: #6b7588;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --line: rgba(16, 20, 28, 0.1);
  --accent: #e11d2e;
  --accent-hover: #c41626;
  --teal: #0f7a6e;
  --teal-hover: #0c6359;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(16, 20, 28, 0.1);
  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-body: 'Figtree', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: #dfe7f0;
  -webkit-font-smoothing: antialiased;
}

.app {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  padding: clamp(1.25rem, 4vw, 3rem);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(225, 29, 46, 0.18), transparent 55%),
    radial-gradient(800px 480px at 92% 8%, rgba(15, 122, 110, 0.16), transparent 50%),
    radial-gradient(700px 420px at 50% 110%, rgba(70, 110, 180, 0.14), transparent 55%),
    linear-gradient(160deg, #e8eef5 0%, #f4f6f9 42%, #e6edf4 100%);
}

.bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(16, 20, 28, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 20, 28, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  margin: 0 auto;
  padding-top: clamp(1.5rem, 8vh, 5rem);
}

.hero {
  margin-bottom: 1.75rem;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--ink);
}

.brand span {
  color: var(--accent);
}

.tagline {
  margin: 0;
  max-width: 28rem;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 500;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 1.35rem);
  animation: rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.form {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
}

.form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
  font: 500 1rem/1.2 var(--font-body);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form input::placeholder {
  color: var(--muted);
}

.form input:focus {
  border-color: rgba(225, 29, 46, 0.45);
  box-shadow: 0 0 0 4px rgba(225, 29, 46, 0.12);
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius);
  padding: 0.95rem 1.2rem;
  transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary.is-loading {
  position: relative;
  min-width: 7.5rem;
}

.btn-primary.is-loading::after {
  content: '';
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.7rem;
  height: 0.7rem;
  margin-top: -0.35rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.error {
  margin: 0.9rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 600;
  animation: rise 0.35s ease both;
}

.result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.thumb-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
  background: #c9d2de;
  margin-bottom: 1rem;
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  transition: transform 0.5s ease;
}

.result:hover .thumb-wrap img {
  transform: scale(1.06);
}

.title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.quality {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.quality label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.quality select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-solid)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7588' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E")
    no-repeat right 0.8rem center;
  padding: 0.65rem 2.2rem 0.65rem 0.85rem;
  border-radius: 10px;
  font: 600 0.95rem/1 var(--font-body);
  color: var(--ink);
  cursor: pointer;
  outline: none;
}

.quality select:focus {
  border-color: rgba(15, 122, 110, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 122, 110, 0.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.btn-video {
  background: var(--ink);
  color: #fff;
}

.btn-video:hover {
  background: #1c2430;
}

.btn-audio {
  background: var(--teal);
  color: #fff;
}

.btn-audio:hover {
  background: var(--teal-hover);
}

.footer-note {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  animation: rise 0.8s ease 0.15s both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 640px) {
  .form {
    flex-direction: column;
  }

  .btn-primary {
    width: 100%;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    width: 100%;
  }

  .actions .btn {
    flex: 1;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
