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

/* main background gradient thing */
body {
  min-height: 100vh;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    background-attachment: fixed;
    font-family: system-ui, sans-serif;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-root {
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
  display: flex;
  flex-direction: column;
    align-items: center;
  padding: 1rem 0.75rem 2rem;
    position: relative;
}

.glass {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* the top score/level bar */
#hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0.8rem 0.5rem 0.5rem;
  gap: 0.5rem;
}

.hud-block {
    flex: 1;
    display: flex;
    flex-direction: column;
   align-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 0.4rem 0.5rem;
    backdrop-filter: blur(8px);
}

.hud-label { font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: #666; }
.hud-value {
  font-size: 1.3rem;
    font-weight: 600;
  color: #e0e0e0;
}

/* timer stuff */
.timer-bar-wrap {
    width: 100%;
  height: 8px;
    background: rgba(255,255,255,0.08);
  border-radius: 4px;
    overflow: hidden;
  margin: 0.6rem 0 0.3rem;
    position: relative;
}

#timer-bar {
  height: 100%;
    background: linear-gradient(90deg, #7c3aed, #c084fc);
  border-radius: 4px;
    transition: width 0.1s linear, background 0.3s;
}

#timer-value {
    position: absolute;
  right: 0;
    top: 10px;
  font-size: 0.7rem;
    color: #888;
}

/* turns red when time is low lol */
#timer-bar.low { background: linear-gradient(90deg, #ef4444, #f87171); }

/* easy medium hard badge */
#difficulty-badge {
    font-size: 0.65rem;
  font-weight: 700;
    letter-spacing: 0.15em;
  padding: 0.2rem 0.8rem;
    border-radius: 50px;
  margin-bottom: 0.5rem;
    background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.4);
    color: #c084fc;
  transition: all 0.3s;
}

#difficulty-badge.medium {
  background: rgba(234,179,8,0.15);
    border-color: rgba(234,179,8,0.4);
  color: #fde047;
}
#difficulty-badge.hard {
    background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
    color: #f87171;
}

/* grid wrapper */
#grid-wrap {
  width: 100%;
    padding: 0.5rem 0;
  display: flex;
    align-items: center;
  justify-content: center;
}

#grid {
    display: grid;
  gap: 6px;
    width: 100%;
}

/* shake animation when wrong */
#grid.shake { animation: shake 0.4s ease; }

@keyframes shake {
    0%,100% { transform: translateX(0) }
  15% { transform: translateX(-8px) }
    30% { transform: translateX(8px) }
  45% { transform: translateX(-5px) }
    60% { transform: translateX(5px) }
  75% { transform: translateX(-3px) }
    90% { transform: translateX(3px) }
}

/* each color square */
.cell {
    border-radius: 10px;
  aspect-ratio: 1;
    cursor: pointer;
  border: 2px solid transparent;
    transition: transform 0.3s, border-color 0.3s, filter 0.3s, box-shadow 0.3s;
  position: relative;
}

.cell:hover {
    transform: scale(1.07);
  filter: brightness(1.15);
    border-color: rgba(255,255,255,0.2);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.cell:active { transform: scale(0.94); }

/* green flash when correct !! */
.cell.correct-flash {
  animation: correctFlash 0.4s ease forwards;
    border-color: #22c55e !important;
  box-shadow: 0 0 18px rgba(34,197,94,0.6) !important;
}

.cell.correct-flash::after {
    content: '✓';
  position: absolute;
    inset: 0;
  display: flex;
    align-items: center;
  justify-content: center;
    font-size: 1.6rem;
  color: #22c55e;
    animation: iconPop 0.4s ease forwards;
}

@keyframes correctFlash {
  0% { transform: scale(1) }
    40% { transform: scale(1.2) }
  100% { transform: scale(1) }
}

/* red flash when wrong */
.cell.wrong-flash {
    animation: wrongFlash 0.4s ease forwards;
  border-color: #ef4444 !important;
    box-shadow: 0 0 18px rgba(239,68,68,0.5) !important;
}

.cell.wrong-flash::after {
  content: '✗';
    position: absolute;
  inset: 0;
    display: flex;
  align-items: center;
    justify-content: center;
  font-size: 1.6rem;
    color: #ef4444;
  animation: iconPop 0.4s ease forwards;
}

@keyframes wrongFlash {
    0% { filter: brightness(1) }
  40% { filter: brightness(0.45) saturate(2) }
    100% { filter: brightness(1) }
}

/* this pulses the correct answer so u can see it */
.cell.pulse-correct {
  animation: pulseCorrect 0.8s ease infinite;
    border-color: #22c55e !important;
}

@keyframes pulseCorrect {
    0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5) }
  50% { box-shadow: 0 0 0 8px rgba(34,197,94,0) }
}

@keyframes iconPop {
  0% { opacity: 0; transform: scale(0.5) }
    60% { opacity: 1; transform: scale(1.2) }
  100% { opacity: 1; transform: scale(1) }
}

/* the +pts popup */
.feedback {
    position: fixed;
  top: 1.5rem;
    left: 50%;
  transform: translateX(-50%);
    display: flex;
  align-items: center;
    gap: 0.5rem;
  padding: 0.5rem 1.2rem;
    border-radius: 50px;
  font-size: 0.9rem;
    font-weight: 600;
  z-index: 200;
    backdrop-filter: blur(12px);
  transition: opacity 0.3s;
}

.feedback.correct { background: rgba(34,197,94,0.2); border: 1px solid rgba(34,197,94,0.4); color: #4ade80; }
.feedback.wrong { background: rgba(239,68,68,0.2); border: 1px solid rgba(239,68,68,0.4); color: #f87171; }
.feedback.hidden { opacity: 0; pointer-events: none; }

/* level up text that floats up */
.level-up-msg {
  position: absolute;
    left: 50%;
  top: 40%;
    transform: translate(-50%,-50%);
  font-size: 1.1rem;
    font-weight: 600;
  color: #c084fc;
    pointer-events: none;
  opacity: 0;
    z-index: 50;
  white-space: nowrap;
    text-shadow: 0 0 20px rgba(192,132,252,0.8);
}

.level-up-msg.show { animation: floatUp 1s ease forwards; }

@keyframes floatUp {
    0% { opacity: 1; transform: translate(-50%,-50%) scale(1) }
    60% { opacity: 1; transform: translate(-50%,-90%) scale(1.1) }
    100% { opacity: 0; transform: translate(-50%,-140%) scale(0.9) }
}

/* start and gameover screens */
.overlay {
  position: absolute;
    inset: 0;
  display: flex;
    flex-direction: column;
  align-items: center;
    justify-content: center;
  z-index: 100;
    border-radius: 16px;
  text-align: center;
    padding: 2rem 1.5rem;
  gap: 0.8rem;
}

.overlay h1 { 
  font-size: 2rem; 
  font-weight: 700;
   color: #fff; letter-spacing: -0.5px; 
  }
.overlay .sub {
  font-size: 0.9rem;
  color: #ccc;
  max-width: 280px;
  line-height: 1.6;
}
.overlay .big-score {
  font-size: 3.5rem;
    font-weight: 700;
  color: #c084fc;
  text-shadow: 0 0 30px rgba(192,132,252,0.5);
}
.overlay .hs-label { font-size: 0.75rem; color: #aaa; letter-spacing: 0.08em; text-transform: uppercase; }

.rules-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.72rem;
  color: #bbb;
}

/* difficulty buttons */
.difficulty-select { display: flex; gap: 0.5rem; }

.diff-btn {
  padding: 0.4rem 1rem;
    border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
  color: #ccc;
    font-size: 0.8rem;
  cursor: pointer;
    transition: all 0.3s;
}

.diff-btn:hover { border-color: rgba(124,58,237,0.5); color: #c084fc; }
.diff-btn.active {
    background: rgba(124,58,237,0.3);
  border-color: #7c3aed;
    color: #c084fc;
  font-weight: 600;
}

/* big purple button */
.btn-play {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
    border: none;
  border-radius: 50px;
  padding: 0.75rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
  margin-top: 0.4rem;
}

.btn-play:hover { 
  transform: scale(1.04);
  box-shadow: 0 6px 25px rgba(124,58,237,0.6); 
}
.btn-play:active {
   transform: scale(0.96); 
  }

/* mobile stuff - idk if this works on all phones */
@media (max-width: 400px) {
  #game-root { padding: 0.5rem 0.4rem 1rem; }
  .overlay h1 { font-size: 1.6rem; }
  .hud-value { font-size: 1.1rem; }
  #grid { gap: 4px; }
  .cell { border-radius: 7px; }
}
