:root {
  --bg-deep: #061018;
  --bg-mid: #0d1a28;
  --panel: rgba(8, 15, 26, 0.66);
  --panel-strong: rgba(7, 12, 22, 0.95);
  --text: #f6efe3;
  --muted: #9eabb8;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --cyan: #7df0ff;
  --green: #beff7b;
  --orange: #ff8d47;
  --shadow: 0 40px 100px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Vazirmatn", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 18%, rgba(125, 240, 255, 0.08), transparent 26%),
    radial-gradient(circle at 50% 118%, rgba(255, 141, 71, 0.09), transparent 30%),
    linear-gradient(180deg, #08111a 0%, #0b1420 48%, #090f16 100%);
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.028), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 24%);
  opacity: 1;
}

body::after {
  background:
    radial-gradient(circle at center, transparent 46%, rgba(0, 0, 0, 0.34) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.16));
}

.bg-stage,
.bg-grid,
.bg-rings,
.bg-beam,
.bg-pulse,
.bg-dots {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-stage {
  z-index: 0;
}

.bg-stage::before,
.bg-stage::after {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
}

.bg-stage::before {
  background:
    conic-gradient(from 0deg, transparent 0 18%, rgba(125, 240, 255, 0.12) 26%, transparent 36%, transparent 58%, rgba(255, 141, 71, 0.1) 68%, transparent 78%),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.03), transparent 44%);
  opacity: 0.32;
  filter: blur(28px);
  animation: stageSpin 24s linear infinite;
}

.bg-stage::after {
  background:
    linear-gradient(115deg, transparent 20%, rgba(125, 240, 255, 0.08) 34%, transparent 48%),
    linear-gradient(295deg, transparent 28%, rgba(255, 141, 71, 0.08) 42%, transparent 56%);
  opacity: 0.34;
  filter: blur(42px);
  animation: stageSweep 16s ease-in-out infinite;
}

.bg-grid {
  opacity: 0.16;
  background:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(circle at center, black 34%, transparent 82%);
  animation: gridShift 18s linear infinite;
}

.bg-rings {
  inset: 50% auto auto 50%;
  width: min(1100px, 96vw);
  height: min(1100px, 96vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 33%, rgba(255, 255, 255, 0.05) 33.2%, transparent 33.7%),
    radial-gradient(circle, transparent 0 49%, rgba(125, 240, 255, 0.065) 49.2%, transparent 49.8%),
    radial-gradient(circle, transparent 0 65%, rgba(255, 141, 71, 0.05) 65.2%, transparent 65.8%);
  opacity: 0.72;
  filter: blur(0.2px);
  animation: ringsFloat 16s linear infinite;
}

.bg-beam {
  inset: auto;
  width: 78vw;
  height: 280px;
  border-radius: 999px;
  filter: blur(56px);
  opacity: 0.42;
}

.bg-beam-a {
  top: 14%;
  left: -12%;
  transform: rotate(-18deg);
  background: linear-gradient(90deg, transparent, rgba(125, 240, 255, 0.38), transparent);
  animation: beamSweepA 11s ease-in-out infinite;
}

.bg-beam-b {
  right: -14%;
  bottom: 12%;
  transform: rotate(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 141, 71, 0.34), transparent);
  animation: beamSweepB 13s ease-in-out infinite;
}

.bg-pulse {
  inset: auto;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
}

.bg-pulse-a {
  top: 16%;
  left: 18%;
  width: 260px;
  height: 260px;
  background: rgba(125, 240, 255, 0.3);
  animation: pulseBreathA 7s ease-in-out infinite;
}

.bg-pulse-b {
  right: 16%;
  bottom: 14%;
  width: 240px;
  height: 240px;
  background: rgba(255, 141, 71, 0.26);
  animation: pulseBreathB 8.5s ease-in-out infinite;
}

.bg-dots {
  opacity: 0.46;
  background-image: radial-gradient(rgba(255, 255, 255, 0.65) 0.8px, transparent 0.8px);
  background-size: 34px 34px;
  mask-image:
    radial-gradient(circle at 20% 28%, black 0 12%, transparent 18%),
    radial-gradient(circle at 80% 72%, black 0 10%, transparent 16%),
    linear-gradient(black, black);
  mask-composite: add;
  -webkit-mask-image:
    radial-gradient(circle at 20% 28%, black 0 12%, transparent 18%),
    radial-gradient(circle at 80% 72%, black 0 10%, transparent 16%),
    linear-gradient(black, black);
  animation: dotsDrift 12s linear infinite;
}

button,
textarea {
  font: inherit;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.3;
  pointer-events: none;
}

.orb-a {
  inset: auto auto -8% -10%;
  width: 22rem;
  height: 22rem;
  background: rgba(255, 141, 71, 0.14);
  animation: driftA 10s ease-in-out infinite;
}

.orb-b {
  inset: -8% -10% auto auto;
  width: 22rem;
  height: 22rem;
  background: rgba(125, 240, 255, 0.13);
  animation: driftB 11s ease-in-out infinite;
}

.shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.center-box,
.modal-card {
  position: relative;
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.center-box {
  width: min(680px, 100%);
  padding: 32px 24px 26px;
  border-radius: 38px;
  overflow: hidden;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.022)),
    var(--panel);
}

.center-box::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 37px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  pointer-events: none;
}

.center-box::after {
  content: "";
  position: absolute;
  inset: auto auto -110px -110px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 141, 71, 0.22), transparent 68%);
  pointer-events: none;
}

.top-chip,
.box-foot span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.top-chip {
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.eyebrow,
.modal-kicker {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, sans-serif;
}

h1 {
  font-size: clamp(2.8rem, 5vw, 4.6rem);
  font-weight: 900;
  line-height: 1.12;
}

h2 {
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  font-weight: 800;
  line-height: 1.18;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  appearance: none;
  border-radius: 18px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.primary-btn {
  border: 0;
  padding: 15px 26px;
  color: #071018;
  font-weight: 800;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  box-shadow: 0 18px 40px rgba(125, 240, 255, 0.24);
}

.ghost-btn,
.icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.ghost-btn {
  padding: 13px 18px;
}

.icon-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 1.7rem;
  line-height: 1;
}

.primary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover {
  transform: translateY(-2px);
}

.center-box .primary-btn {
  margin-top: 24px;
}

.box-foot {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.box-foot span {
  color: var(--muted);
  min-width: 92px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(10, 18, 30, 0.24), rgba(3, 8, 15, 0.86)),
    rgba(3, 8, 15, 0.72);
}

.modal-card {
  z-index: 1;
  width: min(860px, 100%);
  max-height: min(92vh, 980px);
  padding: 24px;
  overflow: auto;
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.022)),
    var(--panel-strong);
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 31px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  pointer-events: none;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.status-box,
textarea,
.output-box {
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018)),
    rgba(8, 12, 22, 0.8);
}

.status-box {
  margin-bottom: 14px;
  padding: 13px 15px;
  color: var(--muted);
}

.status-box.is-hidden {
  display: none;
}

.status-box.success {
  color: #dcffd5;
  border-color: rgba(190, 255, 123, 0.24);
}

.status-box.error {
  color: #ffd7ca;
  border-color: rgba(255, 141, 71, 0.24);
}

textarea {
  width: 100%;
  min-height: 250px;
  resize: vertical;
  padding: 18px;
  color: var(--text);
  direction: ltr;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.85;
}

textarea::placeholder {
  color: #8290a0;
}

textarea:focus {
  outline: 2px solid rgba(125, 240, 255, 0.26);
  border-color: rgba(125, 240, 255, 0.42);
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.output-box {
  margin: 16px 0 0;
  min-height: 210px;
  padding: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  direction: ltr;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.82;
}

body.modal-open {
  overflow: hidden;
}

@keyframes driftA {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(68px, -30px, 0) scale(1.14);
  }
}

@keyframes driftB {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-64px, 34px, 0) scale(0.88);
  }
}

@keyframes ringsFloat {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) rotate(180deg) scale(1.06);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg) scale(1);
  }
}

@keyframes beamSweepA {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-18deg);
    opacity: 0.24;
  }
  50% {
    transform: translate3d(180px, -36px, 0) rotate(-12deg);
    opacity: 0.54;
  }
}

@keyframes beamSweepB {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-18deg);
    opacity: 0.22;
  }
  50% {
    transform: translate3d(-200px, 42px, 0) rotate(-23deg);
    opacity: 0.5;
  }
}

@keyframes pulseBreathA {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(0.84);
    opacity: 0.18;
  }
  50% {
    transform: translate3d(34px, -18px, 0) scale(1.24);
    opacity: 0.42;
  }
}

@keyframes pulseBreathB {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(0.86);
    opacity: 0.16;
  }
  50% {
    transform: translate3d(-30px, 20px, 0) scale(1.2);
    opacity: 0.38;
  }
}

@keyframes dotsDrift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(24px, -18px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes gridShift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(18px, 12px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes stageSpin {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.08);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes stageSweep {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(-32px, 24px, 0) rotate(8deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .bg-rings,
  .bg-beam,
  .bg-pulse,
  .bg-dots {
    animation: none !important;
  }
}

@media (max-width: 700px) {
  .shell {
    padding: 16px;
  }

  .center-box {
    padding: 24px 18px 22px;
    border-radius: 28px;
  }

  .bg-grid {
    background-size: 40px 40px;
    opacity: 0.1;
  }

  .bg-rings {
    width: 132vw;
    height: 132vw;
    opacity: 0.58;
  }

  .bg-beam {
    width: 110vw;
    height: 180px;
    opacity: 0.3;
  }

  .bg-pulse-a,
  .bg-pulse-b {
    width: 180px;
    height: 180px;
    opacity: 0.22;
  }

  .bg-dots {
    opacity: 0.26;
    background-size: 26px 26px;
  }

  .center-box::before {
    border-radius: 27px;
  }

  h1 {
    font-size: clamp(2.2rem, 10vw, 3.4rem);
  }

  .box-foot {
    width: 100%;
  }

  .box-foot span {
    flex: 1 1 0;
    min-width: 0;
  }

  .modal {
    padding: 0;
    align-items: end;
  }

  .modal-card {
    width: 100%;
    max-height: min(88vh, 960px);
    padding: 18px;
    border-radius: 24px 24px 0 0;
  }

  .modal-card::before {
    border-radius: 23px 23px 0 0;
  }

  .modal-head,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .icon-btn,
  .ghost-btn,
  .primary-btn {
    width: 100%;
  }

  .icon-btn {
    height: 44px;
  }

  textarea {
    min-height: 220px;
  }
}
