@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;700&display=swap');

body {
  margin: 0;
  padding: 40px 20px;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #c7f0ff, #ffe1f2);
  display: flex;
  justify-content: center;
  color: #111827;
   transition: background 600ms ease, filter 600ms ease;
}
.rage-fog {
  opacity: 0.45;
  filter: blur(1.2px);
}

.app {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  position: relative;
}

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 
  {
  
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(45deg, #f472b6, #60a5fa, #34d399, #facc15);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text; /* fallback for non-webkit browsers */
  text-align: center;

}

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


.buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

.buttons button {
  padding: 16px 22px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  color: white;
  box-shadow: 0 4px rgba(0,0,0,.2);
  transition: transform .2s ease, opacity .3s ease;
}

.buttons button:active { transform: translateY(2px); }

.buttons button:nth-child(1){background:#f87171;}
.buttons button:nth-child(2){background:#60a5fa;}
.buttons button:nth-child(3){background:#34d399;}
.buttons button:nth-child(4){background:#facc15;}
.buttons button:nth-child(5){background:#a78bfa;}
.buttons button:nth-child(6){background:#f472b6;}
  .buttons button:nth-child(7){ background:#fb923c; } /* 8 = orange */
.buttons button:nth-child(8){ background:#f97316; } /* 9 = darker orange */




.grid { display: flex; flex-direction: column; gap: 12px; }

.row { display: flex; gap: 12px; position: relative; }

.cell {
  width: 70px;
  height: 70px;
  background: white;
  border-radius: 14px;
  border: 2px solid #d1d5db;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: 700;
  transition: background .3s, transform 0.8s;
  transform-style: preserve-3d;
}
  .cell.orange {
  background: #fb923c !important;
  color: white !important;
  border: none !important;
}

.cell.green { background:#22c55e; color:white; border:none; }
.cell.yellow { background:#eab308; color:white; border:none; }
.cell.gray { background:#e5e7eb; }

.flip { transform: rotateX(180deg); }

/* AURA */
.aura {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 20px;
  width: 180px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  text-align: center;
  transition: transform 600ms cubic-bezier(.34,1.56,.64,1),
              box-shadow 600ms ease;
}

.aura h3 { 
  margin: 0; font-size: 1.2rem; 
  }
.aura-score { font-size: 2.6rem; 
  font-weight: 700; 
  margin-top: 10px; 
  font-variant-numeric: tabular-nums; 
  transition: transform .25s ease;
   text-align: center;
  background: linear-gradient(270deg, #f472b6, #60a5fa, #34d399, #facc15);
  background-size: 800% 800%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 8s ease infinite;
}

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

#info-btn {
  position: absolute;
  top: 20px;
  left: 0px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}
  #mode-btn {
  position: absolute;
  top: -20px;
  left: 0px;
  background: #fb7185;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

.popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;       /* make sure it's above everything */
  transform: none !important; /* avoid stacking context issues */
    perspective: none !important; 
}
#popup-title{
    text-align: center;
}
#close-popup-btn {
   position: absolute;
  top: 2.5px;
  right: 8px;
  font-size: 22px;
  cursor: pointer;
}

.popup-content {
    position: relative;
  background: white;
  padding: 20px;
  border-radius: 18px;
  text-align: center;
  max-width: 320px;
  z-index: 10000; /* just to be extra safe */
}


.timer { margin-top: 15px; font-weight: 600; color: #4b5563; }

#share-btn {
  margin-top: 14px;
  padding: 12px 18px;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, #60a5fa, #34d399, #f472b6);
  box-shadow: 0 6px rgba(0,0,0,0.25);
}

#share-btn:active {
  transform: translateY(2px);
  box-shadow: 0 4px rgba(0,0,0,0.25);
}

.sleek-info {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  padding: 22px;
  border-radius: 20px;
  max-width: 320px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}



.info-header { 
  display: flex; 

  align-items: center; 

  justify-content: center;
}
.close-btn { font-size: 24px; font-weight: 700; cursor: pointer; }

.message {
  position: absolute;
  top: 10%;
  background: rgba(255,255,255,.95);
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .4s;
}

.shake { animation: shake .4s; }
@keyframes shake {
  0%{transform:translateX(0)}
  25%{transform:translateX(-5px)}
  50%{transform:translateX(5px)}
  75%{transform:translateX(-5px)}
  100%{transform:translateX(0)}
}
  
  .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}


/* Mini Aura Float per cell */
/* Mini Aura Floats should ignore parent flips */
.aura-float {
  font-weight: 700;
  font-size: 16px;
  animation: floatAura 1.2s ease forwards;
  pointer-events: none;
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotateX(0); /* keep upright */
  transform-style: preserve-3d;
  will-change: transform, opacity;
}


.aura-float.positive { color: #15803d; }
.aura-float.negative { color: #ef4444; }

@keyframes floatAura {
  0% { opacity: 0; transform: translate(-50%,10px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-25px); }
}

.aura-bump { transform: scale(1.1); }
 /* ===============================
   MODE TRANSITIONS (ADD ONLY)
   =============================== */

/* Slight intensity flash during mode switch */
body.mode-transition {
  filter: brightness(1.05) saturate(1.15);
}

/* Aura glide states */
.aura.rage-enter {
  transform: translateX(18px) translateY(-6px) scale(1.05);
  box-shadow: 0 20px 50px rgba(255,80,80,0.45);
}

.aura.rage-exit {
  transform: translateX(0) translateY(0) scale(1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Button pop animation */
.buttons button.pop {
  animation: popIn 420ms cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes popIn {
  0% {
    transform: scale(0.4) translateY(10px);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.message {
  position: fixed;
  top: 10%;
  
  transform: translateX(-50%) translateY(-10px);
  background: rgba(255,255,255,0.95);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .4s, transform .4s;
  z-index: 9999;
}

/* Confetti particles */
.confetti {
  position: fixed;
  width: 8px;
  height: 8px;
  pointer-events: none;
  animation: confettiFall 900ms ease-out forwards;
  z-index: 9999;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(140px) rotate(360deg);
    opacity: 0;
  }
}   
.bg-fade {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, #c7f0ff, #ffe1f2);
  transition: none; /* remove opacity here */
}

/* overlay for rage mode */
.bg-fade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #8B0000, #FF4500, #4B0082, #FF6347);
  opacity: 0;
  transition: opacity 1.2s ease-in-out; /* fade duration */
  pointer-events: none;
}

.bg-fade.rage::after {
  opacity: 1;
}
/* =========================
   MOBILE RESPONSIVENESS
   ========================= */

@media (max-width: 768px) {

  body {
    overflow-x: hidden;
  }

  /* Stack main layout vertically */
  .app {
    flex-direction: column;
    align-items: center;
    padding: 8px;
    gap: 10px;
  }

  .main {
    width: 100%;
    max-width: 360px;
    order: 1;
  }
  .game-title {
    margin-top: 55px; /* push it down */
    margin-bottom: 18px;
  }

  /* Aura moves to top */
  .aura {
    order: 4;
    width: 100%;
    max-width: 360px;
    margin-bottom: 8px;
    margin-top: 4px;
    padding: 8px;
    text-align: center;
  }

  .aura h3 {
    font-size: 20px;
    margin-bottom: 4px;
    
  }

  .aura-score {
    font-size: 30px;
    margin-top: 10px;
  }
  
  #aura-percentile {
    font-size: 6px;
  }

  /* Grid shrink */
  .grid {
    order: 3;
    transform: scale(1);
    transform-origin: top center;
    margin: 2px auto;
    margin-top: 20px;
     gap: 8px;
    
  }

  .row {
    margin-bottom: 2px;
    gap: 8px;
  }

  .cell {
    width: 55px;
    height: 55px;
    font-size: 18px;
   
  }

  /* Number buttons */
  .buttons {
    order: 2;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 8px;
    justify-items: center; 
    justify-content: center;
    
  }

  .buttons button {
    padding: 16px 20px;
    font-size: 16px;
    border-radius: 20px;
    
  }

  /* Bottom control buttons */
  #mode-btn,
  #info-btn {
    padding: 9px 12px;
   
  }

  #mode-btn {
    left: 0px;
   
    
  }

  #info-btn {
    left: 0px;
    top: 15px;
  }

  /* Popups scale properly */
  .popup-content,
  .sleek-info {
    width: 90%;
    max-width: 360px;
    padding: 16px;
  }

}