:root {
  --calculator-bg: #09111f;
  --calculator-surface: rgba(15, 23, 42, 0.88);
  --calculator-surface-strong: rgba(20, 31, 54, 0.96);
  --calculator-surface-soft: rgba(28, 41, 69, 0.72);
  --calculator-border: rgba(148, 163, 184, 0.16);
  --calculator-text: #f8fafc;
  --calculator-text-soft: #cbd5e1;
  --calculator-text-muted: #94a3b8;
  --calculator-v1: #6d5efc;
  --calculator-v2: #2dd4bf;
  --calculator-v3: #22c55e;
  --calculator-danger: #ef4444;
  --calculator-success: #10b981;
  --calculator-shadow: 0 28px 90px rgba(2, 6, 23, 0.46);
  --calculator-radius-xl: 30px;
  --calculator-radius-lg: 22px;
  --calculator-radius-md: 16px;
  --calculator-transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--calculator-text);
  background:
    radial-gradient(circle at 20% 0%, rgba(109, 94, 252, 0.18), transparent 28%),
    radial-gradient(circle at 100% 100%, rgba(34, 197, 94, 0.1), transparent 26%),
    linear-gradient(180deg, #08101d 0%, #0a1424 42%, #0a1220 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.calculator-app {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.calculator-app::before,
.calculator-app::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(90px);
  pointer-events: none;
}

.calculator-app::before {
  width: 360px;
  height: 360px;
  top: 80px;
  left: -140px;
  background: rgba(99, 102, 241, 0.16);
}

.calculator-app::after {
  width: 320px;
  height: 320px;
  right: -140px;
  bottom: 120px;
  background: rgba(45, 212, 191, 0.12);
}

.calculator-back-link {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--calculator-border);
  background: rgba(10, 18, 32, 0.74);
  color: var(--calculator-text-soft);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
  transition:
    transform var(--calculator-transition),
    color var(--calculator-transition),
    background-color var(--calculator-transition),
    border-color var(--calculator-transition);
}

.calculator-back-link:hover {
  transform: translateY(-1px);
  color: var(--calculator-text);
  border-color: rgba(109, 94, 252, 0.45);
  background: rgba(20, 31, 54, 0.92);
}

.calculator-main {
  position: relative;
  z-index: 1;
  padding: 96px 24px 40px;
}

.page-shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.seo-summary {
  display: block;
  margin-bottom: 28px;
  padding: 26px 28px;
  border: 1px solid var(--calculator-border);
  border-radius: var(--calculator-radius-xl);
  background:
    radial-gradient(circle at top right, rgba(109, 94, 252, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(18, 27, 46, 0.92), rgba(10, 17, 31, 0.94));
  box-shadow: var(--calculator-shadow);
}

.seo-copy {
  display: flex;
  flex-direction: column;
}

.seo-kicker {
  margin: 0 0 10px;
  color: #c4b5fd;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.seo-copy h1 {
  margin: 0;
  color: var(--calculator-text);
  font-size: clamp(1.6rem, 2.4vw, 2.35rem);
  line-height: 1.08;
}

.seo-description {
  margin: 14px 0 0;
  max-width: 62ch;
  color: var(--calculator-text-soft);
  font-size: 0.97rem;
  line-height: 1.7;
}

.seo-model-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.seo-models-label {
  margin: 0;
  color: var(--calculator-text);
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
}

.seo-model-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.seo-model-list li {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--calculator-text-soft);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.seo-model-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow:
    0 0 0 0 rgba(34, 197, 94, 0.4),
    0 0 14px rgba(34, 197, 94, 0.55);
  animation: model-dot-pulse 1.9s ease-out infinite;
}

.seo-model-list li:nth-child(2)::before {
  animation-delay: 0.18s;
}

.seo-model-list li:nth-child(3)::before {
  animation-delay: 0.36s;
}

.seo-model-list li:nth-child(4)::before {
  animation-delay: 0.54s;
}

.seo-model-list li:nth-child(5)::before {
  animation-delay: 0.72s;
}

@keyframes model-dot-pulse {
  0% {
    transform: scale(0.96);
    box-shadow:
      0 0 0 0 rgba(34, 197, 94, 0.4),
      0 0 10px rgba(34, 197, 94, 0.45);
  }

  70% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 10px rgba(34, 197, 94, 0),
      0 0 18px rgba(34, 197, 94, 0.6);
  }

  100% {
    transform: scale(0.96);
    box-shadow:
      0 0 0 0 rgba(34, 197, 94, 0),
      0 0 10px rgba(34, 197, 94, 0.38);
  }
}

.version-card {
  position: relative;
  border: 1px solid var(--calculator-border);
  background: linear-gradient(180deg, rgba(18, 27, 46, 0.94), rgba(10, 17, 31, 0.94));
  box-shadow: var(--calculator-shadow);
  backdrop-filter: blur(16px);
}

.version-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
}

.card-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.version-card {
  border-radius: var(--calculator-radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.version-card-v1 {
  background:
    linear-gradient(180deg, rgba(22, 27, 51, 0.96), rgba(10, 14, 28, 0.96)),
    radial-gradient(circle at top right, rgba(109, 94, 252, 0.15), transparent 42%);
}

.version-card-v2 {
  background:
    linear-gradient(180deg, rgba(16, 36, 48, 0.96), rgba(9, 20, 27, 0.96)),
    radial-gradient(circle at top right, rgba(45, 212, 191, 0.14), transparent 42%);
}

.version-card-v3 {
  background:
    linear-gradient(180deg, rgba(15, 36, 26, 0.96), rgba(8, 18, 16, 0.96)),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.16), transparent 42%);
}

.version-card-header {
  padding: 24px 24px 12px;
}

.version-card-v1 .card-tag {
  color: #c4b5fd;
  background: rgba(109, 94, 252, 0.16);
}

.version-card-v2 .card-tag {
  color: #99f6e4;
  background: rgba(45, 212, 191, 0.16);
}

.version-card-v3 .card-tag {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
}

.version-preview {
  margin: 0 24px 18px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  background: rgba(7, 13, 24, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.version-preview-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  border-radius: 14px;
  object-fit: contain;
  background: linear-gradient(180deg, #161d29 0%, #0d1420 100%);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
}

.version-preview-note {
  margin: 12px 2px 0;
  color: var(--calculator-text-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

.version-preview-note strong {
  color: #ffffff;
}

.version-preview-v1 {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 28%),
    linear-gradient(180deg, #2d313c 0%, #202733 100%);
}

.version-preview-v2 {
  background:
    linear-gradient(180deg, rgba(45, 212, 191, 0.08), rgba(4, 10, 19, 0.82)),
    linear-gradient(180deg, #15222b 0%, #0d161d 100%);
}

.version-preview-v3 {
  background:
    linear-gradient(180deg, rgba(34, 197, 94, 0.08), rgba(4, 10, 19, 0.82)),
    linear-gradient(180deg, #16241d 0%, #0d1511 100%);
}

.preview-screen {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  min-height: 230px;
  padding: 16px 14px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 30%),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #2d313c 0%, #202733 100%);
}

.preview-screen-top {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 26px;
  color: rgba(255, 248, 230, 0.92);
  font-weight: 800;
  font-size: 0.84rem;
}

.preview-screen-top span {
  min-height: 62px;
  padding: 12px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.preview-prompt {
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(168, 174, 189, 0.95), rgba(143, 150, 166, 0.95));
  color: #161a20;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.preview-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-weight: 800;
  font-size: 1rem;
}

.preview-key {
  color: #fff6db;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.preview-code {
  color: #fff3d6;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
}

.preview-highlight {
  padding: 2px 7px;
  border: 3px solid #f52929;
  background: rgba(255, 255, 255, 0.06);
  color: #fff9ea;
  line-height: 1;
}

.preview-input {
  display: flex;
  align-items: center;
  height: 42px;
  margin-top: 12px;
  padding: 0 10px;
  border: 3px solid rgba(246, 248, 251, 0.98);
  border-radius: 4px;
  background: rgba(56, 74, 100, 0.18);
}

.preview-caret {
  width: 3px;
  height: 22px;
  background: #16ffe5;
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(22, 255, 229, 0.7);
}

.preview-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.86rem;
}

.preview-btn-primary {
  background: linear-gradient(90deg, #17e0d2, #3ef7d8);
  color: rgba(28, 55, 66, 0.95);
}

.preview-btn-secondary {
  color: #fff6da;
  background: linear-gradient(180deg, rgba(130, 119, 135, 0.78), rgba(103, 94, 116, 0.9));
  box-shadow: inset 0 0 0 2px rgba(255, 238, 214, 0.76);
}

.preview-version {
  margin-top: 8px;
  text-align: center;
  color: #17f5df;
  font-weight: 800;
  font-size: 0.86rem;
}

.version-form {
  padding: 0 24px 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  color: var(--calculator-text-soft);
  font-size: 0.875rem;
  font-weight: 700;
}

.required {
  color: var(--calculator-danger);
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--calculator-radius-md);
  background: rgba(7, 13, 24, 0.68);
  color: var(--calculator-text);
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color var(--calculator-transition),
    box-shadow var(--calculator-transition),
    transform var(--calculator-transition),
    background-color var(--calculator-transition);
}

.form-input:focus {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
  background: rgba(7, 13, 24, 0.9);
}

.form-input::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

.form-input.is-invalid {
  border-color: rgba(248, 113, 113, 0.9);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
  background: rgba(40, 10, 16, 0.62);
}

.input-hint {
  display: block;
  margin-top: 8px;
  color: var(--calculator-text-muted);
  font-size: 0.77rem;
  line-height: 1.55;
}

.form-feedback {
  display: block;
  margin: 8px 0 0;
  color: #fca5a5;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
}

.btn-generate {
  position: relative;
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform var(--calculator-transition),
    box-shadow var(--calculator-transition),
    opacity var(--calculator-transition);
}

.version-card-v1 .btn-generate {
  background: linear-gradient(135deg, #6d5efc, #5144d8);
  box-shadow: 0 20px 34px rgba(109, 94, 252, 0.28);
}

.version-card-v2 .btn-generate {
  background: linear-gradient(135deg, #18baa5, #0f9f8c);
  box-shadow: 0 20px 34px rgba(24, 186, 165, 0.24);
}

.version-card-v3 .btn-generate {
  background: linear-gradient(135deg, #1dac54, #128042);
  box-shadow: 0 20px 34px rgba(29, 172, 84, 0.24);
}

.btn-generate::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: translateX(-120%);
  transition: transform 420ms ease;
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn-generate:hover:not(:disabled)::before {
  transform: translateX(120%);
}

.btn-generate:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.btn-text,
.btn-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-top-color: #fff;
  animation: calculator-spin 0.75s linear infinite;
}

.result-section,
.error-section {
  margin-top: 16px;
  padding: 18px;
  border-radius: 18px;
}

.result-section {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.04));
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--calculator-success);
}

.result-header svg,
.error-icon svg,
.btn-copy svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-header h4 {
  margin: 0;
  color: var(--calculator-text);
  font-size: 1rem;
}

.password-display {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.password-label {
  color: var(--calculator-text-soft);
  font-size: 0.84rem;
  font-weight: 700;
}

.password-value-wrapper {
  display: flex;
  gap: 10px;
}

.password-value {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(16, 185, 129, 0.26);
  border-radius: 16px;
  background: rgba(7, 13, 24, 0.82);
  color: #6ee7b7;
  font-size: 1.18rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.14em;
  font-family: "Courier New", monospace;
}

.btn-copy {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(7, 13, 24, 0.82);
  color: var(--calculator-text-soft);
  cursor: pointer;
  transition:
    transform var(--calculator-transition),
    background-color var(--calculator-transition),
    color var(--calculator-transition),
    border-color var(--calculator-transition);
}

.btn-copy:hover {
  transform: scale(1.03);
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.28);
  color: #d1fae5;
}

.btn-copy.is-copied {
  background: rgba(16, 185, 129, 0.32);
  border-color: rgba(16, 185, 129, 0.42);
  color: #fff;
}

.error-section {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.error-icon {
  flex: 0 0 auto;
  color: var(--calculator-danger);
}

.error-section p {
  margin: 0;
  color: var(--calculator-text);
  line-height: 1.65;
}

@keyframes calculator-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1120px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .calculator-back-link {
    top: 16px;
    right: 16px;
    padding: 10px 14px;
    font-size: 0.82rem;
  }

  .calculator-main {
    padding: 88px 14px 24px;
  }

  .seo-summary {
    margin-bottom: 22px;
    padding: 22px 18px;
    border-radius: 24px;
  }

  .seo-copy h1 {
    font-size: 1.55rem;
  }

  .seo-model-strip {
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
  }

  .version-preview,
  .version-card-header,
  .version-form {
    padding-left: 18px;
    padding-right: 18px;
  }

  .version-card {
    border-radius: 24px;
  }

  .preview-actions {
    flex-direction: column;
  }

  .preview-btn {
    min-width: 0;
  }

  .password-value-wrapper {
    flex-direction: column;
  }

  .btn-copy {
    width: 100%;
  }
}
