@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@700;900&display=swap");

:root {
  --bg: #f0f6ff;
  --sky: #d0e8ff;
  --ground: #a8ccf0;
  --accent: #3a7bd5;
  --accent2: #7ab3e8;
  --text: #1a2e4a;
  --shadow: #7ab3e888;
  --white: #ffffff;
  --score-bg: #eaf3ff;
}

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

body {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
}

#game-wrapper {
  position: relative;
  display: inline-block;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 8px 40px var(--shadow);
  border: 3px solid var(--accent2);
  width: min(700px, 100vw);
}

#score-display {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 10;
  background: var(--score-bg);
  border: 2px solid var(--accent2);
  border-radius: 999px;
  padding: 4px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px var(--shadow);
}

#score-label {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

#score-value {
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  min-width: 36px;
  text-align: right;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* overlay */
#overlay {
  position: absolute;
  inset: 0;
  background: #eaf3ffcc;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  overflow-y: auto;
  padding: 12px;
}

#overlay.visible {
  opacity: 1;
  pointer-events: all;
}

#overlay-box {
  background: var(--white);
  border: 3px solid var(--accent2);
  border-radius: 28px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 8px 32px var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#overlay-title {
  font-size: 36px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.15;
}

#overlay-title span {
  color: var(--accent);
  font-size: 42px;
}

#overlay-sub {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

#overlay-sub.hidden,
#game-description.hidden {
  display: none;
}

#game-description p {
  line-height: 1.8;
}

#start-btn {
  margin-top: 4px;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 12px 40px;
  font-size: 20px;
  font-weight: 900;
  font-family: "Nunito", sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--shadow);
  transition:
    transform 0.12s,
    box-shadow 0.12s;
}

#start-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 24px var(--shadow);
}

#start-btn:active {
  transform: scale(0.97);
}

#ranking-list {
  list-style: none;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

#ranking-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--score-bg);
  border-radius: 999px;
  padding: 4px 16px;
}

.medal {
  font-size: 18px;
}

#share-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

#share-x-btn,
#share-bsky-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 900;
  font-family: "Nunito", sans-serif;
  cursor: pointer;
  transition:
    transform 0.12s,
    box-shadow 0.12s;
}

#share-x-btn {
  background: #000;
  color: #fff;
  box-shadow: 0 4px 12px #0004;
}

#share-bsky-btn {
  background: #0085ff;
  color: #fff;
  box-shadow: 0 4px 12px #0085ff44;
}

#share-x-btn:hover,
#share-bsky-btn:hover {
  transform: translateY(-2px) scale(1.04);
}

#controls-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  opacity: 0.75;
}

@media (max-width: 500px) {
  #overlay-box {
    padding: 20px 24px;
    gap: 10px;
  }
  #overlay-title {
    font-size: 24px;
  }
  #overlay-title span {
    font-size: 28px;
  }
  #overlay-sub {
    font-size: 15px;
  }
  #start-btn {
    font-size: 16px;
    padding: 10px 28px;
  }
  #game-description p {
    font-size: 13px;
    line-height: 1.6;
  }
  #ranking-list {
    font-size: 13px;
    margin: 10px 0;
  }
}
