@font-face {
  font-family: "Juxel";
  src: url("/Juxel.ttf") format("truetype");
  font-display: swap;
}

* {
  font-family: "Juxel", sans-serif;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #050505;
  color: #fff;
  position: relative;
}

canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

@media (max-width: 1000px) {
  canvas {
    height: auto;
  }
}

.spacer {
  height: 200vh;
}

@media (min-width: 1000px) {
  :root {
    --inset: 15vw;
    --symbol-size: 50px;
    --gap: 5vw;
  }
}

@media (max-width: 1000px) {
  :root {
    --inset: 9vw;
    --symbol-size: 10vw;
    --gap: 6vw;
  }
}

main {
  position: relative;
  width: auto;
}

/* top bar */

.topbar {
  height: 70px;
  padding: 0 var(--inset);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 9999;
  gap: 10vw;
  background: rgb(21, 21, 21);
}

#stats {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: clamp(0.8rem, 1vw, 1rem);
  position: relative;
}

#caught {
  width: 5vw;
  max-width: 12vw;
}

#endCaught {
  color: #66EE96;
  font-size: 1.4rem;
}

#missedN {
  color: #F26C6C;
  font-size: 1.4rem;
  padding: 0 2px;
}

#caughtN {
  color: #66EE96;
  font-size: 1.4rem;
  padding: 0 2px;
}

#endMissed {
  color: #F26C6C;
  font-size: 1.4rem;
}

#endTime {
  font-size: 1.4rem;
}

#progressBar {
  position: relative;
  width: 400px;
  height: 20px;
  border: 1px solid white;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-start;
  overflow: hidden;
}

.progress-segment {
  height: 100%;
  transition: width 0.3s ease-out;
}



#helpIcon {
  width: 32px;
  height: 32px;
  cursor: pointer;
  opacity: 0.9;
}

.stats-wrap {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}



.score-col {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 1rem;
  width: 50%
}

@media (min-width: 1000px) {
  .stats-wrap {
    flex-direction: row-reverse;
    gap: 1rem;
  }
}

@media (max-width: 1000px) {
  .score-col {
    width: 100%;
  }
  #progressBar {
    width: 200px;
  }
  #caught {
    width: 12vw;
  }
}



.caught-score span {
  color: #66EE96;
  font-size: 1.5rem;
}

.skull-row {
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 4px;
  width: 200px;
}

.skull-icon {
  width: 20px;
  height: 20px;
  opacity: 0.85;
  filter: grayscale(1) brightness(0.9);
  transition: opacity 0.2s ease;
}

.skull-icon:nth-child(-n+3) {
  filter: grayscale(0) brightness(1.1);
}

#collectionToggle {
  display: flex;
  align-items: center;
  justify-content: center;
}


/* collection dialog */
#collectionToggle {
  position: relative;
  z-index: 1200;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

#collectionDialog {
  position: fixed;
  inset: 0;
  background: rgb(21, 21, 21);
  backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
  color: white;
  z-index: 1100;
}

#collectionDialog.open {
  display: flex;
}

#collectionScroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 100px 20px 100px 20px;
}

#collectionContent {
  width: min(1100px, 90%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 50px;
}

.collection-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: start;
  gap: 20px;
}

.collection-row .row-title {
  font-weight: 600;
  font-size: 1.2rem;
  opacity: .9;
}

.collection-row .row-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 14px;
  grid-auto-rows: 1fr;
}

.collection-row[data-rarity="c"] .row-grid {
  row-gap: 18px;
}

@media (max-width: 1000px) {
  .collection-row {
    grid-template-columns: 1fr;
  }

  .collection-row .row-title {
    margin-bottom: 8px;
  }

  .collection-row .row-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }
}

.monster-cell {
  position: relative;
  aspect-ratio: 1/1;
  border: 2px solid;
  box-shadow: 0 8px 0 -12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.monster-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.monster-count {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: 1px 1px 0px 10px rgba(0, 0, 0, 0.8);
  width: auto;
  height: auto;
}

[data-rarity="c"] .monster-cell,
.monster-cell[data-rarity="c"] {
  border-color: #A1A1A1;
  background-color: rgb(161, 161, 161, 0.08);
  box-shadow: 0 8px 0 -4px #A1A1A1;
}

[data-rarity="u"] .monster-cell,
.monster-cell[data-rarity="u"] {
  border-color: #66EE96;
  background-color: rgba(102, 238, 150, 0.08);
  box-shadow: 0 8px 0 -4px #66EE96;
}

[data-rarity="r"] .monster-cell,
.monster-cell[data-rarity="r"] {
  border-color: #9A66EE;
  background-color: rgba(154, 102, 238, 0.08);
  box-shadow: 0 8px 0 -4px #9A66EE;
}

[data-rarity="e"] .monster-cell,
.monster-cell[data-rarity="e"] {
  border-color: #ff6c32;
  background-color: rgba(255, 108, 50, 0.08);
  box-shadow: 0 8px 0 -4px #ff6c32;
}

[data-rarity="l"] .monster-cell,
.monster-cell[data-rarity="l"] {
  border-color: #F5CC44;
  background-color: rgba(245, 204, 68, 0.08);
  box-shadow: 0 8px 0 -4px #F5CC44;
}

/* summary */
#summaryGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 20px auto 40px;
  max-width: 100%;
}

.summary-heading {
  font-size: 1.6rem;
  font-weight: 600;
  opacity: 0.9;
  margin: 50px 0 12px 0;
}

@media (max-width: 1000px) {
  #summary-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }
}

/* start prompt */
#start {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Juxel", sans-serif;
  font-size: clamp(3rem, 10vw, 10rem);
  color: #ffffff;
  z-index: 999999;
  animation: blink 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes blink {
  0% { opacity: 0; }
  10% { opacity: 1; }
  25% { opacity: 0; }
  40% { opacity: 1; }
  60% { opacity: 0; }
  100% { opacity: 0; visibility: hidden; }
}

/* end screen */
#endScreen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: start;
  padding: 80px 0 100px 0;
  align-items: center;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 2000;
  color: #fff;
  text-align: center;
  overflow-y: auto;
  pointer-events: none;
}

#endScreen.open {
  display: flex;
  animation: fadeIn 0.8s ease forwards;
  pointer-events: auto;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.end-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 800px;
  width: 40%;
}

@media (max-width: 1000px) {
  .end-content {
    width: 90%;
  }
}

#endTitle {
  font-size: clamp(3rem, 10vw, 8rem);
  margin: 0;
  letter-spacing: 0.05em;
  animation: blink2 1s ease forwards;
}

@keyframes blink2 {
  0% { opacity: 0; }
  10% { opacity: 1; }
  25% { opacity: 0; }
  40% { opacity: 1; }
  60% { opacity: 0; }
  100% { opacity: 1; }
}

.end-stats {
  font-size: 1.2rem;
  opacity: 0.8;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#endGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 20px;
}

#endGrid img {
  width: 100%;
  border: 2px solid #facc15;
  box-shadow: 0 8px 0 -4px #facc15;
}

.end-buttons {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

.end-buttons button {
  background: transparent;
  border: 2px solid #fff;
  color: white;
  padding: 10px 20px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 0;
}

.end-buttons button:hover {
  background: #ffffff;
  color: #000;
}

#endScreen.win #endTitle {
  color: #facc15;
}

#endScreen.lose #endTitle {
  color: #f64545;
}

#endCollected {
  color: #66EE96;
  font-weight: 700;
}

#endMissed {
  color: #F57B68;
  font-weight: 700;
}

/* center message */
.hidden {
  visibility: hidden;
  opacity: 0;
  display: none;
}

#centerMessage {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 18px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
}

#centerMessage.show {
  opacity: 1;
}

#centerMessage.fade {
  opacity: 0;
}

/* burst cubes */
.burst-cube {
  position: absolute;
  bottom: 0;
  width: 8px;
  height: 8px;
  background: #f5cc44;
  opacity: 1;
  animation: burstUp 1.5s ease-out forwards;
}

@keyframes burstUp {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-60px) scale(0.5); opacity: 0; }
}




.bam {
  animation: bam 0.35s cubic-bezier(0.45, 1.8, 0.5, 1) forwards;
}


@keyframes bam {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}


#flash {
  position: fixed;
  inset: 0;
  background: #F85F67;
  opacity: 0;
  pointer-events: none;
  z-index: 10000;
  transition: opacity 0.2s ease;
}

#flash.active {
  opacity: 0.8;
  transition: opacity 0.2s ease;
}
