body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: linear-gradient(180deg, #020617, #0f172a 40%, #0ea5e9);
  color: #e0f2fe;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* COOKIE CRUMBS */
.crumb {
  position: absolute;
  width: 1vw;
  /* relative size */
  height: 1vw;
  max-width: 12px;
  max-height: 12px;
  background: #fcd34d;
  border-radius: 50%;
  animation: floatCrumb linear infinite;
}

@keyframes floatCrumb {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0.8;
  }

  50% {
    transform: translate(5vw, 2.5vw) rotate(180deg);
    opacity: 0.5;
  }

  100% {
    transform: translate(10vw, 0) rotate(360deg);
    opacity: 0.8;
  }
}

/* TOP PANEL */
.top-panel {
  display: flex;
  flex-direction: column;
  /* default for small screens */
  align-items: center;
  text-align: center;
  background: #411900;
  padding: 15px 10px;
  font-size: 5vw;
  /* scales with screen width */
  font-weight: bold;
}

.quirky-message {
  font-size: 3vw;
  color: #fed9c1;
  margin-top: 5px;
}

/* GAME PANEL */
#game {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 15px;
}

/* CONTROLS LEFT */
.controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}


/* DASHBOARD RIGHT */
#dashboard {
  display: grid;
  gap: 12px;
  margin-top: 15px;
}

.stat-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 14px;
  padding: 8px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.2);
  transition: all 0.25s ease;
}

.stat-title {
  font-size: 1rem;
  opacity: 0.8;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: bold;
  margin-top: 3px;
}

/* BUTTONS */
.btn {
  background: rgba(30, 58, 138, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 6px 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  color: #e0f2fe;
  font-size: 0.9rem;
}

.btn:hover {
  background: rgba(14, 165, 233, 0.4);
  transform: translateX(3px);
}

.btn[data-action="bake"] {
  background: linear-gradient(120deg, #62cefc, #005177);
  color: #022c22;
}

.meta {
  font-size: 0.8rem;
  color: #bae6fd;
}

footer {
  text-align: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 10;
  font-size: 0.8rem;
}

.achievement-popup {
  position: fixed;
  top: 2vh;
  right: 2vw;
  background: gold;
  padding: 10px 15px;
  border-radius: 10px;
  font-weight: bold;
  color: black;
  box-shadow: 0 0 10px orange;
  z-index: 1000;
  animation: popup 0.5s ease-out;
}

@keyframes popup {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* MEDIA QUERIES */

/* Tablet */
@media (min-width: 600px) and (max-width: 1024px) {
  .top-panel {
    flex-direction: row;
    font-size: 3vw;
  }

  .quirky-message {
    font-size: 2vw;
  }

  #game {
    flex-direction: row;
    gap: 20px;
  }

  .controls {
    flex: 1;
  }

  #dashboard {
    flex: 1;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* PC / Desktop */
@media (min-width: 1025px) {
  .top-panel {
    flex-direction: row;
    font-size: 1.5rem;
  }

  .quirky-message {
    font-size: 1rem;
  }

  #game {
    flex-direction: row;
  }

  .controls {
    flex: 1;
  }

  #dashboard {
    flex: 1;
    grid-template-columns: repeat(3, 1fr);
  }
}


/* Make charts responsive */
#dashboard canvas {
  width: 100% !important;
  /* fill the stat-card width */
  height: auto !important;
  /* keep aspect ratio */
}

/* Optionally, limit max height so charts don’t become too tall */
#dashboard canvas {
  max-height: 150px;
}

/* Tablet */
@media (max-width: 1024px) {
  #dashboard canvas {
    max-height: 120px;
  }
}

/* Phone */
@media (max-width: 600px) {
  #dashboard canvas {
    max-height: 100px;
  }
}

/* Responsive chart container */
.stat-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 14px;
  padding: 8px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.2);
  transition: all 0.25s ease;
  font-size: 1rem;
  /* base font for chart text */
}

/* Chart canvas */
#dashboard canvas {
  width: 100% !important;
  height: auto !important;
  max-height: 150px;
}

/* Tablet */
@media (max-width: 1024px) {
  .stat-card {
    font-size: 1.1rem;
    /* increase font for charts */
  }

  #dashboard canvas {
    max-height: 120px;
  }
}

/* Phone */
@media (max-width: 600px) {
  .stat-card {
    font-size: 1.3rem;
    /* larger font on phones */
  }

  #dashboard canvas {
    max-height: 100px;
  }
}

/* CONTROLS LEFT */
.controls {
  display: flex;
  flex-direction: column;
  /* default stacked for mobile */
  gap: 15px;
}

/* Make click and passive upgrades two columns on larger screens */
#click-upgrades,
#passive-upgrades {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  /* default single column for phones */
}

/* BUTTONS */
.btn {
  background: rgba(30, 58, 138, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 10px 12px;
  /* more padding for larger buttons */
  transition: all 0.2s ease;
  cursor: pointer;
  color: #e0f2fe;
  font-size: 1rem;
  /* larger default font */
}

.btn .title {
  font-size: 1.1rem;
}

.btn .meta {
  font-size: 0.95rem;
}

/* Tablet */
@media (min-width: 600px) and (max-width: 1024px) {
  .controls {
    flex-direction: row;
    /* upgrades side by side */
    gap: 20px;
  }

  #click-upgrades,
  #passive-upgrades {
    grid-template-columns: 1fr;
    /* still single column inside each */
  }

  .btn {
    font-size: 1.1rem;
    padding: 12px 14px;
  }

  .btn .title {
    font-size: 1.2rem;
  }

  .btn .meta {
    font-size: 1rem;
  }
}

/* PC / Desktop */
@media (min-width: 1025px) {
  .controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }

  #click-upgrades,
  #passive-upgrades {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 equal columns */
    gap: 12px;
  }

  .btn {
    font-size: 1.2rem;
    padding: 14px 16px;
  }

  .btn .title {
    font-size: 1.3rem;
  }

  .btn .meta {
    font-size: 1.05rem;
  }
}

.crumb {
  position: absolute;
  background: #d4a373;
  border-radius: 50%;
  pointer-events: none;
  animation-name: fallToBottom;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  /* ensures it stays at bottom after animation */
}

@keyframes fallToBottom {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 1;
    /* stay visible until removed */
  }
}