html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0a0e1c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", sans-serif;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 0;
  pointer-events: none;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

.hud-block {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.hud-block.right {
  align-items: flex-end;
}

.hud-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

#score,
#best {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

#best {
  font-size: 20px;
  opacity: 0.9;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: break-word;
  color: #ffffff;
  background: rgba(6, 10, 24, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

#overlay.hidden {
  display: none;
}

#overlay-title {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

#overlay-text {
  margin: 0 0 6px;
  max-width: 320px;
  font-size: 14px;
  line-height: 1.6;
  opacity: 0.85;
}

#color-pick {
  display: flex;
  gap: 10px;
  margin: 18px 0 0;
}

.char-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.char-preview {
  display: block;
  width: 48px;
  height: 48px;
}

.char-option.selected {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.32);
  transform: scale(1.08);
}

.char-option:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

#overlay-score {
  margin: 14px 0 0;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ffd25a;
}

#ranking-status {
  margin: 12px 0 0;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.6;
  opacity: 0.85;
  word-break: keep-all;
  overflow-wrap: break-word;
  white-space: pre-line;
}

#overlay-hint {
  margin: 22px 0 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.95;
  animation: pulse 1.4s ease-in-out infinite;
}

.hidden {
  display: none;
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
