:root {
  --bg: #f6f7fb;
  --text: #151923;
  --muted: #647084;
  --panel: #ffffff;
  --line: #dfe4ee;
  --accent: #00d1c1;
  --accent-dark: #057b73;
  --pink: #ff3b73;
  --shadow: 0 24px 70px rgba(30, 41, 59, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, Tahoma, Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(0, 209, 193, 0.13), transparent 34%),
    linear-gradient(315deg, rgba(255, 59, 115, 0.11), transparent 34%),
    var(--bg);
}

.language-toggle {
  position: fixed;
  top: 18px;
  inset-inline-end: 18px;
  z-index: 20;
  min-height: 42px;
  min-width: 76px;
  padding: 0 16px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 999px;
  color: #fff;
  background: #111827;
  box-shadow: 0 16px 36px rgba(17, 24, 39, 0.22);
}

.language-toggle:hover {
  background: #202938;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.75fr);
  align-items: center;
  gap: 56px;
  padding: 48px 0;
}

.tool-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 44px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
  direction: ltr;
  justify-content: flex-start;
}

.brand-copy p {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
}

.brand-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(0, 209, 193, 0.95), transparent 52%),
    linear-gradient(315deg, rgba(255, 59, 115, 0.92), transparent 54%),
    #111827;
  box-shadow: 0 14px 28px rgba(17, 24, 39, 0.2);
}

.logo-mark span {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  transform: none;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0;
}

.intro h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.35rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.intro p,
.hint,
.status {
  color: var(--muted);
}

.intro p {
  margin: 18px 0 0;
  font-size: 1.12rem;
  line-height: 1.8;
}

.download-form {
  margin-top: 36px;
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
}

input,
button,
.download-btn {
  min-height: 52px;
  border-radius: 8px;
  font: inherit;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0 16px;
  color: var(--text);
  background: #fbfcff;
  direction: ltr;
  text-align: left;
}

input:focus {
  outline: 3px solid rgba(0, 209, 193, 0.22);
  border-color: var(--accent);
}

button,
.download-btn {
  border: 0;
  cursor: pointer;
  font-weight: 700;
  position: relative;
  z-index: 2;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button:hover,
.download-btn:hover {
  transform: translateY(-1px);
}

button:active,
.download-btn:active {
  transform: translateY(0);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

button {
  background: var(--text);
  color: #fff;
  box-shadow: 0 12px 24px rgba(21, 25, 35, 0.18);
}

.hint {
  margin: 10px 0 0;
  font-size: 0.92rem;
}

.result-panel {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  position: relative;
  z-index: 3;
}

.result-label {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-weight: 700;
}

.result-panel h2 {
  margin: 0;
  font-size: 1.2rem;
}

.download-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(128px, 1fr));
  gap: 10px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 18px;
  text-decoration: none;
  color: var(--text);
  background: #eaf0f8;
  box-shadow: inset 0 0 0 1px rgba(100, 112, 132, 0.1);
  white-space: nowrap;
}

.download-btn.primary {
  color: #062421;
  background: var(--accent);
  box-shadow: 0 14px 28px rgba(0, 209, 193, 0.28);
}

.download-btn::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-inline-end: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.65;
}

.status {
  min-height: 28px;
  margin: 18px 0 0;
  line-height: 1.6;
}

.status.error {
  color: #b42342;
}

.status.success {
  color: var(--accent-dark);
}

.preview {
  display: flex;
  justify-content: center;
}

.phone {
  width: min(390px, 100%);
  aspect-ratio: 9 / 16;
  border-radius: 42px;
  padding: 12px;
  background: #111827;
  border: 8px solid #0b1019;
  box-shadow: 0 30px 80px rgba(17, 24, 39, 0.28);
  position: relative;
}

.phone::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 50%;
  width: 86px;
  height: 22px;
  border-radius: 0 0 16px 16px;
  background: #0b1019;
  transform: translateX(-50%);
  z-index: 4;
}

.phone-screen {
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(0, 209, 193, 0.22), transparent 38%),
    linear-gradient(20deg, rgba(255, 59, 115, 0.22), transparent 45%),
    #1b2230;
  padding: 34px 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 18px;
}

.video-card {
  flex: 1;
  min-height: 0;
  border-radius: 8px;
  background:
    linear-gradient(180deg, transparent 0 48%, rgba(0, 0, 0, 0.5)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 520'%3E%3Crect width='320' height='520' fill='%2329364a'/%3E%3Cpath d='M0 110 C80 40 130 190 220 95 C275 38 305 67 320 92 V0 H0 Z' fill='%2300d1c1' fill-opacity='.45'/%3E%3Cpath d='M0 390 C78 328 116 455 194 365 C244 308 295 330 320 360 V520 H0 Z' fill='%23ff3b73' fill-opacity='.48'/%3E%3Ccircle cx='226' cy='178' r='66' fill='%23ffffff' fill-opacity='.13'/%3E%3C/svg%3E");
  background-size: cover;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#preview-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000;
  position: relative;
  z-index: 2;
}

.preview-placeholder span {
  position: absolute;
  bottom: 16px;
  left: 16px;
  color: #fff;
  font-weight: 700;
}

.play-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
}

.play-icon::after {
  content: "";
  position: absolute;
  top: 21px;
  left: 28px;
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 20px solid #111827;
}

.preview-meta {
  min-height: 58px;
  color: #fff;
}

.preview-meta p {
  margin: 0 0 6px;
  font-weight: 700;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.preview-meta span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.88rem;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 28px 0;
  }

  .preview {
    order: -1;
  }

  .phone {
    width: min(280px, 82vw);
  }

  .input-row,
  .result-panel {
    grid-template-columns: 1fr;
  }

  .download-actions {
    grid-template-columns: 1fr;
  }

  .download-btn {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
  }

  .tool-panel {
    padding: 22px 16px;
  }

  .brand-row {
    margin-bottom: 26px;
  }
}
