:root {
  --bg-1: #f7f8ff;
  --bg-2: #eef2ff;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-soft: rgba(255, 255, 255, 0.56);
  --text: #10203f;
  --text-soft: #5d6b8a;
  --border: rgba(135, 154, 196, 0.24);
  --primary: #4169ff;
  --primary-strong: #2c4ef0;
  --secondary: #7c4dff;
  --accent: #ff6fb5;
  --accent-cyan: #3ed7ff;
  --accent-green: #35d39a;
  --success-bg: rgba(53, 211, 154, 0.14);
  --shadow-sm: 0 18px 40px rgba(40, 60, 120, 0.12);
  --shadow-lg: 0 30px 80px rgba(55, 76, 140, 0.18);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 18px 45px rgba(74, 99, 255, 0.16);
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 56px;
  --space-7: 72px;
  --container: 1120px;
  --transition-fast: 0.22s ease;
  --transition-base: 0.36s ease;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(62, 215, 255, 0.2), transparent 26rem),
    radial-gradient(circle at 85% 15%, rgba(124, 77, 255, 0.18), transparent 22rem),
    radial-gradient(circle at 50% 100%, rgba(255, 111, 181, 0.12), transparent 20rem),
    linear-gradient(180deg, #f9fbff 0%, #f2f5ff 48%, #eef3ff 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

img, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.bg-orb,
.bg-grid {
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.5;
  animation: orb-float 16s ease-in-out infinite;
}

.bg-orb-one {
  top: -10rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(62, 215, 255, 0.38), rgba(65, 105, 255, 0.08) 60%, transparent 72%);
}

.bg-orb-two {
  right: -10rem;
  top: 12rem;
  background: radial-gradient(circle, rgba(255, 111, 181, 0.32), rgba(124, 77, 255, 0.08) 58%, transparent 72%);
  animation-delay: -6s;
}

.bg-grid {
  inset: 0;
  opacity: 0.25;
  background-image:
    linear-gradient(rgba(140, 160, 210, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 160, 210, 0.1) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 32px), var(--container));
  margin: 0 auto;
  padding: var(--space-5) 0 var(--space-7);
}

.hero,
.panel,
.content-card,
.site-footer {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.62));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 52px);
  display: grid;
  gap: var(--space-4);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.hero::before {
  width: 14rem;
  height: 14rem;
  top: -4rem;
  right: -3rem;
  background: radial-gradient(circle, rgba(62, 215, 255, 0.22), transparent 68%);
}

.hero::after {
  width: 18rem;
  height: 18rem;
  bottom: -10rem;
  left: 40%;
  background: radial-gradient(circle, rgba(255, 111, 181, 0.18), transparent 70%);
}

.hero-copy,
.hero-visual {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker {
  margin: 0 0 var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 800;
}

.eyebrow { color: var(--secondary); }
.section-kicker { color: var(--primary); }

h1, h2 {
  margin: 0;
  line-height: 1.06;
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.5rem, 5.5vw, 4.7rem);
}

h2 { font-size: clamp(1.3rem, 2.4vw, 1.85rem); }

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 42%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-text,
.section-head p,
.content-card p,
.site-footer p,
.field-hint,
.preview-value,
#status-message,
.ad-slot p {
  color: var(--text-soft);
}

.hero-text {
  margin: 0;
  max-width: 62ch;
  font-size: clamp(1rem, 2.1vw, 1.15rem);
  line-height: 1.74;
}

.hero-actions,
.footer-nav,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-glow);
}

.stat-pill strong {
  display: block;
  font-size: 1.1rem;
  line-height: 1.1;
}

.stat-pill > div {
  min-width: 0;
}

.stat-pill span:last-child {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-soft);
}

.stat-emoji {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(65, 105, 255, 0.18), rgba(124, 77, 255, 0.18));
  font-size: 1rem;
  font-weight: 800;
}

.hero-visual {
  display: grid;
  place-items: center;
}

.hero-device {
  width: min(100%, 380px);
  padding: 18px;
  border-radius: 30px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(230, 238, 255, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 24px 70px rgba(80, 104, 178, 0.2);
  transform: perspective(1200px) rotateY(-10deg) rotateX(8deg);
  animation: device-float 6.5s ease-in-out infinite;
}

.hero-device-top {
  display: flex;
  gap: 8px;
  padding-bottom: 14px;
}

.hero-device-top span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.5), rgba(255, 111, 181, 0.5));
}

.hero-device-screen {
  display: grid;
  gap: 14px;
  min-height: 320px;
  padding: 22px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(62, 215, 255, 0.18), transparent 35%),
    linear-gradient(180deg, rgba(243, 247, 255, 0.95), rgba(255, 255, 255, 0.8));
}

.hero-code-card,
.hero-mini {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-sm);
}

.hero-code-card {
  min-height: 150px;
  display: grid;
  place-items: center;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--primary-strong);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(231, 239, 255, 0.9)),
    repeating-linear-gradient(45deg, rgba(65, 105, 255, 0.05) 0 12px, rgba(124, 77, 255, 0.02) 12px 24px);
}

.hero-mini {
  padding: 14px 16px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.75);
}

.hero-mini-primary { transform: translateX(12px); }
.hero-mini-secondary { transform: translateX(-6px); }
.hero-mini-accent { transform: translateX(24px); }

.page-main,
.info-stack,
.simple-page {
  display: grid;
  gap: var(--space-5);
}

.ad-slot {
  position: relative;
  min-height: 100px;
  margin: var(--space-5) 0;
  border: 1px dashed rgba(113, 136, 194, 0.4);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.45);
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--space-3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.ad-label {
  display: inline-block;
  margin-bottom: var(--space-1);
  color: var(--text-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.panel { padding: clamp(22px, 3vw, 36px); }

.section-head { margin-bottom: var(--space-3); }

.section-head p {
  margin: var(--space-1) 0 0;
  line-height: 1.65;
}

.controls-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}

.field-group {
  display: grid;
  gap: 10px;
}

.field-span-full { grid-column: 1 / -1; }

label,
.range-head {
  font-weight: 700;
  font-size: 0.95rem;
}

.range-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

input[type="text"],
input[type="file"],
input[type="color"],
select,
textarea {
  width: 100%;
  border: 1px solid rgba(145, 166, 219, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 248, 255, 0.85));
  color: var(--text);
  border-radius: 18px;
  padding: 14px 16px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}

textarea { resize: vertical; min-height: 120px; }
input[type="color"] { min-height: 56px; padding: 8px; }
input[type="range"] { width: 100%; accent-color: var(--primary); }

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(65, 105, 255, 0.4);
  box-shadow: 0 0 0 5px rgba(65, 105, 255, 0.1), 0 18px 40px rgba(65, 105, 255, 0.08);
  transform: translateY(-1px);
}

.toolbar {
  padding-top: var(--space-1);
}

.primary-button,
.secondary-button,
.ghost-button {
  position: relative;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 60%, var(--accent) 100%);
  box-shadow: 0 16px 34px rgba(90, 91, 255, 0.28);
}

.secondary-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(145, 166, 219, 0.22);
  box-shadow: 0 10px 22px rgba(84, 103, 163, 0.08);
}

.ghost-button {
  color: var(--primary-strong);
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(145, 166, 219, 0.24);
}

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

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.primary-button.is-pressed,
.secondary-button.is-pressed,
.ghost-button.is-pressed {
  transform: translateY(1px) scale(0.98);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.preview-card {
  position: relative;
  display: grid;
  gap: var(--space-3);
  justify-items: center;
  padding: var(--space-4);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(242, 247, 255, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-glow);
}

.preview-stage {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  padding: clamp(20px, 4vw, 36px);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(235, 241, 255, 0.84)),
    repeating-linear-gradient(45deg, rgba(124, 77, 255, 0.04) 0 10px, transparent 10px 20px);
  overflow: hidden;
}

.preview-glow {
  position: absolute;
  inset: auto auto 12% 50%;
  width: 180px;
  height: 180px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(62, 215, 255, 0.2), transparent 70%);
  filter: blur(8px);
}

#qr-canvas {
  position: relative;
  z-index: 1;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  background: #fff;
  transform: scale(0.96);
  opacity: 0;
}

#qr-canvas.is-visible { animation: qr-pop 0.42s ease forwards; }

.preview-meta { width: 100%; }

.preview-label {
  margin: 0 0 6px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
}

.preview-value {
  margin: 0;
  font-weight: 700;
  word-break: break-word;
}

.status-row {
  margin-top: var(--space-3);
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--success-bg);
  color: #0d7a59;
  border: 1px solid rgba(53, 211, 154, 0.18);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.status-row.is-updated {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(53, 211, 154, 0.12);
}

.content-card { padding: clamp(24px, 3vw, 32px); }

.content-list,
.faq-list {
  margin: var(--space-2) 0 0;
  padding-left: 20px;
}

.content-card ul { margin-bottom: 0; }

.content-list li {
  margin-bottom: 10px;
  line-height: 1.6;
}

.faq-list { padding-left: 0; }

details {
  border-top: 1px solid rgba(145, 166, 219, 0.18);
  padding: 16px 0;
}

details:first-child {
  padding-top: 0;
  border-top: 0;
}

summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

summary::-webkit-details-marker { display: none; }

details p {
  margin: 12px 0 0;
  line-height: 1.7;
}

.site-footer {
  margin-top: var(--space-5);
  padding: clamp(24px, 3vw, 32px);
  align-items: center;
}

.footer-nav a,
.page-back {
  color: var(--primary-strong);
  text-decoration: none;
  font-weight: 700;
}

.footer-nav a:hover,
.footer-nav a:focus-visible,
.page-back:hover,
.page-back:focus-visible {
  text-decoration: underline;
}

.page-intro,
.page-section { padding: clamp(24px, 3vw, 32px); }

.page-intro p,
.page-section p,
.page-section li {
  color: var(--text-soft);
  line-height: 1.7;
}

.page-section ul {
  margin: var(--space-2) 0 0;
  padding-left: 20px;
}

.page-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
  z-index: 50;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 31, 67, 0.38);
  backdrop-filter: blur(12px);
}

.modal-dialog {
  position: relative;
  width: min(100%, 520px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(242, 247, 255, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  transform: translateY(18px) scale(0.98);
  transition: transform var(--transition-base);
}

.modal.is-open .modal-dialog { transform: translateY(0) scale(1); }

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(145, 166, 219, 0.24);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
}

.modal-actions { margin-top: var(--space-3); }
.is-hidden { display: none; }
.fade-in { animation: fade-up 0.7s ease both; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes qr-pop {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

@keyframes device-float {
  0%, 100% { transform: perspective(1200px) rotateY(-10deg) rotateX(8deg) translateY(0); }
  50% { transform: perspective(1200px) rotateY(-8deg) rotateX(7deg) translateY(-10px); }
}

@media (min-width: 760px) {
  .hero,
  .controls-grid,
  .site-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-copy {
    align-self: center;
  }
}

@media (min-width: 900px) {
  .ad-slot { min-height: 160px; }
}

@media (max-width: 759px) {
  .page-shell {
    width: min(calc(100% - 16px), var(--container));
    padding-top: 18px;
    padding-bottom: var(--space-5);
  }

  .bg-grid { opacity: 0.16; }

  .hero,
  .panel,
  .content-card,
  .site-footer {
    border-radius: 24px;
  }

  .hero {
    padding: 24px 20px;
    gap: 20px;
  }

  h1 {
    max-width: none;
    font-size: clamp(2.1rem, 11vw, 3rem);
  }

  .hero-text {
    font-size: 0.98rem;
    line-height: 1.65;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 14px;
  }

  .stat-pill {
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
  }

  .stat-pill strong {
    font-size: 1.5rem;
  }

  .stat-pill span:last-child {
    font-size: 1rem;
  }

  .stat-emoji {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 18px;
    font-size: 1.05rem;
  }

  .hero-visual {
    order: -1;
  }

  .hero-device {
    width: 100%;
    max-width: 340px;
    transform: none;
    animation-duration: 8s;
  }

  .hero-device-screen {
    min-height: 260px;
  }

  .hero-mini-primary,
  .hero-mini-secondary,
  .hero-mini-accent {
    transform: none;
  }

  .ad-slot {
    margin: 20px 0;
    min-height: 76px;
    padding: 18px;
  }

  .page-main,
  .info-stack,
  .simple-page {
    gap: 20px;
  }

  .panel {
    padding: 20px 16px;
  }

  .section-head { margin-bottom: 20px; }

  .section-head p,
  .field-hint {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .controls-grid { gap: 20px; }
  .field-group { gap: 8px; }

  input[type="text"],
  input[type="file"],
  input[type="color"],
  select,
  textarea {
    border-radius: 16px;
    padding: 13px 14px;
  }

  textarea { min-height: 132px; }
  input[type="color"] { min-height: 60px; }

  .toolbar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 6px;
    padding: 12px;
    border: 1px solid rgba(145, 166, 219, 0.18);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(244, 248, 255, 0.84));
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  }

  .toolbar > * {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 0 14px;
  }

  .toolbar > :first-child {
    grid-column: 1 / -1;
  }

  .preview-card { padding: 20px; }
  .preview-stage { padding: 18px; }

  #qr-canvas {
    width: min(100%, 280px);
    height: auto;
  }

  .status-row {
    margin-top: 20px;
    padding: 14px 16px;
  }

  .footer-nav { gap: 10px 16px; }
}

@media (max-width: 479px) {
  .page-shell {
    width: min(calc(100% - 12px), var(--container));
  }

  .panel { padding: 18px 14px; }

  .hero {
    padding: 24px 16px;
  }

  .hero-actions {
    gap: 14px;
  }

  .hero-stats {
    gap: 14px;
  }

  .stat-pill {
    padding: 16px;
  }

  .toolbar {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .toolbar > :first-child {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
  #qr-canvas {
    opacity: 1;
    transform: none;
  }
}
