/* Ginka Font Faces */
@font-face {
  font-family: "Ginka";
  src: url("fonts/Ginka-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "Ginka";
  src: url("fonts/Ginka-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
}
@font-face {
  font-family: "Ginka";
  src: url("fonts/Ginka-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
}
@font-face {
  font-family: "Ginka";
  src: url("fonts/Ginka-Medium_Italic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
}
@font-face {
  font-family: "Ginka";
  src: url("fonts/Ginka-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
}
@font-face {
  font-family: "Ginka";
  src: url("fonts/Ginka-Bold_Italic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
}
@font-face {
  font-family: "Ginka";
  src: url("fonts/Ginka-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
}
@font-face {
  font-family: "Ginka";
  src: url("fonts/Ginka-Light_Italic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
}

/* Base typography */
body {
  font-family: "Ginka", sans-serif;
  line-height: 1.4;
  background: #fdfdfd;
}

/* Fixed banners over the sketch */
#content-top,
#content-bottom {
  position: fixed;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 200;
  pointer-events: none; /* allow clicks to pass to canvas */
}

#content-top {
  top: 80px; /* Move down to avoid HUD overlap */
}

#content-bottom {
  bottom: 16px;
}
#content-top h1 {
  font-size: clamp(2.5rem, 8vw, 4rem);
  margin: 0.25em 0;
}

#content-bottom h1 {
  font-size: clamp(1.5rem, 5vw, 2rem);
  margin: 0.25em 0;
}

#content-top h2 {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  margin: 0.5rem;
}

h2,
h3 {
  font-weight: 700;
  margin: 0.5em 0 0.25em;
}

label,
button,
input,
ol {
  font-size: clamp(0.9rem, 2.5vw, 1rem);
}

button {
  font-family: inherit;
  padding: 0.4em 0.8em;
  border: 1px solid #333;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background: #f2f2f2;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}
canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Game HUD for score and timer */
#gameHud {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 20px;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  font-size: 16px;
  font-weight: 700;
  color: #333;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

#gameHud span {
  display: inline-block;
}

#gameHud .separator {
  opacity: 0.3;
  font-weight: 400;
}
#ui-overlay.hidden {
  display: none;
}
#ui-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#dialog {
  /* Glassy card look */
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  padding: 2rem 2.5rem;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  animation: popIn 350ms ease-out;
  position: relative;
}

@keyframes popIn {
  from {
    transform: translateY(20px) scale(0.94);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}

#dialog h2 {
  color: var(--accent, #4135b5);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

#dialog h3 {
  margin: 1.2rem 0 0.4rem;
  font-size: 1.25rem;
}

#leaderboardList {
  text-align: left;
  max-height: 200px;
  overflow: auto;
  padding-left: 0;
  margin: 0;
  list-style: none;
}

#leaderboardList li {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#scoreForm {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

#scoreForm input {
  flex: 1 1 auto;
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  font-family: inherit;
  font-size: 16px; /* Prevents zoom on iOS when focusing input */
  -webkit-appearance: none; /* Remove iOS default styling */
  appearance: none;
}

#scoreForm button {
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  border: none;
  background: var(--accent, #4135b5);
  color: #fff;
  transition: background 0.2s;
  font-weight: 500;
}

#scoreForm button:hover {
  background: var(--accentHover, #33279b);
}

/* Curved title text in SVG */
#curvedTitle {
  margin-bottom: 1rem;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  #content-top {
    top: 60px; /* Move down to avoid HUD overlap on mobile */
  }

  #content-bottom {
    bottom: 10px;
  }

  #gameHud {
    font-size: 14px;
    padding: 6px 15px;
    gap: 8px;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  #gameHud {
    font-size: 12px;
    padding: 5px 10px;
    gap: 6px;
  }

  #gameHud .separator {
    display: none; /* Hide separators on very small screens */
  }

  #dialog {
    padding: 1.5rem;
    width: 95%;
  }

  #dialog h2 {
    font-size: 1.3rem;
  }

  #dialog h3 {
    font-size: 1.1rem;
  }

  #scoreForm {
    flex-direction: column;
  }

  #scoreForm input,
  #scoreForm button {
    width: 100%;
  }

  #scoreForm input {
    font-size: 16px; /* Ensure 16px on mobile to prevent zoom */
    padding: 0.5rem 0.8rem; /* Larger touch target on mobile */
  }
}

#addToCalendar {
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto; /* allow interaction despite parent disabling events */
}
