/* =========================================================================================
   GLOBAL RESET (MOBILE FIRST - PERFECT)
========================================================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background: #0A0E1F;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #fff;
  overflow: hidden;
  position: fixed;
  touch-action: manipulation;
}

/* =========================================================================================
   SCROLLBAR HIDE
========================================================================================= */

::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* =========================================================================================
   UTILITIES
========================================================================================= */

.hidden {
  display: none !important;
}

.active {
  display: block !important;
}

.mt-2 {
  margin-top: 16px !important;
}

.mt-3 {
  margin-top: 24px !important;
}

.full-width {
  width: 100% !important;
}

/* =========================================================================================
   BUTTONS (FAST & SMOOTH)
========================================================================================= */

.btn {
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  background: rgba(0, 234, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 48px;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn:active {
  background: rgba(0, 234, 255, 0.2);
  transform: scale(0.96);
}

.btn.small {
  padding: 10px 16px;
  font-size: 14px;
  min-height: 42px;
  min-width: 42px;
}

.btn.primary {
  background: linear-gradient(135deg, #00eaff, #ff00e0);
  color: #000;
  font-weight: 700;
  border: none;
  box-shadow: 0 0 20px rgba(0, 234, 255, 0.4);
}

.btn.primary:active {
  opacity: 0.9;
  transform: scale(0.94);
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 0, 224, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.btn-icon {
  margin-right: 8px;
  font-size: 18px;
}

/* =========================================================================================
   TOPBAR (PERFECTLY ALIGNED)
========================================================================================= */

.topbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  width: 100%;
  background: rgba(10, 14, 31, 0.98);
  position: fixed;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(0, 234, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.badge {
  height: 46px;
  width: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #00eaff, #ff00e0);
  color: #000;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 0 25px rgba(0, 234, 255, 0.5);
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-text .title {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #00eaff, #a0eaff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text .sub {
  font-size: 13px;
  opacity: 0.8;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #a0eaff;
}

/* =========================================================================================
   MODAL — WELCOME SCREEN (PERFECT CENTER)
========================================================================================= */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 31, 0.95);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal.show {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 24px;
  border-radius: 24px;
  background: linear-gradient(145deg, 
    rgba(25, 30, 55, 0.98) 0%, 
    rgba(20, 25, 50, 0.98) 100%);
  border: 1px solid rgba(0, 234, 255, 0.3);
  text-align: center;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(0, 234, 255, 0.2),
    0 0 40px rgba(255, 0, 224, 0.2);
}

.modal-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #00eaff, #ff00e0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.modal-sub {
  font-size: 16px;
  opacity: 0.9;
  line-height: 1.5;
  margin-bottom: 28px;
  color: #a0eaff;
}

/* Zodiac Type Selection Buttons */
.zodiac-type-selection {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.type-btn {
  flex: 1;
  padding: 16px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0, 234, 255, 0.2);
  background: rgba(10, 14, 31, 0.8);
  color: #fff;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.type-btn.active {
  background: rgba(0, 234, 255, 0.15);
  border-color: #00eaff;
  box-shadow: 0 0 15px rgba(0, 234, 255, 0.3);
}

.type-btn:active {
  transform: scale(0.96);
}

.type-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.type-text {
  font-size: 14px;
}

/* Zodiac Input Styles */
.zodiac-input {
  display: none;
  margin-bottom: 16px;
}

.zodiac-input.active {
  display: block;
}

.input-label {
  font-size: 15px;
  color: #a0eaff;
  margin-bottom: 12px;
  text-align: left;
  opacity: 0.9;
}

.input-row {
  display: flex;
  gap: 12px;
  margin: 8px 0 16px;
  width: 100%;
}

.western-input-row {
  display: flex;
  gap: 12px;
  margin: 8px 0 16px;
  width: 100%;
}

.form-select {
  flex: 1;
  padding: 16px 16px;
  font-size: 16px;
  border-radius: 14px;
  border: 1px solid rgba(0, 234, 255, 0.3);
  background: rgba(0, 234, 255, 0.1);
  color: #fff;
  font-weight: 600;
  min-height: 52px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0eaff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}

.form-select:focus {
  border-color: #00eaff;
  box-shadow: 0 0 20px rgba(0, 234, 255, 0.3);
  background: rgba(0, 234, 255, 0.15);
  outline: none;
}

.form-select option {
  background: #191E37;
  color: #fff;
  padding: 8px;
}

.input-row input {
  flex: 1;
  padding: 16px 20px;
  font-size: 16px;
  border-radius: 14px;
  border: 1px solid rgba(0, 234, 255, 0.3);
  background: rgba(0, 234, 255, 0.1);
  color: #fff;
  text-align: center;
  font-weight: 600;
  min-height: 52px;
}

.input-row input:focus {
  border-color: #00eaff;
  box-shadow: 0 0 20px rgba(0, 234, 255, 0.3);
  background: rgba(0, 234, 255, 0.15);
  outline: none;
}

.input-row input::placeholder {
  color: rgba(160, 234, 255, 0.6);
  opacity: 1;
}

/* =========================================================================================
   DECK STAGE (PERFECT CENTERING)
========================================================================================= */

.stage {
  position: fixed;
  top: 100px;
  left: 0;
  right: 0;
  bottom: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
  z-index: 1;
  overflow: hidden;
}

/* =========================================================================================
   DECK CONTAINER (PERFECT SIZE & CENTER)
========================================================================================= */

.deck {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 360px;
  max-height: 520px;
  margin: 0 auto;
  perspective: 1000px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

/* Swipe Navigation */
.swipe-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 200px;
  margin-top: 12px;
}

.swipe-indicator {
  flex: 1;
  text-align: center;
  font-size: 14px;
  color: #a0eaff;
  font-weight: 600;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.8;
}

.empty-text {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, #00eaff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.empty-subtext {
  font-size: 14px;
  color: #a0eaff;
  opacity: 0.8;
}

/* =========================================================================================
   CARD CONTAINER (SWIPEABLE)
========================================================================================= */
.card-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 24px;
}

/* =========================================================================================
   CARD BASE (SOLID NEON BACKGROUNDS)
========================================================================================= */

.card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 24px;
  border-radius: 24px;
  text-align: left;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  
  /* SOLID NEON BACKGROUND - NO TRANSPARENCY */
  background: linear-gradient(
    145deg,
    rgba(30, 35, 60, 1) 0%,
    rgba(20, 25, 50, 1) 100%
  );
  
  border: 1px solid rgba(0, 234, 255, 0.4);
  box-shadow: 
    0 15px 35px rgba(0, 0, 0, 0.4),
    0 0 25px rgba(0, 234, 255, 0.25),
    0 0 25px rgba(255, 0, 224, 0.25);
}

.card.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.card.next {
  transform: translateX(100%) scale(0.95);
  opacity: 0;
}

.card.prev {
  transform: translateX(-100%) scale(0.95);
  opacity: 0;
}

/* =========================================================================================
   CARD CONTENT (PERFECT ALIGNMENT)
========================================================================================= */

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, #00eaff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.card-num {
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  background: rgba(0, 234, 255, 0.2);
  border-radius: 12px;
  color: #00eaff;
  border: 1px solid rgba(0, 234, 255, 0.3);
  min-width: 40px;
  text-align: center;
}

.card-emoji-box {
  width: 100%;
  height: 140px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 72px;
  margin: 24px 0;
  border: 1px solid rgba(0, 234, 255, 0.2);
  box-shadow: 
    inset 0 0 25px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(0, 234, 255, 0.2);
}

.card-desc {
  font-size: 15px;
  line-height: 1.5;
  color: #e0f7ff;
  margin-bottom: 20px;
  min-height: 120px;
  overflow-y: auto;
  padding-right: 4px;
  opacity: 0.95;
}

.card-desc::-webkit-scrollbar {
  width: 4px;
}

.card-desc::-webkit-scrollbar-thumb {
  background: rgba(0, 234, 255, 0.5);
  border-radius: 2px;
}

.card-details {
  font-size: 15px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 234, 255, 0.2);
  color: #a0eaff;
  line-height: 1.4;
}

.card-details strong {
  font-weight: 700;
  color: #00eaff;
}

/* =========================================================================================
   FOOTER (PERFECTLY ALIGNED)
========================================================================================= */

.footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 31, 0.98);
  border-top: 1px solid rgba(0, 234, 255, 0.1);
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* =========================================================================================
   MOBILE RESPONSIVE (PERFECT FOR ALL PHONES)
========================================================================================= */

@media (max-width: 400px) {
  .topbar {
    padding: 14px 16px;
    gap: 10px;
  }
  
  .badge {
    height: 42px;
    width: 42px;
    font-size: 18px;
  }
  
  .brand-text .title {
    font-size: 18px;
  }
  
  .brand-text .sub {
    font-size: 12px;
  }
  
  .stage {
    top: 90px;
    bottom: 70px;
    padding: 0 16px;
  }
  
  .footer {
    padding: 14px 16px;
  }
  
  .deck {
    max-width: 340px;
    max-height: 500px;
  }
  
  .card {
    padding: 20px;
    border-radius: 22px;
  }
  
  .card-title {
    font-size: 22px;
  }
  
  .card-emoji-box {
    height: 120px;
    font-size: 64px;
    margin: 20px 0;
  }
  
  .card-desc {
    font-size: 14px;
    min-height: 100px;
  }
  
  .modal-card {
    padding: 28px 20px;
    max-width: 340px;
  }
  
  .modal-title {
    font-size: 24px;
  }
  
  .modal-sub {
    font-size: 15px;
  }
  
  .btn {
    min-height: 46px;
    min-width: 46px;
  }
}

/* Extra small phones */
@media (max-width: 360px) {
  .topbar {
    padding: 12px 14px;
  }
  
  .badge {
    height: 40px;
    width: 40px;
    font-size: 17px;
  }
  
  .brand-text .title {
    font-size: 17px;
  }
  
  .stage {
    top: 80px;
    bottom: 60px;
    padding: 0 14px;
  }
  
  .footer {
    padding: 12px 14px;
  }
  
  .deck {
    max-width: 320px;
    max-height: 480px;
  }
  
  .card {
    padding: 18px;
  }
  
  .card-emoji-box {
    height: 110px;
    font-size: 60px;
  }
  
  .modal-card {
    padding: 24px 18px;
  }
  
  .type-text {
    font-size: 13px;
  }
}

/* =========================================================================================
   LANDSCAPE MODE OPTIMIZATION
========================================================================================= */

@media (max-height: 600px) and (orientation: landscape) {
  .stage {
    top: 80px;
    bottom: 60px;
  }
  
  .deck {
    max-width: 320px;
    max-height: 340px;
  }
  
  .card-emoji-box {
    height: 90px;
    font-size: 56px;
    margin: 16px 0;
  }
  
  .card-desc {
    min-height: 70px;
    font-size: 14px;
  }
  
  .topbar {
    flex-direction: row;
    align-items: center;
    height: 70px;
    padding: 0 20px;
    gap: 0;
  }
  
  .brand {
    flex: 1;
  }
  
  .footer {
    padding: 10px 20px;
  }
}

/* =========================================================================================
   SAFARI SPECIFIC FIXES
========================================================================================= */

@supports (-webkit-touch-callout: none) {
  .stage {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  
  .modal {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .topbar {
    padding-top: calc(16px + env(safe-area-inset-top));
  }
}

/* =========================================================================================
   REDUCED MOTION PREFERENCE
========================================================================================= */

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}