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

body {
  background: #ffffff;
  overflow: hidden;
  font-family: 'Borel', cursive;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  width: 100vw;
  height: 100dvh;
  position: relative;
  cursor: pointer;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- Settings button --- */
#settings-btn {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 20;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

#settings-btn:hover {
  opacity: 1;
}

#settings-btn img {
  width: 24px;
  height: 24px;
}

/* --- Settings modal --- */
#settings-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  opacity: 1;
  transition: opacity 0.3s ease;
}

#settings-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

#settings-panel {
  background: #fff;
  border-radius: 16px;
  padding: 32px 36px;
  min-width: 260px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  text-align: center;
  font-family: 'Baloo Paaji 2', cursive;
}

#settings-panel h2 {
  font-size: 22px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
}

#settings-panel label {
  display: block;
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

#settings-panel input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  font-family: 'Baloo Paaji 2', cursive;
  font-size: 18px;
  border: 2px solid #ddd;
  border-radius: 10px;
  text-align: center;
  outline: none;
  transition: border-color 0.3s ease;
}

#settings-panel input[type="number"]:focus {
  border-color: #999;
}

#settings-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

#settings-actions button {
  flex: 1;
  padding: 10px 0;
  font-family: 'Baloo Paaji 2', cursive;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

#settings-cancel {
  background: #eee;
  color: #555;
}

#settings-cancel:hover {
  background: #ddd;
}

#settings-apply {
  background: #333;
  color: #fff;
}

#settings-apply:hover:not(:disabled) {
  background: #555;
}

#settings-apply:disabled {
  background: #ccc;
  color: #999;
  cursor: default;
}

#counter {
  position: absolute;
  top: 20px;
  right: 24px;
  font-family: 'Baloo Paaji 2', cursive;
  font-size: 18px;
  font-weight: 700;
  color: #444;
  z-index: 10;
  transition: opacity 0.6s ease;
}

#title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  pointer-events: none;
  transition: opacity 1.2s ease, top 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#title.complete {
  top: 12%;
}

#title h1 {
  font-size: clamp(28px, 7vw, 56px);
  font-weight: 400;
  color: #333;
  letter-spacing: 1px;
}

#start-hint {
  position: absolute;
  bottom: 10vh;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Baloo Paaji 2', cursive;
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 600;
  color: #555;
  z-index: 10;
  pointer-events: none;
  transition: opacity 1.2s ease;
}

#start-hint.hidden {
  opacity: 0;
}

#title.hidden {
  opacity: 0;
}

/* --- Install button --- */
#install-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: 'Baloo Paaji 2', cursive;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid #ddd;
  border-radius: 50px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  opacity: 1;
  transition: opacity 0.5s ease, transform 0.3s ease, background 0.3s ease;
  pointer-events: auto;
}

#install-btn:hover {
  background: rgba(245, 245, 245, 0.95);
}

#install-btn:active {
  transform: translateX(-50%) scale(0.96);
}

#install-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

#install-btn svg {
  flex-shrink: 0;
}

.complete-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: clamp(22px, 5vw, 40px);
  font-weight: 400;
  color: #333;
}

.complete-message.visible {
  opacity: 1;
}
