:root {
  --primary: #FF3B30;
  --secondary: #2C2C2E;
  --background: #121212;
  --surface: #1C1C1E;
  --surface-container: #232326;
  --text-primary: #F5D0D0;
  --text-secondary: #A1A1AA;
  --border: #2A2A2D;
  --font-family: 'Inter', 'PlusJakartaSans', sans-serif;
}

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

body {
  background-color: var(--background);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(255, 59, 48, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(44, 44, 46, 0.6) 0%, transparent 60%);
  background-size: 200% 200%;
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  animation: bgPan 20s ease-in-out infinite;
}

@keyframes bgPan {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  padding: 0 24px;
}

/* Typography */
h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.text-center {
  text-align: center;
}

.text-primary {
  color: var(--primary);
}

.text-secondary {
  color: var(--text-secondary);
}

/* Buttons */
.btn-primary {
  background-color: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: 18px;
  padding: 18px;
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Cards & Surface */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
}

/* Utils */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-4 {
  gap: 16px;
}

.gap-2 {
  gap: 8px;
}

.p-4 {
  padding: 16px;
}

.p-6 {
  padding: 24px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-4 {
  margin-bottom: 16px;
}

.w-full {
  width: 100%;
}

/* Grid */
.grid {
  display: grid;
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-cols-6 {
  grid-template-columns: repeat(6, 1fr);
}

.grid-cols-8 {
  grid-template-columns: repeat(8, 1fr);
}

/* Responsive Adjustments */
@media (min-width: 768px) {
  .web-split {
    display: flex;
    gap: 40px;
  }

  .web-split>div {
    flex: 1;
  }

  .md-grid-cols-6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (min-width: 1024px) {
  .lg-grid-cols-8 {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* Avatars */
.avatar-container {
  border-radius: 20px;
  border: 3.5px solid rgba(255, 59, 48, 0.3);
  box-shadow: 0 4px 8px rgba(255, 59, 48, 0.15);
  overflow: hidden;
  aspect-ratio: 1;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Web-Native Elements */
.hero {
  text-align: center;
  padding: 80px 20px 40px;
  position: relative;
}

.hero h1 {
  font-size: clamp(48px, 10vw, 72px);
  font-weight: 900;
  letter-spacing: -2px;
  margin: 0;
  color: white;
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.2), 0 0 80px rgba(255, 59, 48, 0.4);
  animation: floatTitle 4s ease-in-out infinite;
}
@keyframes floatTitle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 3D Rounded Carousel */
.carousel-container {
  perspective: 1200px;
  width: 120px;
  height: 120px;
}
.carousel-spinner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: spinCarousel 20s linear infinite;
}
.carousel-wrapper {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
}
.carousel-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.2);
  overflow: hidden;
  background: var(--surface-container);
}
@keyframes spinCarousel {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-360deg); }
}
@keyframes counterSpinCarousel {
  0% { transform: rotateY(var(--static-offset)) rotateY(0deg); }
  100% { transform: rotateY(var(--static-offset)) rotateY(360deg); }
}
@keyframes glowFront {
  0%, 100% {
    border-color: var(--primary);
    box-shadow: 0 0 40px rgba(255,59,48,0.8);
    scale: 1.1;
    filter: brightness(1.2);
  }
  30%, 70% {
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 16px 32px rgba(0,0,0,0.6);
    scale: 0.9;
    filter: brightness(0.6);
  }
  50% {
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    scale: 0.8;
    filter: brightness(0.3);
  }
}

/* Hero Avatar Animations */
.hero-avatar-center {
  animation: floatAvatarCenter 4s ease-in-out infinite;
}
.hero-avatar-left {
  animation: floatAvatarSide 5s ease-in-out infinite 1s;
}
.hero-avatar-right {
  animation: floatAvatarSide 6s ease-in-out infinite 0.5s;
}

@keyframes floatAvatarCenter {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes floatAvatarSide {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero p {
  font-size: 20px;
  color: var(--primary);
  font-weight: 900;
  letter-spacing: 8px;
  margin-top: 12px;
  text-transform: uppercase;
}

/* Mode Cards */
.mode-card {
  background: rgba(35, 35, 38, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 32px;
  padding: 40px 32px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
  flex: 1;
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(180deg, rgba(255, 59, 48, 0.1) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.4s;
}

.mode-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(255, 59, 48, 0.6);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 59, 48, 0.2);
}

.mode-card:hover::before {
  opacity: 1;
}

.mode-card.active {
  background: rgba(44, 44, 46, 0.8);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary), 0 16px 48px rgba(255, 59, 48, 0.3);
}

/* Custom Range Slider */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  margin: 20px 0;
}

input[type=range]:focus {
  outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  background: var(--surface-container);
  border-radius: 4px;
  border: 1px solid var(--border);
}

input[type=range]::-webkit-slider-thumb {
  border: 4px solid var(--surface);
  height: 32px;
  width: 32px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -13px;
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
  transition: transform 0.2s;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

/* Avatar Stack */
.avatar-stack {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  padding: 40px 0;
}

.avatar-stack-item {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--background);
  background-color: var(--surface-container);
  margin-left: -20px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
  transition: transform 0.3s;
}

.avatar-stack-item:first-child {
  margin-left: 0;
}

.avatar-stack-item:hover {
  transform: translateY(-8px);
  z-index: 10;
}

.avatar-stack-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Wizard Specific Styles */
.wizard-step {
  width: 100%;
  animation: slideUpFade 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.number-block {
  background: rgba(35, 35, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px 0;
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s;
  color: white;
}

.number-block:hover:not(.disabled) {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 24px rgba(255, 59, 48, 0.4);
}

.number-block.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.wizard-nav {
  position: absolute;
  top: 40px;
  left: 24px;
}

.btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Big Action Button */
.btn-massive {
  font-size: clamp(16px, 4vw, 22px);
  padding: 20px clamp(32px, 8vw, 80px);
  border-radius: 50px;
  background: linear-gradient(135deg, #FF3B30, #FF6B00);
  background-size: 200% auto;
  box-shadow: 0 12px 32px rgba(255, 59, 48, 0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn-massive:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 40px rgba(255, 59, 48, 0.7);
  background-position: right center;
}

@keyframes pulseButton {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
  }

  70% {
    box-shadow: 0 0 0 20px rgba(255, 59, 48, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
  }
}

/* Flip Card Styles */
.flip-card-container {
  perspective: 1000px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 550px;
}

.flip-card {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  min-height: 550px;
}

.flip-card.flipped {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background-color: var(--surface);
  border: 2px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.flip-card-back {
  transform: rotateY(180deg);
  border-color: var(--primary);
}

.input-field {
  width: 100%;
  background: var(--surface-container);
  border: 2px solid var(--border);
  color: var(--text-primary);
  border-radius: 16px;
  padding: 20px;
  font-size: 20px;
  font-weight: 600;
  margin-top: 20px;
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.2);
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(255, 59, 48, 0.2);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .web-split {
    flex-direction: column;
    gap: 24px;
  }

  .header {
    flex-direction: column;
    text-align: center;
  }

  .card {
    padding: 24px;
  }

  .number-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .number-block {
    padding: 16px 0;
    font-size: 24px;
  }

  .mode-card {
    min-width: 100%;
  }

  .wizard-nav {
    top: 16px;
    left: 16px;
  }
}