:root {
  --clr-periwinkle: #B9C7F8;
  --clr-zaffre:     #0D21A5;
  --clr-citron:     #D1D067;
  --clr-white:      #ffffff;
  --clr-dark:       #333333;
  --clr-bg:         rgba(255, 255, 255, 0.95);
  
  --grad-bg:     linear-gradient(135deg, var(--clr-periwinkle) 0%, var(--clr-zaffre) 50%, var(--clr-citron) 100%);
  --grad-btn:    linear-gradient(135deg, var(--clr-zaffre) 0%, var(--clr-periwinkle) 100%);
  --grad-qr:     linear-gradient(135deg, #F5F5DC 0%, #E8F4F8 100%);
  
  --shdw-soft:  0 4px 15px rgba(13, 33, 165, 0.2);
  --shdw-card:  0 20px 60px rgba(13, 33, 165, 0.3);
  --shdw-hover: 0 8px 25px rgba(13, 33, 165, 0.4);
  
  --rad-sm: 12px;
  --rad-md: 20px;
  --rad-lg: 30px;
  --trs:    0.3s ease;
}

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

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes qrPop {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-20px); }
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--grad-bg);
  background-size: 400% 400%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: gradientShift 15s ease infinite;
  color: var(--clr-dark);
}

.background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}
.shape {
  position: absolute;
  opacity: 0.15;
  animation: float 20s infinite;
}
.shape-1 {
  top: 10%; left: 10%;
  width: 80px; height: 80px;
  background: var(--clr-zaffre);
  border-radius: 50%;
}
.shape-2 {
  top: 70%; right: 10%;
  width: 60px; height: 60px;
  background: var(--clr-periwinkle);
  transform: rotate(45deg);
  animation-delay: 5s;
}
.shape-3 {
  bottom: 10%; left: 20%;
  width: 100px; height: 100px;
  background: var(--clr-citron);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  animation-delay: 10s;
}


.app-wrapper {
  background: var(--clr-bg);
  backdrop-filter: blur(10px);
  border-radius: var(--rad-lg);
  padding: 40px 30px;
  box-shadow: var(--shdw-card);
  max-width: 450px;
  width: 100%;
  animation: slideUp 0.6s ease-out;
  position: relative;
  text-align: center;
}


.step {
  display: none;
  animation: fadeIn 0.4s ease;
}
.step.active {
  display: block;
}

h1 {
  color: var(--clr-zaffre);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-shadow: 1px 1px 2px rgba(13, 33, 165, 0.15);
}

#text {
  padding: 14px 18px !important;
  border: 3px solid var(--clr-periwinkle) !important;
  border-radius: var(--rad-sm) !important;
  font-size: 1rem !important;
  outline: none !important;
  transition: all var(--trs) !important;
  background: rgba(185, 199, 248, 0.1) !important;
  color: var(--clr-dark) !important;
  margin: 10px 0 !important;
}
#text:focus {
  border-color: var(--clr-zaffre) !important;
  background: rgba(13, 33, 165, 0.05) !important;
  box-shadow: 0 0 0 4px rgba(13, 33, 165, 0.1), var(--shdw-soft) !important;
  transform: translateY(-2px) !important;
}
#text::placeholder {
  color: var(--clr-periwinkle);
}

#text[style*="width"] {
  width: 100% !important;
  max-width: 100%;
}

.btn-generate,
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--rad-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trs);
  text-decoration: none;
  margin: 10px 5px;
}

.btn-generate,
.btn-primary {
  background: var(--grad-btn);
  color: var(--clr-white);
  box-shadow: var(--shdw-soft);
}
.btn-generate:hover,
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shdw-hover);
}

.btn-secondary {
  background: rgba(185, 199, 248, 0.3);
  color: var(--clr-zaffre);
  border: 2px solid var(--clr-periwinkle);
}
.btn-secondary:hover {
  background: rgba(185, 199, 248, 0.5);
  transform: translateY(-2px);
}

.qr-display {
  background: var(--grad-qr);
  border-radius: var(--rad-md);
  padding: 25px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 3px dashed var(--clr-citron);
  margin: 20px 0;
  animation: qrPop 0.4s ease;
  transition: all var(--trs);
}
.qr-display:hover {
  border-color: var(--clr-zaffre);
  transform: scale(1.02);
  box-shadow: var(--shdw-soft);
}

#qrcode {
  width: 180px !important;
  height: 180px !important;
  margin: 0 auto !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}
#qrcode canvas {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.footer {
  margin-top: 25px;
  color: var(--clr-periwinkle);
  font-size: 0.85rem;
  font-weight: 500;
}

@media (max-width: 500px) {
  .app-wrapper {
    padding: 30px 20px;
  }
  h1 {
    font-size: 1.5rem;
  }
  #text {
    padding: 12px 16px !important;
    font-size: 0.95rem !important;
  }
  .btn-generate, .btn-primary, .btn-secondary {
    width: 100%;
    margin: 8px 0;
  }
  #qrcode {
    width: 150px !important;
    height: 150px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
:focus-visible {
  outline: 3px solid var(--clr-zaffre);
  outline-offset: 2px;
}