:root {
  --bg: #0a0b0f;
  --surface: rgba(20, 22, 29, 0.72);
  --surface-solid: #14161d;
  --surface-raised: #191c24;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f2ec;
  --text-dim: #a8a69f;
  --text-faint: #77756f;
  --accent: #ff8a5b;
  --accent-2: #ff5f8f;
  --accent-3: #ffcf7a;
  --ok: #6ee7a8;
  --danger: #ff7b7b;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-lg: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
video {
  display: block;
  max-width: 100%;
}

button,
input,
a {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-3);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- фон ---------- */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(90rem 60rem at 50% -20%, rgba(255, 138, 91, 0.12), transparent 60%),
    radial-gradient(70rem 50rem at 85% 110%, rgba(255, 95, 143, 0.1), transparent 65%),
    var(--bg);
}

.aurora__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 26s ease-in-out infinite;
}

.aurora__blob--one {
  width: 46rem;
  height: 46rem;
  top: -18rem;
  left: -10rem;
  background: radial-gradient(circle, rgba(255, 138, 91, 0.5), transparent 68%);
}

.aurora__blob--two {
  width: 38rem;
  height: 38rem;
  top: 18rem;
  right: -12rem;
  background: radial-gradient(circle, rgba(255, 95, 143, 0.42), transparent 70%);
  animation-delay: -9s;
}

.aurora__blob--three {
  width: 30rem;
  height: 30rem;
  bottom: -16rem;
  left: 30%;
  background: radial-gradient(circle, rgba(255, 207, 122, 0.28), transparent 70%);
  animation-delay: -17s;
}

.aurora__grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(3rem, 2rem, 0) scale(1.08); }
}

/* ---------- шапка ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.6rem 1.5rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 13px;
  color: #1a1206;
  background: linear-gradient(135deg, var(--accent-3), var(--accent) 45%, var(--accent-2));
  box-shadow: 0 10px 30px -12px rgba(255, 138, 91, 0.9);
}

.brand__text {
  font-size: 1.02rem;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pill {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.pill--muted {
  color: var(--text-faint);
}

/* ---------- контент ---------- */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3.4rem 1.5rem 4rem;
}

.hero {
  max-width: 44rem;
  margin-bottom: 2.6rem;
  animation: rise 0.7s ease both;
}

.hero__title {
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
}

.grad {
  background: linear-gradient(105deg, var(--accent-3), var(--accent) 42%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lede {
  margin: 0;
  max-width: 34rem;
  color: var(--text-dim);
  font-size: clamp(1rem, 1.6vw, 1.12rem);
}

/* ---------- студия ---------- */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr);
  gap: 1.1rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: rise 0.7s ease 0.08s both;
}

.stage {
  position: relative;
  min-height: 24rem;
  border-radius: var(--radius-md);
  background:
    radial-gradient(60rem 30rem at 50% 0%, rgba(255, 255, 255, 0.04), transparent 70%),
    #0e1015;
  overflow: hidden;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  height: 100%;
  min-height: 24rem;
  padding: 2.5rem 1.5rem;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: rgba(255, 138, 91, 0.7);
  background: radial-gradient(40rem 20rem at 50% 30%, rgba(255, 138, 91, 0.12), transparent 70%);
}

.dropzone.is-dragging {
  transform: scale(0.995);
}

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: 0.7rem;
  border-radius: 20px;
  color: var(--accent-3);
  background: rgba(255, 207, 122, 0.08);
  border: 1px solid rgba(255, 207, 122, 0.18);
}

.dropzone__title {
  font-size: 1.18rem;
  font-weight: 600;
}

.dropzone__hint {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.dropzone__formats {
  margin-top: 0.7rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-faint);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.preview {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.7rem;
}

.preview[hidden] {
  display: none;
}

.preview__frame {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 20rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #08090c;
}

.preview__frame img,
.preview__frame video {
  width: 100%;
  height: 100%;
  max-height: 58vh;
  object-fit: contain;
}

.preview__scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 138, 91, 0.02) 35%,
    rgba(255, 207, 122, 0.22) 50%,
    rgba(255, 138, 91, 0.02) 65%,
    transparent 100%
  );
  transform: translateY(-100%);
  animation: scan 2.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scan {
  0% { transform: translateY(-100%); }
  55%, 100% { transform: translateY(100%); }
}

.preview__badge {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(110, 231, 168, 0.14);
  border: 1px solid rgba(110, 231, 168, 0.35);
  color: var(--ok);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.preview__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 0.35rem 0.15rem;
}

.file-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
  font-size: 0.84rem;
}

.file-chip__name {
  max-width: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip__size {
  color: var(--text-faint);
  font-size: 0.76rem;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 123, 123, 0.1);
  border-color: rgba(255, 123, 123, 0.35);
  color: var(--danger);
}

/* ---------- панель ---------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 1.4rem;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line);
}

.status__title {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.status__text {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.progress {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.progress[hidden] {
  display: none;
}

.progress__bar {
  position: relative;
  flex: 1;
  height: 0.42rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress__bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-3), var(--accent), var(--accent-2));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress__value {
  min-width: 2.4rem;
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.2rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.btn[hidden] {
  display: none;
}

.btn--primary {
  color: #1a1206;
  background: linear-gradient(135deg, var(--accent-3), var(--accent) 52%, var(--accent-2));
  box-shadow: 0 18px 40px -22px rgba(255, 138, 91, 0.95);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 22px 50px -22px rgba(255, 138, 91, 1);
}

.btn--primary:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.btn--ghost {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn__icon {
  transition: transform 0.18s ease;
}

.btn--primary:hover:not(:disabled) .btn__icon {
  transform: translateX(3px);
}

.btn.is-busy .btn__label::after {
  content: "…";
}

.hints {
  margin: auto 0 0;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  display: grid;
  gap: 0.5rem;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.hints li {
  position: relative;
  padding-left: 0.95rem;
}

.hints li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

/* ---------- шаги ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.1rem;
  animation: rise 0.7s ease 0.16s both;
}

.step {
  padding: 1.3rem 1.3rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.018);
}

.step__num {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.step h2 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  font-weight: 600;
}

.step p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ---------- подвал и тост ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.5rem 2.5rem;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.footer a {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.footer a:hover {
  border-color: var(--line-strong);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  z-index: 20;
  max-width: min(34rem, calc(100vw - 2rem));
  padding: 0.8rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 123, 123, 0.3);
  background: rgba(38, 18, 20, 0.95);
  color: #ffd9d9;
  font-size: 0.88rem;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  transform: translate(-50%, 1rem);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast[hidden] {
  display: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-ok {
  border-color: rgba(110, 231, 168, 0.3);
  background: rgba(14, 32, 24, 0.95);
  color: #d8ffee;
}

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

/* ---------- адаптив ---------- */

@media (max-width: 860px) {
  .studio {
    grid-template-columns: 1fr;
  }

  .stage,
  .dropzone {
    min-height: 19rem;
  }

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

  .page {
    padding-top: 2.4rem;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 1.1rem 1rem 0;
  }

  .page {
    padding: 1.9rem 1rem 3rem;
  }

  .studio {
    padding: 0.7rem;
    border-radius: 20px;
  }

  .panel {
    padding: 1.1rem;
  }

  .pill {
    font-size: 0.72rem;
    padding: 0.28rem 0.6rem;
  }

  .hints {
    font-size: 0.76rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
