@font-face {
  font-family: 'Noto Sans Arabic Local';
  src: local('Noto Sans Arabic'), local('Cairo');
  font-display: swap;
}

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --border: #e2e8f0;
  --blue: #2f6fed;
  --blue-dark: #1f4fb9;
  --blue-soft: #edf3ff;
  --violet: #7857e8;
  --green: #18a66a;
  --orange: #e8862d;
  --shadow: 0 24px 70px rgba(28, 47, 79, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 4%, rgba(47, 111, 237, 0.09), transparent 28rem),
    radial-gradient(circle at 92% 18%, rgba(120, 87, 232, 0.08), transparent 26rem), var(--bg);
  font-family: 'Noto Sans Arabic Local', 'Noto Sans Arabic', Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.68);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(47, 111, 237, 0.18);
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff, #e9f0ff);
  box-shadow: 0 9px 24px rgba(47, 111, 237, 0.14);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: '';
  border-radius: 50%;
  background: var(--blue);
  opacity: 0.16;
}

.brand-mark::before {
  width: 34px;
  height: 34px;
  transform: translate(-13px, -13px);
}

.brand-mark::after {
  width: 26px;
  height: 26px;
  transform: translate(13px, 14px);
}

.brand-pencil {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 30px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #f6c453 0 72%, #e8a63c 72% 88%, #344054 88%);
  box-shadow: 3px 3px 8px rgba(23, 32, 51, 0.18);
  transform: rotate(38deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  direction: ltr;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(24, 166, 106, 0.16);
  border-radius: 999px;
  color: #16794f;
  background: rgba(236, 252, 245, 0.8);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(24, 166, 106, 0.11);
}

main {
  padding: 64px 0 80px;
}

.hero {
  width: min(820px, 100%);
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}

.eyebrow-line {
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, var(--blue), transparent);
}

h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 900;
  line-height: 1.18;
  letter-spacing: -0.045em;
}

h1 span {
  color: var(--blue);
  background: linear-gradient(135deg, var(--blue), #5a78ef 55%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-copy {
  width: min(650px, 100%);
  margin: 20px auto 34px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
}

.studio-card {
  padding: 28px;
  border: 1px solid rgba(221, 228, 238, 0.9);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
  text-align: right;
  backdrop-filter: blur(16px);
}

.card-heading,
.card-heading > div,
.action-row,
.result-heading,
.result-heading > div {
  display: flex;
  align-items: center;
}

.card-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.card-heading > div {
  gap: 14px;
}

.step-number {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 900;
}

.card-heading h2,
.result-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.card-heading p,
.result-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.sample-button {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--blue-dark);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
  transition: 160ms ease;
}

.sample-button:hover {
  border-color: #b9cdf8;
  background: var(--blue-soft);
  transform: translateY(-1px);
}

.editor-shell {
  overflow: hidden;
  border: 1px solid #d7e0eb;
  border-radius: var(--radius-lg);
  background: #fbfcfe;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.editor-shell:focus-within {
  border-color: #8eb0f8;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.1);
}

textarea {
  display: block;
  width: 100%;
  min-height: 210px;
  padding: 20px;
  resize: vertical;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 17px;
  line-height: 2;
}

textarea::placeholder {
  color: #9aa7b8;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid #e8edf4;
  color: #8794a6;
  background: #f7f9fc;
  font-size: 11px;
}

.action-row {
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
}

.action-row p {
  max-width: 330px;
  margin: 0;
  color: #7b8798;
  font-size: 11px;
  line-height: 1.7;
}

.generate-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #ffffff;
  background: linear-gradient(135deg, var(--blue), #416ff1);
  box-shadow: 0 12px 28px rgba(47, 111, 237, 0.24);
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.generate-button {
  gap: 10px;
  min-width: 210px;
  min-height: 52px;
  padding: 11px 17px;
  border-radius: 14px;
}

.generate-button:hover:not(:disabled),
.download-button:hover {
  box-shadow: 0 15px 34px rgba(47, 111, 237, 0.3);
  transform: translateY(-2px);
}

.generate-button:active:not(:disabled),
.download-button:active {
  transform: translateY(0);
}

.generate-button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.button-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.15);
}

.button-icon svg {
  width: 15px;
  fill: currentColor;
}

.button-arrow {
  font-size: 18px;
  line-height: 1;
}

.status-panel,
.result-panel,
.error-panel {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 48px rgba(28, 47, 79, 0.08);
  text-align: right;
}

.status-panel {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 28px;
  padding: 28px;
}

.loader-wrap {
  position: relative;
  width: 142px;
  height: 98px;
  overflow: hidden;
  border: 7px solid #dbe5f2;
  border-radius: 12px;
  background: #f8fbff;
}

.loader-board span {
  position: absolute;
  right: 13px;
  height: 5px;
  border-radius: 5px;
  background: #7aa5f8;
  transform-origin: right center;
  animation: write-line 1.6s ease-in-out infinite;
}

.loader-board span:nth-child(1) {
  top: 20px;
  width: 72px;
}

.loader-board span:nth-child(2) {
  top: 39px;
  width: 95px;
  animation-delay: 180ms;
}

.loader-board span:nth-child(3) {
  top: 58px;
  width: 58px;
  animation-delay: 360ms;
}

.loader-hand {
  position: absolute;
  right: 23px;
  bottom: 18px;
  width: 33px;
  height: 33px;
  border: 8px solid #e5a07a;
  border-top-color: transparent;
  border-radius: 50%;
  animation: hand-write 1.6s ease-in-out infinite;
}

.status-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-title-row h2 {
  margin: 0;
  font-size: 18px;
}

.status-title-row strong {
  color: var(--blue);
  font-size: 14px;
}

.status-content > p {
  margin: 8px 0 15px;
  color: var(--muted);
  font-size: 13px;
}

.status-content > small {
  display: block;
  margin-top: 10px;
  color: #98a3b2;
  font-size: 11px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  transition: width 500ms ease;
}

.result-panel {
  padding: 26px;
}

.result-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.result-heading > div {
  gap: 12px;
}

.success-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--green);
  font-size: 19px;
  font-weight: 900;
}

.download-button {
  gap: 9px;
  min-height: 44px;
  padding: 9px 15px;
  border-radius: 12px;
  font-size: 13px;
}

.video-frame {
  overflow: hidden;
  border-radius: 17px;
  background: #111827;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.video-frame video {
  display: block;
  width: 100%;
  max-height: 620px;
  background: #111827;
}

.error-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 20px;
  border-color: #fecaca;
  background: #fffafa;
}

.error-panel > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #dc3545;
  font-weight: 900;
}

.error-panel h2 {
  margin: 0;
  font-size: 15px;
}

.error-panel p {
  margin: 5px 0 0;
  color: #a33b46;
  font-size: 12px;
}

.error-panel button {
  padding: 9px 13px;
  border: 1px solid #f5b8bf;
  border-radius: 10px;
  color: #a33b46;
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 56px;
}

.features article {
  padding: 22px;
  border: 1px solid rgba(221, 228, 238, 0.86);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.74);
}

.feature-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
}

.feature-icon.blue {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.feature-icon.violet {
  color: #5a3ec2;
  background: #f0edff;
}

.feature-icon.green {
  color: #137a50;
  background: #e8f8f1;
}

.feature-icon.orange {
  color: #a95716;
  background: #fff1e4;
}

.features h3 {
  margin: 15px 0 7px;
  font-size: 14px;
}

.features p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 25px 0 35px;
  border-top: 1px solid var(--border);
  color: #8994a4;
  font-size: 11px;
}

footer span:first-child {
  direction: ltr;
  font-weight: 800;
}

@keyframes write-line {
  0%,
  100% {
    transform: scaleX(0.35);
    opacity: 0.35;
  }
  50% {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes hand-write {
  0%,
  100% {
    transform: translate(28px, -22px) rotate(-25deg);
  }
  50% {
    transform: translate(-30px, 10px) rotate(-25deg);
  }
}

@media (max-width: 900px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    min-height: 76px;
  }

  .header-badge {
    display: none;
  }

  main {
    padding-top: 42px;
  }

  .hero-copy {
    font-size: 15px;
  }

  .studio-card,
  .status-panel,
  .result-panel {
    padding: 18px;
    border-radius: 20px;
  }

  .card-heading,
  .action-row,
  .result-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .sample-button {
    align-self: flex-start;
  }

  textarea {
    min-height: 190px;
    padding: 15px;
    font-size: 16px;
  }

  .action-row p {
    max-width: none;
  }

  .generate-button {
    width: 100%;
  }

  .status-panel {
    grid-template-columns: 1fr;
  }

  .loader-wrap {
    margin: 0 auto;
  }

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

  .download-button {
    width: 100%;
  }

  .error-panel {
    grid-template-columns: auto 1fr;
  }

  .error-panel button {
    grid-column: 1 / -1;
  }

  footer {
    gap: 8px;
    flex-direction: column;
    text-align: center;
  }
}

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